ERA5.CDS: R-script that downloads daily data from the Copernicus...

View source: R/ERA5_CDS.R

ERA5.CDSR Documentation

R-script that downloads daily data from the Copernicus Climate Data Store (CDS) using the CDS set-up and python scripts through the API. The files will be stored as netCDF files. This script assumes that CDO and python are installed: https://www.unidata.ucar.edu/software/netcdf/workshops/most-recent/third_party/CDO.html. It only works on Linux platforms... See https://cds.climate.copernicus.eu/api-how-to

Description

R-script that downloads daily data from the Copernicus Climate Data Store (CDS) using the CDS set-up and python scripts through the API. The files will be stored as netCDF files. This script assumes that CDO and python are installed: https://www.unidata.ucar.edu/software/netcdf/workshops/most-recent/third_party/CDO.html. It only works on Linux platforms... See https://cds.climate.copernicus.eu/api-how-to

Usage

ERA5.CDS(
  param = "total_precipitation",
  it = 1979:2018,
  statistic = NULL,
  varnm = NULL,
  lon = c(-180, 180),
  lat = c(-90, 90),
  FNAME = "'ERA5_XXX_YYYY.nc'",
  FUN = "monsum",
  cleanup = TRUE,
  path = "~/Downloads/",
  python = "python3",
  verbose = TRUE
)

Arguments

param

variable name in CDS call, e.g. 'total_precipitation', '2m_temperature', 'mean_sea_level_pressure', '10m_u_component_of_wind', '10m_v_component_of_wind', 'relative_humidity', 'dewpoint_depression', 'snow_depth'

it

the years to extract.

statistic

NULL returns raw (hourly) data, 'daily_mean' returns daysum - not tested!!!

varnm

variable name for local data file.

lon

longitude of the area/region to extract.

lat

latitude of the area/region to extract.

FNAME

the name of the local files for storing the data

FUN

the function for CDO to aggregate the data, eg 'monsum', 'daymean',monmean', 'yearsum', 'yearmax', etc. If NULL, then leave the data as they are (e.g. daily data). If a vector (e.g. FUN=c('daymean','daymin'm',daymas')) it will use CDO repeated times to estimate each statistic.

cleanup

If true, remove the original netCDF-file with hourly data to avoid clogging up the disc.

path

The path where the data are stored. Can be a symbolic link.

python

The version of python to use

verbose

a boolean; if TRUE print information about progress

Examples

## Not run: 
ERA5.CDS(param='2m_temperature',varnm='t2m',it=2015:2018,lon=c(0,10), lat=c(50,60),
         FUN='daymean')
ERA5.CDS(param='total_precipitation',varnm='tp',it=2018,lon=c(50,60),lat=c(0,10),
         FUN='yearsum')
ERA5.CDS(param='mean_sea_level_pressure',varnm='slp',it=2018,lon=c(-50,30),lat=c(40,60),
         FUN='monmean')

## End(Not run)

metno/esd documentation built on April 29, 2024, 3:34 p.m.