Main function downloading data.
Requires ncdf4 and the NetCDF Library to be installed.
eupp_download_gridded(
x,
output_file,
output_format = "grib",
overwrite = FALSE,
netcdf_kind = 3L,
verbose = FALSE
)
eupp_get_gridded(x, verbose = FALSE)
eupp_get_inventory(x, times = 3L, verbose = FALSE)
object of class eupp_config
.
character length 1, name of the output file.
character length 1, defaults to "grib"
.
Alternatively (somewhat experimental) "nc"
.
logical length 1, defaults to FALSE
. If set to TRUE
the output_file
will be overwritten if needed. If FALSE
and
output_file
exists an error will be raised.
numeric length 1, defaults to 3
. Controls the
-k
(kind) flag when calling grib_to_netcdf
. Only used
when output_format = "nc"
.
logical, sets verbosity level. Defaults to FALSE
.
positive numeric, defaults to 3L
. Number of
retries in case the GET request fails.
No explicit return, invisibly returns the inventory of the file as a
data.frame
.
Object of class c("eupp_stars", "stars")
; see Details.
The function allows to store data sets in either GRIB version 1 or NetCDF (classic 64bit; v3). The original data set is provided as GRIB, the conversion to NetCDF is done locally usning ECMWFs ecCodes tools which must be installed when using NetCDF.
The default mode is to download the data in the GRIB version 1 format. The data
set will be stored as output_file
alongside with an .rds
file containing
the information about the fields (the GRIB index information used for downloading).
Whilst this information can be read from the GRIB file (e.g,. via ecCodes grib_ls
),
however, this allows us to interpolate GRIB files without the need of ecCodes to
be installed (using the .rds
and read_stars
via gdal).
If output_format = "nc"
a request must contain only one date in x
.
The reason is that NetCDF does not allow for overlapping 'time'+'step' specifications.
Somewhat inconvenient but there is no general solution for that in ecCodes (or, to
be precise, the NetCDF standard definition). PLEASE NOTE that this is somewhat
experimental and may not always be the best choice as grib_to_netcdf
will
drop unrequired dimensions, thus losing information (e.g., if only one level or only
one perturbationNumber is present).
This function interfaces eupp_download_gridded
to download the data and converts the original data set (GRIB version 1)
to NetCDF. Thus NetCDF support and ecCodes tools are required and it only
allows data for one specific date in x
. See 'Details' section
in link{eupp_download_gridded}
.
The function read_stars
is used to read the NetCDF
file; note that the NetCDF file will be deleted after reading. The additional
class eupp_stars
is used to provide additional support for processing
the data.
If x
(eupp_config
) contains a bbox
definition
on area
the data is subsetted directly.
eupp_download_gridded
and eupp_stars