-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
61 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
Package: RFmerge | ||
Type: Package | ||
Title: Merging of Satellite Datasets with Ground Observations using Random Forests | ||
Version: 0.2-0 | ||
Version: 0.2-2 | ||
Author: Mauricio Zambrano-Bigiarini [aut, cre, cph] (<https://orcid.org/0000-0002-9536-643X>), Oscar M. Baez-Villanueva [aut, cph], Juan Giraldo-Osorio [ctb] | ||
Authors@R: c(person("Mauricio Zambrano-Bigiarini", email = "[email protected]", role=c("aut", "cre", "cph"), comment=c(ORCID = "0000-0002-9536-643X")), person("Oscar M. Baez-Villanueva", email = "[email protected]", role=c("aut", "cph")), person("Juan Giraldo-Osorio", email = "[email protected]", role=c("ctb")) ) | ||
Maintainer: Mauricio Zambrano-Bigiarini <[email protected]> | ||
Description: S3 implementation of the Random Forest MErging Procedure (RF-MEP), which combines two or more satellite-based datasets (e.g., precipitation products, topography) with ground observations to produce a new dataset with improved spatio-temporal distribution of the target field. In particular, this package was developed to merge different Satellite-based Rainfall Estimates (SREs) with measurements from rain gauges, in order to obtain a new precipitation dataset where the time series in the rain gauges are used to correct different types of errors present in the SREs. However, this package might be used to merge other hydrological/environmental satellite fields with point observations. For details, see Baez-Villanueva et al. (2020) <doi:10.1016/j.rse.2019.111606>. Bugs / comments / questions / collaboration of any kind are very welcomed. | ||
Description: S3 implementation of the Random Forest MErging Procedure (RF-MEP), which combines two or more satellite-based datasets (e.g., precipitation products, topography) with ground observations to produce a new dataset with improved spatio-temporal distribution of the target field. In particular, this package was developed to merge different Satellite-based Rainfall Estimates (SREs) with measurements from rain gauges, in order to obtain a new precipitation dataset where the time series in the rain gauges are used to correct different types of errors present in the SREs. However, this package might be used to merge other hydrological/environmental gridded datasets with point observations. For details, see Baez-Villanueva et al. (2020) <doi:10.1016/j.rse.2019.111606>. Bugs / comments / questions / collaboration of any kind are very welcomed. | ||
License: GPL (>=3) | ||
Depends: R (>= 3.5.0) | ||
Imports: terra, randomForest, zoo, parallel, methods, stats, utils, pbapply | ||
|
@@ -17,4 +17,4 @@ BugReports: https://github.com/hzambran/RFmerge/issues | |
LazyLoad: yes | ||
NeedsCompilation: no | ||
Repository: CRAN | ||
Packaged: Wed 19 Jul 2023 07:21:40 PM -04; hzambran | ||
Packaged: Sun Jul 23 09:25:40 -04 2023; hzambran |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,37 +26,37 @@ RFmerge(x, ...) | |
seed = NULL, ntree = 2000, na.action = stats::na.omit, | ||
parallel=c("none", "parallel", "parallelWin"), | ||
par.nnodes=parallel::detectCores()-1, | ||
par.pkgs= c("raster", "randomForest", "zoo"), write2disk=FALSE, | ||
par.pkgs= c("terra", "randomForest", "zoo"), write2disk=FALSE, | ||
drty.out, use.pb=TRUE, verbose=TRUE,...) | ||
|
||
\method{RFmerge}{zoo}(x, metadata, cov, mask, training, | ||
id="id", lat = "lat", lon = "lon", ED = TRUE, | ||
seed = NULL, ntree = 2000, na.action = stats::na.omit, | ||
parallel=c("none", "parallel", "parallelWin"), | ||
par.nnodes=parallel::detectCores()-1, | ||
par.pkgs= c("raster", "randomForest", "zoo"), write2disk=FALSE, | ||
par.pkgs= c("terra", "randomForest", "zoo"), write2disk=FALSE, | ||
drty.out, use.pb=TRUE, verbose=TRUE, ...) | ||
|
||
|
||
} | ||
%- maybe also 'usage' for other objects documented here. | ||
\arguments{ | ||
\item{x}{ | ||
data.frame witht the ground-based values that will be used as the dependent variable to train the RF model. \cr | ||
data.frame with the ground-based values that will be used as the dependent variable to train the RF model. \cr | ||
Every column must represent one ground-based station and the codes of the stations must be provided as colnames. class(data) must be zoo. | ||
} | ||
\item{metadata}{ | ||
data.frame with the metadata of the ground-based stations. At least, it MUST have the following 3 columns: \cr | ||
-) \kbd{id}: This column stores the unique identifier (ID) of each ground-based observation. Default value is \kbd{"id"}. \cr | ||
-) \kbd{lat}: This column stores the latitude of ech ground observation. Default value is \kbd{"lat"}. \cr | ||
-) \kbd{lon}: This column stores the longitude of ech ground observation. Default value is \kbd{"lon"}. | ||
-) \kbd{lat}: This column stores the latitude of each ground observation. Default value is \kbd{"lat"}. \cr | ||
-) \kbd{lon}: This column stores the longitude of each ground observation. Default value is \kbd{"lon"}. | ||
} | ||
\item{cov}{ | ||
List with all the covariates used as independent variables in the Random Forest model. The individual covariates can be a \kbd{RasterStack} or \kbd{RasterBrick} object when they vary in time, or they can be a single \kbd{RasterLayer} object when they do not change in time (e.g., a digital elevation model). \cr | ||
All time-varying covariates in \code{cov} MUST have the same number of layers (bands). Covariates that do not change in time (e.g., a DEM) are internally trasnformed into \kbd{RasterStack} or \kbd{RasterBrick} objects with the same number of layers as the other time-varying elements in \code{cov} | ||
All time-varying covariates in \code{cov} MUST have the same number of layers (bands). Covariates that do not change in time (e.g., a DEM) are internally transformed into \kbd{RasterStack} or \kbd{RasterBrick} objects with the same number of layers as the other time-varying elements in \code{cov} | ||
} | ||
\item{mask}{ | ||
OPTIONAL. If provided, the final merged product maks out all values in \code{cov} outside \code{mask}. \cr | ||
OPTIONAL. If provided, the final merged product mask out all values in \code{cov} outside \code{mask}. \cr | ||
Spatial object (vectorial) with the spatial borders of the study area (e.g., catchment, administrative borders). \code{class(mask)} must be a \kbd{sf} object with "POLYGON" or "MULTIPOLYGON" geometry. | ||
} | ||
\item{training}{ | ||
|
@@ -73,7 +73,7 @@ Character, with the name of the column in \code{metadata} where the latitude of | |
Character, with the name of the column in \code{metadata} where the longitude of the stations is stored. | ||
} | ||
\item{ED}{ | ||
logical, should the Euclidean distances be computed an used as covariates in the random fores model?. The default value is \code{TRUE}. | ||
logical, should the Euclidean distances be computed an used as covariates in the random forest model?. The default value is \code{TRUE}. | ||
} | ||
\item{seed}{ | ||
Numeric, indicating a single value, interpreted as an integer, or null. | ||
|
@@ -100,7 +100,7 @@ Numeric indicating the maximum number trees to grow in the Random Forest algorit | |
A function to specify the action to be taken if NAs are found. (NOTE: If given, this argument must be named.) | ||
} | ||
\item{write2disk}{ | ||
logical, indicates if the output merged raster layers and the training and avaluation datasets (two files each, one with time series and other with metadata) will be written to the disk. By default \code{write2disk=FALSE} | ||
logical, indicates if the output merged raster layers and the training and evaluation datasets (two files each, one with time series and other with metadata) will be written to the disk. By default \code{write2disk=FALSE} | ||
} | ||
\item{drty.out}{ | ||
Character with the full path to the directory where the final merged product will be exported as well as the training and evaluation datasets. Only used when \code{write2disk=TRUE} | ||
|
@@ -139,23 +139,24 @@ Juan D. Giraldo-Osorio, \email{[email protected]} | |
%% ~Make other sections like Warning with \section{Warning }{....} ~ | ||
\seealso{ | ||
\code{\link[raster]{raster}}, \code{\link[raster]{stack}}, \code{\link[raster]{brick}}, \code{\link[raster]{resample}}, \code{\link[raster]{rotate}}, \code{\link[raster]{crop}}. | ||
\code{\link[terra]{terra}}, \code{\link[terra]{rast}}, \code{\link[terra]{resample}}, \code{\link[terra]{rotate}}, \code{\link[raster]{crop}}. | ||
} | ||
\examples{ | ||
library(rgdal) | ||
library(raster) | ||
library(terra) | ||
data(ValparaisoPPts) | ||
data(ValparaisoPPgis) | ||
data(ValparaisoSHP) | ||
ValparaisoSHP.fname <- system.file("extdata/ValparaisoSHP.shp",package="RFmerge") | ||
ValparaisoSHP <- terra::vect(ValparaisoSHP.fname) | ||
chirps.fname <- system.file("extdata/CHIRPS5km.tif",package="RFmerge") | ||
prsnncdr.fname <- system.file("extdata/PERSIANNcdr5km.tif",package="RFmerge") | ||
dem.fname <- system.file("extdata/ValparaisoDEM5km.tif",package="RFmerge") | ||
CHIRPS5km <- brick(chirps.fname) | ||
PERSIANNcdr5km <- brick(prsnncdr.fname) | ||
ValparaisoDEM5km <- raster(dem.fname) | ||
CHIRPS5km <- rast(chirps.fname) | ||
PERSIANNcdr5km <- rast(prsnncdr.fname) | ||
ValparaisoDEM5km <- rast(dem.fname) | ||
covariates <- list(chirps=CHIRPS5km, persianncdr=PERSIANNcdr5km, | ||
dem=ValparaisoDEM5km) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters