Skip to content

Commit

Permalink
ForesToolboxRS
Browse files Browse the repository at this point in the history
  • Loading branch information
ytarazona committed Oct 9, 2020
1 parent 3758d16 commit 0f7a72d
Show file tree
Hide file tree
Showing 55 changed files with 3,780 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.gitignore
LICENSE
README.md
TODO
^revdep$
^.*\.Rproj$
^\.Rproj\.user$
.travis.yml
55 changes: 55 additions & 0 deletions .github/main.workflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
workflow "Render and Deploy RMarkdown Website" {
on = "push"
resolves = [
"Render",
"Deploy"
]
}

action "Build image" {

uses = "actions/docker/cli@aea64bb1b97c42fa69b90523667fef56b90d7cff"
args = [
"build --tag=repo:latest ."
]
}

action "Render" {
needs = [
"Build image"
]
uses = "maxheld83/ghactions/Rscript-byod@master"
args = [
"--verbose",
"--echo",
"-e \"{\"",
"-e \" deploy_dir <- rmarkdown::render_site(encoding = \"UTF-8\")\"",
"-e \" readr::write_lines(x = deploy_dir, path = \".deploy_dir\", \"",
"-e \" append = FALSE)\"",
"-e \"}\""
]
}

action "Filter master" {
needs = [
"Render"
]
uses = "actions/bin/filter@a9036ccda9df39c6ca7e1057bc4ef93709adca5f"
args = [
"branch master"
]
}

action "Deploy" {
needs = [
"Filter master"
]
uses = "maxheld83/[email protected]"
env = {
BUILD_DIR = "_site"
}
secrets = [
"GH_PAT"
]
}

73 changes: 73 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
Package: ForesToolboxRS
Version: 0.0.1
Type: Package
Title: Remote Sensing Tools for Forest Monitoring
Authors@R:
c(person(given = "Yonatan",
family = "Tarazona Coronel",
role = c("aut","cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0002-5208-1004")),
person(given = "Alaitz",
family = "Zabala",
role = c("ctb"),
email = "[email protected]",
comment = c(ORCID = "0000-0002-3931-4221")),
person(given = "Xavier",
family = "Pons",
role = c("ctb"),
email = "[email protected]",
comment = c(ORCID = "0000-0002-6924-1641")),
person(given = "Antoni",
family = "Broquetas",
role = c("ctb"),
email = "[email protected]",
comment = c(ORCID = "-")),
person(given = "Hamdi",
family = "A. Zurqani",
role = c("ctb"),
email = "[email protected]",
comment = c(ORCID = "0000-0002-9250-4534")),
person(given = "Cesar",
family = "Aybar",
role = c("ctb"),
email = "[email protected]",
comment = c(ORCID = "0000-0003-2745-9535")))
Description: Remote sensing tools for forest monitoring includes a series of
novel techniques to monitor forest through optical images and fusion of optical
and microwave data. All tools are based on scientific publications.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.1
Depends:
R (>= 3.3.0),
raster,
Imports:
methods,
stats,
forecast,
parallel,
dplyr,
raster,
rgdal,
magrittr,
zoo,
factoextra,
FactoMineR,
graphics,
grDevices,
stars,
caret,
e1071,
rpart,
randomForest,
nnet,
kknn,
rgeos,
WilcoxCV
Suggests:
testthat (>= 2.1.0),
rmarkdown,
covr,
roxygen2
22 changes: 22 additions & 0 deletions ForesToolboxRS.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageCheckArgs: --as-cran
PackageRoxygenize: rd,collate,namespace,vignette
54 changes: 54 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Generated by roxygen2: do not edit by hand

export(calkmeans)
export(calmla)
export(coverChange)
export(fusionRS)
export(gevi)
export(linearTrend)
export(mla)
export(ndfiSMA)
export(pvts)
export(pvtsRaster)
export(sma)
export(smootH)
export(tct)
importFrom(WilcoxCV,generate.split)
importFrom(caret,confusionMatrix)
importFrom(caret,createFolds)
importFrom(dplyr,bind_cols)
importFrom(dplyr,bind_rows)
importFrom(e1071,naiveBayes)
importFrom(e1071,svm)
importFrom(factoextra,get_pca_var)
importFrom(forecast,na.interp)
importFrom(grDevices,adjustcolor)
importFrom(graphics,abline)
importFrom(graphics,grid)
importFrom(graphics,legend)
importFrom(graphics,plot)
importFrom(graphics,points)
importFrom(graphics,polygon)
importFrom(graphics,text)
importFrom(kknn,train.kknn)
importFrom(methods,is)
importFrom(nnet,nnet)
importFrom(randomForest,randomForest)
importFrom(raster,as.data.frame)
importFrom(raster,brick)
importFrom(raster,extent)
importFrom(raster,extract)
importFrom(raster,getValues)
importFrom(raster,plotRGB)
importFrom(raster,values)
importFrom(rgeos,gIntersects)
importFrom(rpart,rpart)
importFrom(stars,read_stars)
importFrom(stats,na.omit)
importFrom(stats,prcomp)
importFrom(stats,sd)
importFrom(stats,time)
importFrom(stats,ts)
importFrom(zoo,na.approx)
importFrom(zoo,na.spline)
importFrom(zoo,rollapply)
25 changes: 25 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

# ForesToolboxRS 0.0.1
=====================================

Initial release with the following functions:

* **pvts** This algorithm will allow to detect disturbances in the forests using all the available Landsat set. In fact, it can also be run with sensors such as MODIS.
* **pvtsRaster** This algorithm will allow to detect disturbances in the forests using all the available Landsat set. In fact, it can also be run with sensors such as MODIS.
* **smootH** In order to eliminate outliers in the time series, a temporary smoothing is used.
* **mla** This developed function allows to execute supervised and unsupervised classification in satellite images through various algorithms.
* **calmla** This function allows to calibrate supervised classification in satellite images through various algorithms and using approches such as Set-Approach, Leave-One-Out Cross-Validation (LOOCV), Cross-Validation (k-fold) and Monte Carlo Cross-Validation (MCCV).
* **calkmeans** This function allows to calibrate the kmeans algorithm. It is possible to obtain the best k value and the best embedded algorithm in kmeans.
* **coverChange** This algorithm is able to obtain gain and loss in land cover classification.
* **linearTrend** Linear trend is useful for mapping forest degradation, land degradation, among others. This algorithm is capable of obtaining the slope of an ordinary least-squares linear regression and its reliability (p-value).
* **fusionRS** This algorithm allows to fusion images coming from different spectral sensors (e.g., optical-optical, optical and SAR or SAR-SAR). Among many of the qualities of this function, it is possible to obtain the contribution (%) of each variable in the fused image.
* **sma** The SMA assumes that the energy received, within the field of vision of the remote sensor, can be considered as the sum of the energies received from each dominant endmember. This function addresses a Linear Mixing Model.
* **ndfiSMA** The NDFI it is sensitive to the state of the canopy cover, and has been successfully applied to monitor forest degradation and deforestation in Peru and Brazil. This index comes from the endmembers Green Vegetation (GV), non-photosynthetic vegetation (NPV), Soil (S) and the reminder is the shade component.
* **tct** The Tasseled-Cap Transformation is a linear transformation method for various remote sensing data. Not only can it perform volume data compression, but it can also provide parametersassociated with the physical characteristics, such as brightness, greenness and wetness indices.
* **gevi** Greenness Vegetation Index is obtained from the Tasseled Cap Transformation.


Included example data sets:
* data(FTdata)


40 changes: 40 additions & 0 deletions R/ForesToolboxRS-utils.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#' Is a character, Raster or stars object?
#' @importFrom methods is
#' @importFrom stars read_stars
#' @param x object to evaluate
#' @return a stars object
#' @noRd
ftb_whatkinditis <- function(x) {
if (is.character(x)) {
x <- read_stars(x)
} else if (is(x, "stars")) {
x
} else if (is(x, "RasterLayer") | is(x, "RasterStack") | is(x, "RasterBrick")) {
x <- st_as_stars(x)
# stack(mapply(function(z) as(x[z],'Raster'),seq_len(length(x))))
} else {
stop(class(x), " class is not supported")
}
return(x)
}


#' Is a 3D or a 4D spatial object?
#' @importFrom methods is
#' @param x object to evaluate
#' @noRd
is_nD <- function(x) {
if (is.character(x)) {
xx <- read_stars(x, proxy = TRUE)
if (length(xx) > 1) time <- 1 else time <- 0
nD <- sprintf("%sD", length(dim(xx)) + time)
} else if (is(x, "stars")) {
nD <- sprintf("%sD", length(dim(x)))
} else if (is(x, "RasterStack") | is(x, "RasterBrick")) {
nD <- "3D"
# stack(mapply(function(z) as(x[z],'Raster'),seq_len(length(x))))
} else {
stop(class(x), " class is not supported")
}
return(nD)
}
Loading

0 comments on commit 0f7a72d

Please sign in to comment.