Title: Precipitation R Recipes
Version: 3.0.3
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>).
Depends: R (≥ 4.0.0)
Imports: grDevices, methods, stats, utils, data.table, ggplot2, ggpubr, magrittr, openair, raster, scales, twc
License: GPL-3
Encoding: UTF-8
URL: https://github.com/MiRoVaGo/pRecipe
BugReports: https://github.com/MiRoVaGo/pRecipe/issues
SystemRequirements: PROJ (>= 6, https://proj.org/download.html), GDAL (>= 3, https://gdal.org/en/latest/download.html), NetCDF(>= 4, https://www.unidata.ucar.edu/software/netcdf/).
RoxygenNote: 7.3.2
Suggests: cowplot, foreach, kableExtra, knitr, rmarkdown, spelling, testthat (≥ 3.0.0), tibble
Config/testthat/edition: 3
Language: en-US
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2025-04-02 18:06:05 UTC; mirovago
Author: Mijael Rodrigo Vargas Godoy ORCID iD [aut, cre], Yannis Markonis ORCID iD [aut, ths]
Maintainer: Mijael Rodrigo Vargas Godoy <mirovago@gmail.com>
Repository: CRAN
Date/Publication: 2025-04-02 18:40:02 UTC

pRecipe: Precipitation R Recipes

Description

pRecipe is an R package that facilitates the download, exploration, visualization, and analysis of multi-source precipitation data.

Author(s)

Coded by: Mijael Rodrigo Vargas Godoy vargas_godoy@fzp.czu.cz

Conceptual design by: Mijael Rodrigo Vargas Godoy vargas_godoy@fzp.czu.cz and Yannis Markonis markonis@fzp.czu.cz

References

Vargas Godoy, M. R., & Markonis, Y. (2023). pRecipe: A global precipitation climatology toolbox and database. Environmental Modelling & Software, 165, 105711. doi:10.1016/j.envsoft.2023.105711

See Also

Useful links:


Pipe operator

Description

See magrittr::%>% for details.

Usage

lhs %>% rhs

Arguments

lhs

A value or the magrittr placeholder.

rhs

A function call using the magrittr semantics.

Value

The result of calling 'rhs(lhs)'.


Ensure getZ output are dates

Description

Function to fix dates

Usage

aux_date(x)

Arguments

x

output from getZ()

Value

Date


Complement fldmean

Description

Function to add name and type

Usage

aux_info(dummie_name)

Arguments

dummie_name

character

Value

character


Probability of Detection

Description

Function for calculating the critical success index.

Usage

csi(x, ref, th)

Arguments

x

a data.table generated by fldmean

ref

a data.table with data used for evaluation

th

numeric. The value for detection threshold

Value

numeric


Data set name checker

Description

Function to check if the data set is available

Usage

dataset_check(data_name)

Arguments

data_name

a character string.

Value

No return value, called to download the data set.


20CR data downloader

Description

Function for downloading 20CR v3.

Usage

download_20cr(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


All data downloader

Description

Function for downloading GPCP NC file.

Usage

download_all(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


CHIRPS data downloader

Description

Function for downloading CHIRPS.

Usage

download_chirps(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


CMAP data downloader

Description

Function for downloading CMAP standard version.

Usage

download_cmap(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


CMORPH data downloader

Description

Function for downloading CMORPH.

Usage

download_cmorph(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


CPC data downloader

Description

Function for downloading CPC-Global.

Usage

download_cpc(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


CRU_TS data downloader

Description

Function for downloading CRU_TS v4.06.

Usage

download_cru_ts(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


Download various precipitation data products

Description

The function download_data downloads the selected data product.

Usage

download_data(
  dataset = "all",
  path = ".",
  domain = "raw",
  timestep = "monthly"
)

Arguments

dataset

a character string with the name(s) of the desired data set. Suitable options are:

  • "all" for all of the below listed data sets (default),

  • "20cr" for 20CR v3,

  • "chirps" for CHIRPS v2.0,

  • "cmap" for CMAP standard version,

  • "cmorph" for CMORPH,

  • "cpc" for CPC-Global,

  • "cru-ts" for CRU_TS v4.06,

  • "em-earth" for EM-EARTH,

  • "era20c" for ERA-20C,

  • "era5" for ERA5,

  • "fldas" for FLDAS,

  • "ghcn" for GHCN-M v2,

  • "gldas-clsm" for GLDAS CLSM,

  • "gldas-noah" for GLDAS NOAH,

  • "gldas-vic" for GLDAS VIC,

  • "gpcc" for GPCC v2020,

  • "gpcp" for GPCP v2.3,

  • "gpm_imerg" for GPM IMERGM Final v06,

  • "jra55" for JRA-55,

  • "merra2" for MERRA-2,

  • "mswep" for MSWEP v2.8,

  • "ncep-doe" for NCEP/DOE,

  • "ncep-ncar" for NCEP/NCAR,

  • "persiann" for PERSIANN-CDR,

  • "precl" for PREC/L,

  • "terraclimate" for TerraClimate,

  • "trmm-3b43" for TRMM 3B43 v7,

  • "udel" for UDEL v501.

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:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

timestep

a character string with the desired time resolution. Suitable options are:

  • "monthly",

  • "yearly".

Value

No return value, called to download the required data sets.

Examples


download_data("gldas-vic", tempdir(), timestep = "yearly")


EM_EARTH data downloader

Description

Function for downloading EM-EARTH.

Usage

download_em_earth(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


ERA20C data downloader

Description

Function for downloading ERA-20C.

Usage

download_era20c(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


ERA5 data downloader

Description

Function for downloading ERA5.

Usage

download_era5(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


ERA5 data downloader

Description

Function for downloading ERA5.

Usage

download_era5_land(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


FLDAS data downloader

Description

Function for downloading FLDAS.

Usage

download_fldas(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


GHCN data downloader

Description

Function for downloading GHCN v2.

Usage

download_ghcn(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


GLDAS_CLSM data downloader

Description

Function for downloading GLDAS CLSM.

Usage

download_gldas_clsm(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


GLDAS_NOAH data downloader

Description

Function for downloading GLDAS NOAH.

Usage

download_gldas_noah(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


GLDAS_VIC data downloader

Description

Function for downloading GLDAS VIC.

Usage

download_gldas_vic(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


GPCC data downloader

Description

Function for downloading GPCC v2020.

Usage

download_gpcc(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


GPCP data downloader

Description

Function for downloading GPCP v2.3.

Usage

download_gpcp(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


GPM_IMERG data downloader

Description

Function for downloading GPM IMERGM v06.

Usage

download_gpm_imerg(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


GPM_IMERG data downloader

Description

Function for downloading GPM IMERGM v06.

Usage

download_gsmap(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


JRA-55 data downloader

Description

Function for downloading JRA-55.

Usage

download_jra55(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


MERRA-2 data downloader

Description

Function for downloading MERRA-2.

Usage

download_merra2(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


MSWEP data downloader

Description

Function for downloading MSWEP v2.8.

Usage

download_mswep(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


NCEP_DOE data downloader

Description

Function for downloading NCEP/DOE.

Usage

download_ncep_doe(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


NCEP_NCAR data downloader

Description

Function for downloading NCEP/NCAR.

Usage

download_ncep_ncar(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


PERSIANN data downloader

Description

Function for downloading PERSIANN-CDR.

Usage

download_persiann(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "daily",

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


PRECL data downloader

Description

Function for downloading PREC/L.

Usage

download_precl(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


TERRACLIMATE data downloader

Description

Function for downloading TerraClimate.

Usage

download_terraclimate(folder_path = ".", domain = "raw", time_res = "monthly")

Arguments

folder_path

a character string with the path where the data will be downloaded.

domain

a character string with the desired domain data set. Suitable options are:

  • "raw" for default available spatial coverage,

  • "global" for data sets with global (land and ocean) coverage,

  • "land" for data sets with land only coverage,

  • "ocean", for data sets with ocean only coverage.

time_res

a character string with the desired time resolution. Suitable options are:

  • "monthly",

  • "yearly".

Value

No return value, called to download the data set.


False Alarm Rate

Description

Function for calculating the false alarm rate.

Usage

far(x, ref, th)

Arguments

x

a data.table generated by fldmean

ref

a data.table with data used for evaluation

th

numeric. The value for detection threshold

Value

numeric


Nash–Sutcliffe Efficiency

Description

Function for calculating the Nash–Sutcliffe efficiency.

Usage

nse(x, ref)

Arguments

x

a data.table generated by fldmean

ref

a data.table with data used for evaluation

Value

numeric


Boxplot ggplot

Description

Convenient and aesthetic visualization of data in a boxplot.

Usage

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")

Arguments

x

Raster* object; data.table (see details); filename (character, see details)

var

character (see details)

unit

character (see details)

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

Value

ggplot object

Examples

## 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)

Histogram ggplot

Description

Convenient and aesthetic visualization of data in a histogram.

Usage

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")

Arguments

x

Raster* object; data.table (see details); filename (character, see details)

var

character (see details)

unit

character (see details)

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

Value

ggplot object

Examples

## 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)

Heatmap ggplot

Description

Convenient and aesthetic visualization of data in a heatmap.

Usage

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")

Arguments

x

Raster* object; data.table (see details); filename (character, see details)

unit

character (see details)

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

Value

ggplot object

Examples

## 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)

Line ggplot

Description

Convenient and aesthetic visualization of data in a line plot.

Usage

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")

Arguments

x

Raster* object; data.table (see details); filename (character, see details)

var

character (see details)

unit

character (see details)

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

Value

ggplot object

Examples

## 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)

Map ggplot

Description

Convenient and aesthetic visualization of data in a map

Usage

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)

Arguments

x

Raster* object; data.table (see details); filename (character, see details)

layer

numeric

unit

character

timestamp

logical

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 legend title

'layer' is the layer number to be plotted.

‘timestamp' if TRUE (default) the plot title is the layer’s date

Value

ggplot object


Summary ggplot

Description

Convenient and aesthetic visualization of data in a summary plot.

Usage

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")

Arguments

x

Raster* object; data.table (see details); filename (character, see details)

var

character (see details)

unit

character (see details)

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

Value

ggplot object

Examples

## 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)

Taylor diagram

Description

Convenient and aesthetic visualization of data in a Taylor diagram.

Usage

plot_taylor(x, y, groups = "default", ...)

Arguments

x

data.table

y

data.table

groups

character

...

see details

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:

'...' extra arguments passed on to openair::TaylorDiagram

Value

plot object


Probability Of Detection

Description

Function for calculating the probability of detection.

Usage

pod(x, ref, th)

Arguments

x

a data.table generated by fldmean

ref

a data.table with data used for evaluation

th

numeric. The value for detection threshold

Value

numeric


Objects exported from other packages

Description

These objects are imported from other packages. Follow the links below to see their documentation.

twc

crop_data, fldmean, infoNC, muldpm, pRecipe_masks, remap, saveNC, subset_data, tabular, trend, yearstat


Select Longitude Latitude Box

Description

The function sellonlatbox subsets the data in space within a bounding box.

Usage

sellonlatbox(x, y)

## S4 method for signature 'Raster'
sellonlatbox(x, y)

## S4 method for signature 'data.table'
sellonlatbox(x, y)

## S4 method for signature 'character'
sellonlatbox(x, y)

Arguments

x

Raster* object; data.table (see details); filename (character, see details)

y

numeric. Bounding box in the form: (xmin, xmax, ymin, ymax)

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.

Value

Raster* object; data.table

Examples

## 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 <- sellonlatbox(r, c(12.24, 18.85, 48.56, 51.12))

## End(Not run)

Select Years

Description

The function selyear subsets the data in time within a year range.

Usage

selyear(x, y)

## S4 method for signature 'Raster'
selyear(x, y)

## S4 method for signature 'data.table'
selyear(x, y)

## S4 method for signature 'character'
selyear(x, y)

Arguments

x

Raster* object; data.table (see details); filename (character, see details)

y

numeric. Time range in the form: (start_year, end_year)

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.

Value

Raster* object; data.table

Examples

## 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 <- selyear(r, c(2000, 2010))

## End(Not run)