View source: R/envir_downANDextract.R
envir_downANDextract | R Documentation |
This function takes a table of coordinates-date and makes a selectively download of data (by now, from Copernicus server). Then it adds the dowloaded values to the original table. The selectively process implies that the environmental data will be downloaded for each date (day) just for a section 'around' the coordinates. How 'around' will depend on the user (by default, it is set in 2 degrees grid).
envir_downANDextract(
pts,
credentials,
datasetID,
datasetVersion = NULL,
service = NULL,
vars,
depth_range = c(5, 10),
dx = 2,
download = FALSE,
outDir = "./",
outSufix = "mercator",
quite = FALSE,
compression = FALSE,
extract_method = "simple"
)
pts |
|
credentials |
A 2-length |
datasetID |
The dataset ID as it is specified in the Copernicus website. |
datasetVersion |
The dataset version as it is specified in the Copernicus website. |
service |
one of the available services using the service name among
|
vars |
|
depth_range |
2-length |
dx |
|
download |
|
outDir |
|
outSufix |
|
quite |
|
compression |
Specify a compression level to apply on the NetCDF output file. A value of 0 means no compression, and 9 is the highest level of compression available. See Details. |
extract_method |
|
pts
needs to have at least three columns called lon
,
lat
and date
. date
values have to be of class Date
or POSIX
, lon
and lat
must be numeric
.
The environmental data will be downloaded always (so it is important to have
a stable internet connection), but the user can decide whether to keep or not
the files (by the use of download
, outDir
and outSufix
arguments. If download=TRUE
, the file names will preserve the ranges
of the downloaded data (date, lon, lat and depth).
If service = NULL
, the function will let copernicusmarine
choose the default value. Usually, it should be arco-time-series
but
it could depend on the version.
The pts
object with extra columns corresponding to the
selected variables.
n <- 20
set.seed(123)
pts1 <- data.frame(lon = runif(n = n, min = 53, max = 98),
lat = runif(n = n, min = -32, max = -2),
date = as.Date("2010-1-1"))
pts2 <- data.frame(lon = runif(n = n, min = 53, max = 98),
lat = runif(n = n, min = -32, max = -2),
date = seq(from = as.Date("2010-1-1"),
to = as.Date("2010-1-1"),
by = "day")[as.integer(runif(n = n, min = 1, max = 10))])
outs <- downloadEnvir(pts = pts,
credentials = list(username = "USERNAME", password = "PASSWORD"),
datasetID = "cmems_mod_glo_phy_my_0.083deg_P1D-m",
service = "arco-time-series",
vars = c("thetao", "zos"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.