Get a coverage from an EMODnet WCS Service
Arguments
- wcs
A
WCSClient
R6 object, created with functionemdn_init_wcs_client
.- service
the EMODnet OGC WCS service name. For available services, see
emdn_wcs()
.- coverage_id
character string. Coverage ID.
- service_version
the WCS service version. Defaults to "2.0.1".
- logger
character string. Level of logger: 'NONE' for no logger, 'INFO' to get ows4R logs, 'DEBUG' for all internal logs (such as as Curl details)
- bbox
a named numeric vector of length 4, with names
xmin
,ymin
,xmax
andymax
. specifying the bounding box. (extent) of the raster to be returned.- crs
the CRS of the supplied bounding box. Leave as
NULL
(default) if same as coverage crs.- time
for coverages that include a temporal dimension, a vector of temporal coefficients specifying the time points for which coverage data should be returned. If
NULL
(default), the last time point is returned. To get a list of all available temporal coefficients, seeemdn_get_coverage_dim_coefs
. For a single time point, aSpatRaster
is returned. For more than one time points,SpatRaster
stack is returned.- elevation
for coverages that include a vertical dimension, a vector of vertical coefficients specifying the elevation for which coverage data should be returned. If
NULL
(default), the last elevation is returned. To get a list of all available vertical coefficients, seeemdn_get_coverage_dim_coefs
. For a single elevation, aSpatRaster
is returned. For more than one elevation,SpatRaster
stack is returned.- format
the format of the file the coverage should be written out to.
- rangesubset
character vector of band descriptions to subset.
- filename
the file name to write to.
- nil_values_as_na
logical. Should raster nil values be converted to
NA
?
Value
an object of class terra::SpatRaster
. The function also
writes the coverage to a local file.
Examples
if (FALSE) {
wcs <- emdn_init_wcs_client(service = "biology")
coverage_id <- "Emodnetbio__cal_fin_19582016_L1_err"
# Subset using a bounding box
emdn_get_coverage(wcs,
coverage_id = coverage_id,
bbox = c(
xmin = 0, ymin = 40,
xmax = 5, ymax = 45
)
)
# Subset using a bounding box and specific timepoints
emdn_get_coverage(wcs,
coverage_id = coverage_id,
bbox = c(
xmin = 0, ymin = 40,
xmax = 5, ymax = 45
),
time = c(
"1963-11-16T00:00:00.000Z",
"1964-02-16T00:00:00.000Z"
)
)
# Subset using a bounding box and a specific band
emdn_get_coverage(wcs,
coverage_id = coverage_id,
bbox = c(
xmin = 0, ymin = 40,
xmax = 5, ymax = 45
),
rangesubset = "Relative abundance"
)
}