Learn R Programming

CopernicusMarine Easily access information from https://data.marine.copernicus.eu

Overview

Copernicus Marine Service Information is a programme subsidised by the European Commission. Its mission is to provide free authoritative information on the oceans physical and biogeochemical state. The CopernicusMarine R package is developed apart from this programme and facilitates retrieval of information from https://data.marine.copernicus.eu. With the package you can:

  • List available marine data for Copernicus and provide meta-information.
  • Download and use the data directly in R.

Why use CopernicusMarine

Copernicus Marine offers access to their data services through a Python application interface. For R users this requires complex installation procedures and is difficult to maintain in a stable R package. The CopernicusMarine R package has a much simpler installation procedure (see below) and does not depend on third party software, other than packages available from CRAN.

Installation

Get CRAN version

install.packages("CopernicusMarine")

Get development version on github

devtools::install_github('pepijn-devries/CopernicusMarine')

Usage

The package provides an interface between R and the Copernicus Marine services. Note that for some of these services you need an account and have to comply with specific terms. The usage section briefly shows three different ways of obtaining data from Copernicus:

Please check the manual for complete documentation of the package.

Unfortunately, downloading subsets is not operational in R due to some technical issues. It seems that it might take some time to get this fixed. In the meantime, you could have a look at this work-around.

If you don’t want to subset the data and want the complete set, you can use the SpatioTemporal Asset Catalogs (STAC), if these are available for your product. First you can list STAC files available for a specific product (and layer):

stac_files <-
  cms_list_stac_files(
    "GLOBAL_ANALYSISFORECAST_PHY_001_024",
    "cmems_mod_glo_phy-cur_anfc_0.083deg_P1D-m")
stac_files
#> # A tibble: 946 × 8
#>    home          native current_path LastModified ETag  Size  StorageClass Type 
#>    <chr>         <chr>  <chr>        <chr>        <chr> <chr> <chr>        <chr>
#>  1 s3.waw3-1.cl… mdl-n… native/GLOB… 2024-04-18T… "\"4… 1939… STANDARD     Norm…
#>  2 s3.waw3-1.cl… mdl-n… native/GLOB… 2024-04-18T… "\"9… 1939… STANDARD     Norm…
#>  3 s3.waw3-1.cl… mdl-n… native/GLOB… 2024-04-18T… "\"9… 1939… STANDARD     Norm…
#>  4 s3.waw3-1.cl… mdl-n… native/GLOB… 2024-04-18T… "\"c… 1939… STANDARD     Norm…
#>  5 s3.waw3-1.cl… mdl-n… native/GLOB… 2024-04-18T… "\"2… 1938… STANDARD     Norm…
#>  6 s3.waw3-1.cl… mdl-n… native/GLOB… 2024-04-18T… "\"0… 1938… STANDARD     Norm…
#>  7 s3.waw3-1.cl… mdl-n… native/GLOB… 2024-04-18T… "\"5… 1939… STANDARD     Norm…
#>  8 s3.waw3-1.cl… mdl-n… native/GLOB… 2024-04-18T… "\"5… 1939… STANDARD     Norm…
#>  9 s3.waw3-1.cl… mdl-n… native/GLOB… 2024-04-18T… "\"9… 1939… STANDARD     Norm…
#> 10 s3.waw3-1.cl… mdl-n… native/GLOB… 2024-04-18T… "\"1… 1939… STANDARD     Norm…
#> # ℹ 936 more rows

Downloading the first file can be done with cms_download_stac(stac_files[1,,drop = FALSE], tempdir()), where the file would be stored in a temporary directory. By default the progress is printed as files can be very large and may take some time to download.

Web Map Tile Services (WMTS) allow to quickly plot pre-rendered images onto a map. This may not be useful when you need the data for analyses but is handy for quick visualisations, inspection or presentation of data. In R it is very easy to add WMTS layers to an interactive map using leaflet widgets. This is demonstrated with the example below (note that in the documentation the map is only shown statically and is not interactive).

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"
  )

Citing the data you use

A Copernicus account comes with several terms of use. One of these is that you properly cite the data you use in publications. In fact, we also have credit the data used in this documentation, which can be easily done with the following code:

cms_cite_product("GLOBAL_ANALYSISFORECAST_PHY_001_024")
#>                                                                                                                                                                 doi 
#> "E.U. Copernicus Marine Service Information; Global Ocean Physics Analysis and Forecast - GLOBAL_ANALYSISFORECAST_PHY_001_024 (2016-10-14). DOI:10.48670/moi-00016"

Resources

Copy Link

Version

Install

install.packages('CopernicusMarine')

Monthly Downloads

556

Version

0.2.5

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Pepijn de Vries

Last Published

April 5th, 2025

Functions in CopernicusMarine (0.2.5)

cms_products_list

List products available from data.marine.copernicus.eu
cms_product_services

Obtain available services for a specific Copernicus marine product
cms_download_stac

List and get STAC files for a Copernicus marine product
CopernicusMarine-package

CopernicusMarine: Search Download and Handle Data from Copernicus Marine Service Information
cms_download_subset

Subset and download a specific marine product from Copernicus
cms_wmts_details

Obtain a WMTS entry for specific Copernicus marine products and add to a leaflet map
cms_product_details

Obtain details for a specific Copernicus marine product
cms_product_metadata

Obtain meta data for a specific Copernicus marine product
cms_cite_product

How to cite a Copernicus marine product
cms_login

Contact Copernicus Marine login page