| Title: | Precipitation R Recipes |
|---|---|
| Description: | An open-access tool/framework to download, validate, visualize, and analyze multi-source precipitation data. More information and an example of implementation can be found in Vargas Godoy and Markonis (2023, <doi:10.1016/j.envsoft.2023.105711>). |
| Authors: | Mijael Rodrigo Vargas Godoy [aut, cre] (ORCID: <https://orcid.org/0000-0002-1828-9266>), Yannis Markonis [aut, ths] (ORCID: <https://orcid.org/0000-0003-0144-8969>) |
| Maintainer: | Mijael Rodrigo Vargas Godoy <[email protected]> |
| License: | GPL-3 |
| Version: | 3.0.3 |
| Built: | 2026-05-12 08:12:06 UTC |
| Source: | https://github.com/mirovago/precipe |
Function for calculating the critical success index.
csi(x, ref, th)csi(x, ref, th)
x |
a data.table generated by |
ref |
a data.table with data used for evaluation |
th |
numeric. The value for detection threshold |
numeric
The function download_data downloads the selected data product.
download_data( dataset = "all", path = ".", domain = "raw", timestep = "monthly" )download_data( dataset = "all", path = ".", domain = "raw", timestep = "monthly" )
dataset |
a character string with the name(s) of the desired data set. Suitable options are:
|
path |
a character string with the path where the database will be downloaded. |
domain |
a character string with the desired domain data set. Suitable options are:
|
timestep |
a character string with the desired time resolution. Suitable options are:
|
No return value, called to download the required data sets.
download_data("gldas-vic", tempdir(), timestep = "yearly")download_data("gldas-vic", tempdir(), timestep = "yearly")
Function for calculating the false alarm rate.
far(x, ref, th)far(x, ref, th)
x |
a data.table generated by |
ref |
a data.table with data used for evaluation |
th |
numeric. The value for detection threshold |
numeric
Function for calculating the Nash–Sutcliffe efficiency.
nse(x, ref)nse(x, ref)
x |
a data.table generated by |
ref |
a data.table with data used for evaluation |
numeric
Convenient and aesthetic visualization of data in a boxplot.
plot_box(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'Raster' plot_box(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'data.table' plot_box(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'character' plot_box(x, var = "Precipitation", unit = "mm")plot_box(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'Raster' plot_box(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'data.table' plot_box(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'character' plot_box(x, var = "Precipitation", unit = "mm")
x |
Raster* object; data.table (see details); filename (character, see details) |
var |
character (see details) |
unit |
character (see details) |
If 'x' is a data.table, its columns should be named: "lon", "lat", "date", and "value"
If 'x' is a filename, it should point to a *.nc file.
'var' is a character string describing the variable to be used for the plot title
'unit' is a character string describing the unit of measurement to be used for the plot title
ggplot object
## Not run: download_data("gldas-vic", tempdir(), timestep = "yearly") r <- raster::brick(paste0(tempdir(), "/gldas-vic_tp_mm_land_194801_201412_025_yearly.nc")) s <- plot_box(r) ## End(Not run)## Not run: download_data("gldas-vic", tempdir(), timestep = "yearly") r <- raster::brick(paste0(tempdir(), "/gldas-vic_tp_mm_land_194801_201412_025_yearly.nc")) s <- plot_box(r) ## End(Not run)
Convenient and aesthetic visualization of data in a histogram.
plot_density(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'Raster' plot_density(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'data.table' plot_density(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'character' plot_density(x, var = "Precipitation", unit = "mm")plot_density(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'Raster' plot_density(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'data.table' plot_density(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'character' plot_density(x, var = "Precipitation", unit = "mm")
x |
Raster* object; data.table (see details); filename (character, see details) |
var |
character (see details) |
unit |
character (see details) |
If 'x' is a data.table, its columns should be named: "lon", "lat", "date", and "value"
If 'x' is a filename, it should point to a *.nc file.
'var' is a character string describing the variable to be used for the axis title
'unit' is a character string describing the unit of measurement to be used for the axis title
ggplot object
## Not run: download_data("gldas-vic", tempdir(), timestep = "yearly") r <- raster::brick(paste0(tempdir(), "/gldas-vic_tp_mm_land_194801_201412_025_yearly.nc")) s <- plot_density(r) ## End(Not run)## Not run: download_data("gldas-vic", tempdir(), timestep = "yearly") r <- raster::brick(paste0(tempdir(), "/gldas-vic_tp_mm_land_194801_201412_025_yearly.nc")) s <- plot_density(r) ## End(Not run)
Convenient and aesthetic visualization of data in a heatmap.
plot_heatmap(x, unit = "mm") ## S4 method for signature 'Raster' plot_heatmap(x, unit = "mm") ## S4 method for signature 'data.table' plot_heatmap(x, unit = "mm") ## S4 method for signature 'character' plot_heatmap(x, unit = "mm")plot_heatmap(x, unit = "mm") ## S4 method for signature 'Raster' plot_heatmap(x, unit = "mm") ## S4 method for signature 'data.table' plot_heatmap(x, unit = "mm") ## S4 method for signature 'character' plot_heatmap(x, unit = "mm")
x |
Raster* object; data.table (see details); filename (character, see details) |
unit |
character (see details) |
If 'x' is a data.table, its columns should be named: "lon", "lat", "date", and "value"
If 'x' is a filename, it should point to a *.nc file.
'unit' is a character string describing the unit of measurement to be used for the axis title
ggplot object
## Not run: download_data("gldas-vic", tempdir(), timestep = "yearly") r <- raster::brick(paste0(tempdir(), "/gldas-vic_tp_mm_land_194801_201412_025_yearly.nc")) s <- plot_heatmap(r) ## End(Not run)## Not run: download_data("gldas-vic", tempdir(), timestep = "yearly") r <- raster::brick(paste0(tempdir(), "/gldas-vic_tp_mm_land_194801_201412_025_yearly.nc")) s <- plot_heatmap(r) ## End(Not run)
Convenient and aesthetic visualization of data in a line plot.
plot_line(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'Raster' plot_line(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'data.table' plot_line(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'character' plot_line(x, var = "Precipitation", unit = "mm")plot_line(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'Raster' plot_line(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'data.table' plot_line(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'character' plot_line(x, var = "Precipitation", unit = "mm")
x |
Raster* object; data.table (see details); filename (character, see details) |
var |
character (see details) |
unit |
character (see details) |
If 'x' is a data.table, its columns should be named: "lon", "lat", "date", and "value"
If 'x' is a filename, it should point to a *.nc file.
'var' is a character string describing the variable to be used for the axis title
'unit' is a character string describing the unit of measurement to be used for the axis title
ggplot object
## Not run: download_data("gldas-vic", tempdir(), timestep = "yearly") r <- raster::brick(paste0(tempdir(), "/gldas-vic_tp_mm_land_194801_201412_025_yearly.nc")) s <- plot_line(r) ## End(Not run)## Not run: download_data("gldas-vic", tempdir(), timestep = "yearly") r <- raster::brick(paste0(tempdir(), "/gldas-vic_tp_mm_land_194801_201412_025_yearly.nc")) s <- plot_line(r) ## End(Not run)
Convenient and aesthetic visualization of data in a map
plot_map(x, layer = 1, unit = "mm", timestamp = TRUE) ## S4 method for signature 'Raster' plot_map(x, layer = 1, unit = "mm", timestamp = TRUE) ## S4 method for signature 'data.table' plot_map(x, layer = 0, unit = "mm", timestamp = TRUE) ## S4 method for signature 'character' plot_map(x, layer = 1, unit = "mm", timestamp = TRUE)plot_map(x, layer = 1, unit = "mm", timestamp = TRUE) ## S4 method for signature 'Raster' plot_map(x, layer = 1, unit = "mm", timestamp = TRUE) ## S4 method for signature 'data.table' plot_map(x, layer = 0, unit = "mm", timestamp = TRUE) ## S4 method for signature 'character' plot_map(x, layer = 1, unit = "mm", timestamp = TRUE)
x |
Raster* object; data.table (see details); filename (character, see details) |
layer |
numeric |
unit |
character |
timestamp |
logical |
If 'x' is a data.table, its columns should be named: "lon", "lat", "date", and "value"
If 'x' is a filename, it should point to a *.nc file.
'unit' is a character string describing the unit of measurement to be used for the legend title
'layer' is the layer number to be plotted.
‘timestamp' if TRUE (default) the plot title is the layer’s date
ggplot object
Convenient and aesthetic visualization of data in a summary plot.
plot_summary(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'Raster' plot_summary(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'data.table' plot_summary(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'character' plot_summary(x, var = "Precipitation", unit = "mm")plot_summary(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'Raster' plot_summary(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'data.table' plot_summary(x, var = "Precipitation", unit = "mm") ## S4 method for signature 'character' plot_summary(x, var = "Precipitation", unit = "mm")
x |
Raster* object; data.table (see details); filename (character, see details) |
var |
character (see details) |
unit |
character (see details) |
If 'x' is a data.table, its columns should be named: "lon", "lat", "date", and "value"
If 'x' is a filename, it should point to a *.nc file.
'var' is a character string describing the variable to be used for the axis title
'unit' is a character string describing the unit of measurement to be used for the axis title
ggplot object
## Not run: download_data("gldas-vic", tempdir(), timestep = "yearly") r <- raster::brick(paste0(tempdir(), "/gldas-vic_tp_mm_land_194801_201412_025_yearly.nc")) s <- plot_summary(r) ## End(Not run)## Not run: download_data("gldas-vic", tempdir(), timestep = "yearly") r <- raster::brick(paste0(tempdir(), "/gldas-vic_tp_mm_land_194801_201412_025_yearly.nc")) s <- plot_summary(r) ## End(Not run)
Convenient and aesthetic visualization of data in a Taylor diagram.
plot_taylor(x, y, groups = "default", ...)plot_taylor(x, y, groups = "default", ...)
x |
data.table |
y |
data.table |
groups |
character |
... |
see details |
'x' columns should be named: "lon", "lat", "date", "value", "dataset", and "source".
'y' columns should be named: "lon", "lat", "date", "value", "dataset", and "source".
'groups' character to define panels. Suitable options are:
"default" (only one panel)
"source"
"seasons" (only works properly with monthly data)
'...' extra arguments passed on to openair::TaylorDiagram
plot object
Function for calculating the probability of detection.
pod(x, ref, th)pod(x, ref, th)
x |
a data.table generated by |
ref |
a data.table with data used for evaluation |
th |
numeric. The value for detection threshold |
numeric