if (FALSE) {
destination <- tempfile("copernicus", fileext = ".nc")
## Assuming that Copernicus account details are provided as `options`
copernicus_download_motu(
destination = destination,
product = "GLOBAL_ANALYSISFORECAST_PHY_001_024",
layer = "cmems_mod_glo_phy-cur_anfc_0.083deg_P1D-m",
variable = "sea_water_velocity",
output = "netcdf",
region = c(-1, 50, 10, 55),
timerange = c("2021-01-01", "2021-01-02"),
verticalrange = c(0, 2),
sub_variables = c("uo", "vo")
)
mydata <- stars::read_stars(destination)
plot(mydata["vo"])
}
Run the code above in your browser using DataLab