copernicus_download_motu: Subset and download a specific marine product from Copernicus

View source: R/copernicus_download_motu.r

copernicus_download_motuR Documentation

Subset and download a specific marine product from Copernicus

Description

[Deprecated] The MOTU servers will be discontinued by Copernicus Marine Services. Use cms_download_subset() instead to download subsets.

Usage

copernicus_download_motu(
  username = getOption("CopernicusMarine_uid", ""),
  password = getOption("CopernicusMarine_pwd", ""),
  destination,
  product,
  layer,
  variable,
  output,
  region,
  timerange,
  verticalrange,
  sub_variables,
  overwrite = FALSE
)

Arguments

username

Your Copernicus marine user name. Can be provided as options(CopernicusMarine_uid = "my_user_name"), or as argument here.

password

Your Copernicus marine password. Can be provided as options(CopernicusMarine_pwd = "my_password"), or as argument here.

destination

File or path where the requested file will be downloaded to.

product

An identifier (type character) of the desired Copernicus marine product. Can be obtained with copernicus_products_list.

layer

The name of a desired layer within a product (type character). Can be obtained with copernicus_product_details.

variable

The name of a desired variable in a specific layer of a product (type character). Can be obtained with copernicus_product_details.

output

File type for the output. "netcdf" will work in most cases.

region

Specification of the bounding box as a vector of numerics WGS84 lat and lon coordinates. Should be in the order of: xmin, ymin, xmax, ymax.

timerange

[Experimental] A vector with two elements (lower and upper value) for a requested time range. The vector should be coercible to POSIXct.

verticalrange

[Experimental] A vector with two elements (minimum and maximum) numerical values for the depth of the vertical layers (if any).

sub_variables

A vector of names of requested sub variables.

overwrite

A logical value. When FALSE (default), files at the destination won't be overwritten when the exist. Instead an error will be thrown if this is the case. When set to TRUE, existing files will be overwritten.

Value

Returns a logical value invisibly indicating whether the requested file was successfully stored at the destination.

Author(s)

Pepijn de Vries

Examples

## Not run: 
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"])

## End(Not run)

CopernicusMarine documentation built on July 4, 2024, 9:09 a.m.