Title: | Search Download and Handle Data from Copernicus Marine Service Information |
---|---|
Description: | Subset and download data from EU Copernicus Marine Service Information: <https://data.marine.copernicus.eu>. Import data on the oceans physical and biogeochemical state from Copernicus into R without the need of external software. |
Authors: | Pepijn de Vries [aut, cre, dtc] (0000-0002-7961-6646) |
Maintainer: | Pepijn de Vries <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.2.4 |
Built: | 2024-12-22 19:20:01 UTC |
Source: | https://github.com/pepijn-devries/CopernicusMarine |
Get details for properly citing a Copernicus product.
cms_cite_product(product)
cms_cite_product(product)
product |
An identifier (type |
Returns a vector of character strings. The first element is always the product title, id and doi. Remaining elements are other associated references. Note that the remaining references are returned as listed at Copernicus. Note that the citing formatting does not appear to be standardised.
Pepijn de Vries
Other product-functions:
cms_product_details()
,
cms_product_metadata()
,
cms_product_services()
,
cms_products_list()
cms_cite_product("SST_MED_PHY_SUBSKIN_L4_NRT_010_036")
cms_cite_product("SST_MED_PHY_SUBSKIN_L4_NRT_010_036")
Full marine data sets can be downloaded using the SpatioTemporal Asset Catalogs (STAC). Use these functions to list download locations and get the files.
cms_download_stac( file_tibble, destination, show_progress = TRUE, overwrite = FALSE ) cms_list_stac_files(product, layer) cms_stac_properties(product, layer)
cms_download_stac( file_tibble, destination, show_progress = TRUE, overwrite = FALSE ) cms_list_stac_files(product, layer) cms_stac_properties(product, layer)
file_tibble |
A |
destination |
A |
show_progress |
A |
overwrite |
A |
product |
An identifier (type |
layer |
The name of a desired layer within a product (type |
In case of cms_stac_properties
a dplyr::tibble()
is returned with some
product properties, It is used as precursor for cms_list_stac_files
.
In case of cms_list_stac_files
a dplyr::tibble()
is returned containing
available URLs (for the specified product
and layer
) and some meta information is returned.
In case of cms_download_stac
an invisible logical
value is returned, indicating whether
all requested files are successfully stored at the destination
path. A list
of responses
(of class httr2::response()
) for all requested download links is included as attribute
to the result.
Pepijn de Vries
## Not run: ## List some STAC properties for a specific product and layer cms_stac_properties( product = "GLOBAL_ANALYSISFORECAST_PHY_001_024", layer = "cmems_mod_glo_phy-cur_anfc_0.083deg_P1D-m" ) ## Get the available files for a specific product and layer: file_tibble <- cms_list_stac_files("GLOBAL_ANALYSISFORECAST_PHY_001_024", "cmems_mod_glo_phy-cur_anfc_0.083deg_P1D-m") dest <- tempdir() ## download the first file from the file_tibble to 'dest' cms_download_stac(file_tibble[1,, drop = FALSE], dest) ## End(Not run)
## Not run: ## List some STAC properties for a specific product and layer cms_stac_properties( product = "GLOBAL_ANALYSISFORECAST_PHY_001_024", layer = "cmems_mod_glo_phy-cur_anfc_0.083deg_P1D-m" ) ## Get the available files for a specific product and layer: file_tibble <- cms_list_stac_files("GLOBAL_ANALYSISFORECAST_PHY_001_024", "cmems_mod_glo_phy-cur_anfc_0.083deg_P1D-m") dest <- tempdir() ## download the first file from the file_tibble to 'dest' cms_download_stac(file_tibble[1,, drop = FALSE], dest) ## End(Not run)
Subset and download a specific marine product from Copernicus. You need to register an account at https://data.marine.copernicus.eu before you can use this function.
cms_download_subset( username = getOption("CopernicusMarine_uid", ""), password = getOption("CopernicusMarine_pwd", ""), destination, product, layer, variable, region, timerange, verticalrange, overwrite = FALSE )
cms_download_subset( username = getOption("CopernicusMarine_uid", ""), password = getOption("CopernicusMarine_pwd", ""), destination, product, layer, variable, region, timerange, verticalrange, overwrite = FALSE )
username |
Your Copernicus marine user name. Can be provided as
|
password |
Your Copernicus marine password. Can be provided as
|
destination |
File or path where the requested file will be downloaded to. |
product |
An identifier (type |
layer |
The name of a desired layer within a product (type |
variable |
The name of a desired variable in a specific layer of a product (type |
region |
Specification of the bounding box as a |
timerange |
A |
verticalrange |
A |
overwrite |
A |
Returns a logical
value invisibly indicating whether the requested file was
successfully stored at the destination
.
Pepijn de Vries
## Not run: destination <- tempfile("copernicus", fileext = ".nc") ## Assuming that Copernicus account details are provided as `options` cms_download_subset( destination = destination, product = "GLOBAL_ANALYSISFORECAST_PHY_001_024", layer = "cmems_mod_glo_phy-cur_anfc_0.083deg_P1D-m", variable = "sea_water_velocity", region = c(-1, 50, 10, 55), timerange = c("2021-01-01 UTC", "2021-01-02 UTC"), verticalrange = c(0, -2) ) mydata <- stars::read_stars(destination) plot(mydata["vo"]) ## End(Not run)
## Not run: destination <- tempfile("copernicus", fileext = ".nc") ## Assuming that Copernicus account details are provided as `options` cms_download_subset( destination = destination, product = "GLOBAL_ANALYSISFORECAST_PHY_001_024", layer = "cmems_mod_glo_phy-cur_anfc_0.083deg_P1D-m", variable = "sea_water_velocity", region = c(-1, 50, 10, 55), timerange = c("2021-01-01 UTC", "2021-01-02 UTC"), verticalrange = c(0, -2) ) mydata <- stars::read_stars(destination) plot(mydata["vo"]) ## End(Not run)
Contact Copernicus Marine login page and check if login is successful.
cms_login( username = getOption("CopernicusMarine_uid", ""), password = getOption("CopernicusMarine_pwd", "") )
cms_login( username = getOption("CopernicusMarine_uid", ""), password = getOption("CopernicusMarine_pwd", "") )
username |
Your Copernicus marine user name. Can be provided as
|
password |
Your Copernicus marine password. Can be provided as
|
This function will return a logical value indicating if the login is successful. It can be used to test your account details.
Returns a logical
value indicating if the login is successful.
The response from the login page is returned as an attribute named response
.
Pepijn de Vries
## Not run: ## This will return FALSE if you have not set your account details with 'options'. ## If you have specified your account details and there are no other problems, ## it will return TRUE. cms_login() ## End(Not run)
## Not run: ## This will return FALSE if you have not set your account details with 'options'. ## If you have specified your account details and there are no other problems, ## it will return TRUE. cms_login() ## End(Not run)
Obtain details for a specific Copernicus marine product. This can be narrowed down to specific layers and/or variables within the product.
cms_product_details( product, layer, variable, variant = c("", "detailed-v2", "detailed-v3") )
cms_product_details( product, layer, variable, variant = c("", "detailed-v2", "detailed-v3") )
product |
An identifier (type |
layer |
The name of a desired layer within a product (type |
variable |
The name of a desired variable in a specific layer of a product (type |
variant |
A |
Returns a named list
with properties of the requested product.
Pepijn de Vries
Other product-functions:
cms_cite_product()
,
cms_product_metadata()
,
cms_product_services()
,
cms_products_list()
cms_product_details("GLOBAL_ANALYSISFORECAST_PHY_001_024") cms_product_details( product = "GLOBAL_ANALYSISFORECAST_PHY_001_024", layer = "cmems_mod_glo_phy-thetao_anfc_0.083deg_P1D-m", variable = "thetao" )
cms_product_details("GLOBAL_ANALYSISFORECAST_PHY_001_024") cms_product_details( product = "GLOBAL_ANALYSISFORECAST_PHY_001_024", layer = "cmems_mod_glo_phy-thetao_anfc_0.083deg_P1D-m", variable = "thetao" )
Collect meta information, such as vocabularies used, for specific Copernicus marine products
cms_product_metadata(product, type = c("list", "xml"))
cms_product_metadata(product, type = c("list", "xml"))
product |
An identifier (type |
type |
A |
Returns a named list
(when type = "list"
) with info about the requested product
.
Returns the same info as xml_document
(see xml2::xml_new_document()
) when type = "xml"
.
Returns NULL
when contacting Copernicus fails.
Pepijn de Vries
Other product-functions:
cms_cite_product()
,
cms_product_details()
,
cms_product_services()
,
cms_products_list()
cms_product_metadata("GLOBAL_ANALYSISFORECAST_PHY_001_024")
cms_product_metadata("GLOBAL_ANALYSISFORECAST_PHY_001_024")
Obtain an overview of services provided by Copernicus for a specific marine product.
cms_product_services(product)
cms_product_services(product)
product |
An identifier (type |
Returns a tibble
with a list of available services for a
Copernicus marine product
.
Pepijn de Vries
Other product-functions:
cms_cite_product()
,
cms_product_details()
,
cms_product_metadata()
,
cms_products_list()
cms_product_services("GLOBAL_ANALYSISFORECAST_PHY_001_024")
cms_product_services("GLOBAL_ANALYSISFORECAST_PHY_001_024")
Collect a list of products and some brief descriptions for marine products available from Copernicus
cms_products_list(..., info_type = c("list", "meta"))
cms_products_list(..., info_type = c("list", "meta"))
... |
Allows you to pass (search) query parameters to apply to the list. When omitted, the full list of products is returned. |
info_type |
One of |
Returns a tibble
of products available from https://data.marine.copernicus.eu or
a named list
when info_type = "meta"
. Returns NULL
in case on-line services are
unavailable.
Pepijn de Vries
Other product-functions:
cms_cite_product()
,
cms_product_details()
,
cms_product_metadata()
,
cms_product_services()
cms_products_list() ## Query a specific product: cms_products_list(freeText = "GLOBAL_ANALYSISFORECAST_PHY_001_024")
cms_products_list() ## Query a specific product: cms_products_list(freeText = "GLOBAL_ANALYSISFORECAST_PHY_001_024")
Functions for retrieving Web Map Tile Services information for
specific products, layers and variables and add them to a leaflet
map.
cms_wmts_details(product, layer, variable) addCmsWMTSTiles( map, product, layer, variable, tilematrixset = "EPSG:3857", options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE), ... ) cms_wmts_get_capabilities(product, layer, variable, type = c("list", "xml"))
cms_wmts_details(product, layer, variable) addCmsWMTSTiles( map, product, layer, variable, tilematrixset = "EPSG:3857", options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE), ... ) cms_wmts_get_capabilities(product, layer, variable, type = c("list", "xml"))
product |
An identifier (type |
layer |
The name of a desired layer within a product (type |
variable |
The name of a desired variable in a specific layer of a product (type |
map |
A map widget object created from |
tilematrixset |
A |
options |
Passed on to |
... |
Passed on to |
type |
A |
cms_wmts_details
returns a tibble with detains on the WMTS service.
cms_wmts_getcapabilities
returns either a list
or xml_document
depending on the value
of type
. AddCmsWMTSTiles
returns a leaflet
map
updated with the requested tiles.
Pepijn de Vries
wmts_details <- cms_wmts_details( product = "GLOBAL_ANALYSISFORECAST_PHY_001_024", layer = "cmems_mod_glo_phy-thetao_anfc_0.083deg_P1D-m", variable = "thetao" ) cms_wmts_get_capabilities("GLOBAL_ANALYSISFORECAST_PHY_001_024") if (interactive() && nrow(wmts_details) > 0) { leaflet::leaflet() |> leaflet::setView(lng = 3, lat = 54, zoom = 4) |> leaflet::addProviderTiles("Esri.WorldImagery") |> addCmsWMTSTiles( product = "GLOBAL_ANALYSISFORECAST_PHY_001_024", layer = "cmems_mod_glo_phy-thetao_anfc_0.083deg_P1D-m", variable = "thetao") }
wmts_details <- cms_wmts_details( product = "GLOBAL_ANALYSISFORECAST_PHY_001_024", layer = "cmems_mod_glo_phy-thetao_anfc_0.083deg_P1D-m", variable = "thetao" ) cms_wmts_get_capabilities("GLOBAL_ANALYSISFORECAST_PHY_001_024") if (interactive() && nrow(wmts_details) > 0) { leaflet::leaflet() |> leaflet::setView(lng = 3, lat = 54, zoom = 4) |> leaflet::addProviderTiles("Esri.WorldImagery") |> addCmsWMTSTiles( product = "GLOBAL_ANALYSISFORECAST_PHY_001_024", layer = "cmems_mod_glo_phy-thetao_anfc_0.083deg_P1D-m", variable = "thetao") }