Extract climate data from a NETCDF file produced and made available by the European Climate Assessment & Dataset for a specific period and available at https://surfobs.climate.copernicus.eu/dataaccess/access_eobs.php
extract_nc_value(
first_year = NULL,
last_year = NULL,
local_file = TRUE,
file_path = NULL,
sml_chunk = NULL,
spatial_extent = NULL,
clim_variable = "mean temp",
statistic = "mean",
grid_size = 0.25,
ecad_v = NULL,
write_raster = FALSE,
out = NULL,
outformat = "GTiff",
return_data = TRUE,
raw_datavals = TRUE,
...
)
a numeric value defining the first year of the time period to extract, 1950 if NULL, default=NULL
a numeric value defining the last year of the time period to extract, 2014 if NULL, default=NULL
logical if the ".nc" data are available on your local disc, if FALSE, the function will download the data from ECAD data portal, default=TRUE
character string with the path to the local ".nc" file. Works only if local_file = TRUE, default=NULL
a character string for specific time period to be downloaded. Chunk available are "2011-2024", "1995-2010", "1980-1994", "1965-1979", and "1950-1964", but check what's available at https://surfobs.climate.copernicus.eu/dataaccess/access_eobs_chunks.php
object to define the spatial extent for the data extraction, can be an "sf", "sp" or "SpatialVector" object or a vector with 4 values defining the bounding box c(xmin, ymax, xmax, ymax). If NULL (default), the entire extent is extracted
a character string defining the daily climate variable to retrieve and extract; "mean temp","max temp","min temp","precipitation", "sea level pressure", "relative humidity", "global radiation", default="mean temp"
a character string defining the metric to retrieve, "mean" or "spread", where the mean is computed across 100 members of the ensemble and is provided as the "best-guess" fields. The spread is calculated as the difference between the 5th and 95th percentiles over the ensemble to provide a measure indicative of the 90% uncertainty range (see details)
numeric, measured in degree defining the resolution of the grid, 0.25 (ca. 27 kilometres in latitude) or 0.1 (ca. 11 kilometres in latitude), default=0.25
ECA&D data version, default = package version.
logical, if TRUE the output will be written in a multilayer raster file
character string with the filename for the output raster, if null data will be written in "climateExtract_raster.tiff".
character string with the format for the output raster, using GDAL shortname. You can use gdal(drivers=TRUE) to see what drivers are available in your installation; default is set to GEOTiff.
logical, if TRUE the data resulting from the extract will be stored in the object, if false, only the filename of the raster and the name of the layers are returned in a list, only if write_out is TRUE.
If TRUE, then the actual raw data values from the file are returned with no conversion to NA (if equal to the missing value/fill value) or scale/offset applied. Default is TRUE. This reduce the size of the object to manipulate.
additional arguments for for writing files, see writeRaster
If 'write_raster' is TRUE, return a list with the path to raster Brick written to the disk and the name of the layers in the object (date). If 'return_data' = TRUE, a list of object is returned, with the variable_name, an 3D array with the value extracted, a vector with the longitude, a vector with latitude and a vector with date extracted.
By default, this function asks to select the ".nc" file from your local disc, but this can be changed by setting the argument 'local_file' to FALSE. When local_file is false, the nc file with data will be downloaded from the ECAD. If first_year and last_year are not provided, the function extract the full data set. Smaller chunks of about 15 years of the most recent version of the E-OBS dataset can be specified for download can be specified directly with the argument "sm_chunk" (period available are 2011-2024, 1995-2010, 1980-1994, 1965-1979, 1950-1964). For more details about the mean and the spread metric see Cornes et al. (2018) and the guidance on how to use ensemble datasets available from http://surfobs.climate.copernicus.eu/userguidance/use_ensembles.php