Recent Releases of rfplus
rfplus - release v1.3-0
Version 1.3-0 (CRAN)
New Features
- Removed dependency on 'dplyr' and migrated all code to 'data.table' to ensure efficiency and speed for large data sets.
- Added functionality to apply point-to-pixel validation. The metrics analyzed are: Pearson correlation coefficient (CC), root mean square error (RMSE), modified Kling-Gupta efficiency (KGE), relative bias (PBIAS), probability of detection (POD), false alarm rate (FAR), critical success index (CSI).
- Removed dependencies on external libraries for FAR, POD, CSI calculations. Calculations are now performed using R base functions.
- A complete refactoring of the code has been carried out to improve its efficiency and ease of maintenance.
Bug Fixe
- Fixed a bug in 'wet.day' when set to False, rounding was still performed.
- Fixed 'pboptions' slash bug that caused a new slash to be created at each iteration when setting char = “=”.
- R
Published by Jonnathan-Landi over 1 year ago
rfplus - RFplus
Progressive Bias Correction of Satellite Environmental Data using RFplus
author: Jonnathan Augusto Landi Bermeo
Introduction
The RFplus package applies a hybrid bias correction technique that combines Random Forest (RF) and Quantile Mapping (QM) methods to adjust satellite data, such as precipitation, to match in-situ observations. The correction process is carried out in three distinct steps:
- Base Prediction: A Random Forest model is trained using satellite data and additional covariates to predict the bias between satellite estimates and in-situ observations.
- Residual Correction: A second Random Forest model is then used to correct the residuals from the base prediction, further improving the accuracy of the satellite data.
- Distribution Adjustment: Quantile mapping (either QUANT or RQUANT) is applied to adjust the distribution of satellite data, aligning it with the observed data distribution. This step ensures that the corrected satellite data not only matches the mean but also the distribution, improving the representation of extreme values, such as heavy precipitation.
In RFplus, the Quantile Mapping method is applied locally, based on a user-defined search radius around the in-situ stations. This means that the distribution of the satellite data for each pixel is adjusted using the nearby in-situ measurements, ensuring that the correction is geographically relevant and reflects local conditions.
Although RFplus was initially designed for bias correction of satellite precipitation products, it is flexible enough to be adapted for use with other satellite data sources (e.g., bias correction of satellite products for temperature, wind speed, etc.), making it a versatile tool for bias correction in remote sensing applications.
Example using RFplus
```{r}
Load necessary libraries
library(RFplus) library(terra) library(data.table) ```
Load the example datasets
```{r}
Load the in-situ data and the coordinates
data("BDInsitu") data("CordsInsitu")
Load the covariates
MSWEP = terra::rast(system.file("extdata/MSWEP.nc", package = "RFplus")) CHIRPS = terra::rast(system.file("extdata/CHIRPS.nc", package = "RFplus")) DEM = terra::rast(system.file("extdata/DEM.nc", package = "RFplus"))
```
Prepare covariates
```{r}
Verify the extension and the reference coordinate system of the covariates.
extension
terra::ext(MSWEP) terra::ext(CHIRPS) terra::ext(DEM)
reference coordinate system
terra::crs(MSWEP) terra::crs(CHIRPS) terra::crs(DEM)
Adjust individual covariates to the covariate format required by RFplus
Covariates_list = list(MSWEP = MSWEP, CHIRPS = CHIRPS, DEM = DEM) ```
Apply the RFplus bias correction model
```{r}
Apply the RFplus bias correction model using Non-parametric quantile mapping using empirical quantiles (method = "QUANT")
modelQuant = RFplus(BDInsitu = BDInsitu, CordsInsitu = CordsInsitu, Covariates = Covariateslist, nround = 1, wet.day = 0.1, ntree = 2000, seed = 123, method = "QUANT", ratio = 15, savemodel = FALSE, name_save = NULL)
Apply the RFplus bias correction model using Non-parametric quantile mapping using robust empirical quantiles. (method = "RQUANT")
modelRQuant = RFplus(BDInsitu = BDInsitu, CordsInsitu = CordsInsitu, Covariates = Covariateslist, nround = 1, wet.day = 0.1, ntree = 2000, seed = 123, method = "RQUANT", ratio = 15, savemodel = FALSE, name_save = NULL)
If you do not want to perform the quantile mapping adjustment use the method = "none"
modelnone = RFplus(BDInsitu = BDInsitu, CordsInsitu = CordsInsitu, Covariates = Covariateslist, nround = 1, wet.day = 0.1, ntree = 2000, seed = 123, method = "none", ratio = 15, savemodel = FALSE, name_save = NULL) ```
Example of how to visualize the result
```{r}
First layer of the QUANT method
plot(model_Quant[[1]])
First layer of the RQUANT method
plot(model_RQuant[[1]])
First layer of the none method
plot(model_none[[1]])
```
Conclusion
The RFplus method improves satellite-based precipitation estimates by correcting biases using both machine learning (Random Forest) and statistical distribution adjustment (Quantile Mapping). By applying these corrections, RFplus ensures that satellite data not only aligns with observed data in terms of mean values but also in terms of the underlying distribution, which is particularly useful for accurately capturing extreme weather events such as heavy precipitation. The flexibility of RFplus allows its application to a wide range of satellite data products beyond precipitation, including temperature and wind speed, making it a versatile tool for bias correction in remote sensing applications.
Full Changelog: https://github.com/Jonnathan-Landi/RFplus/commits/relsease
- R
Published by Jonnathan-Landi over 1 year ago