{"id":13948696,"url":"https://github.com/pepijn-devries/CopernicusMarine","last_synced_at":"2025-07-20T10:32:31.933Z","repository":{"id":65255225,"uuid":"589076156","full_name":"pepijn-devries/CopernicusMarine","owner":"pepijn-devries","description":"Subset and download marine data from EU Copernicus     Marine Service Information. Import data on the oceans     physical and biogeochemical state from Copernicus into R     without the need of external software.","archived":false,"fork":false,"pushed_at":"2025-07-13T22:16:09.000Z","size":16002,"stargazers_count":29,"open_issues_count":9,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-14T05:43:44.596Z","etag":null,"topics":["data","spatial"],"latest_commit_sha":null,"homepage":"https://pepijn-devries.github.io/CopernicusMarine/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pepijn-devries.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-01-15T00:57:40.000Z","updated_at":"2025-07-13T22:13:35.000Z","dependencies_parsed_at":"2024-01-29T23:30:07.519Z","dependency_job_id":"2ce453a0-95e0-41cc-8b4c-3cea884891c5","html_url":"https://github.com/pepijn-devries/CopernicusMarine","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":0.06896551724137934,"last_synced_commit":"51a669afa378c262d88b1ba5474ae935a5ec3044"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/pepijn-devries/CopernicusMarine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pepijn-devries%2FCopernicusMarine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pepijn-devries%2FCopernicusMarine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pepijn-devries%2FCopernicusMarine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pepijn-devries%2FCopernicusMarine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pepijn-devries","download_url":"https://codeload.github.com/pepijn-devries/CopernicusMarine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pepijn-devries%2FCopernicusMarine/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265409023,"owners_count":23760216,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data","spatial"],"created_at":"2024-08-08T05:01:28.120Z","updated_at":"2025-07-20T10:32:31.924Z","avatar_url":"https://github.com/pepijn-devries.png","language":"R","funding_links":[],"categories":["Hydrosphere","Geospatial and Earth Observation"],"sub_categories":["Ocean and Hydrology Data Access"],"readme":"---\noutput: github_document\n---\n\n```{r, echo = FALSE, message = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\"\n)\nlibrary(CopernicusMarine)\n```\n\n# CopernicusMarine \u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"139\" copyright=\"cc-sa\" alt=\"logo\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/pepijn-devries/CopernicusMarine/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/pepijn-devries/CopernicusMarine/actions/workflows/R-CMD-check.yaml)\n![cranlogs](https://cranlogs.r-pkg.org/badges/CopernicusMarine)\n[![version](https://www.r-pkg.org/badges/version/CopernicusMarine)](https://CRAN.R-project.org/package=CopernicusMarine)\n[![cran checks](https://badges.cranchecks.info/worst/CopernicusMarine.svg)](https://cran.r-project.org/web/checks/check_results_CopernicusMarine.html)\n[![CopernicusMarine status badge](https://pepijn-devries.r-universe.dev/badges/CopernicusMarine)](https://pepijn-devries.r-universe.dev/CopernicusMarine)\n\u003c!-- badges: end --\u003e\n\n## Overview\n\n[Copernicus Marine Service Information](https://marine.copernicus.eu/about) is a programme subsidised by the\nEuropean Commission. Its mission is to provide free authoritative information on the oceans physical and\nbiogeochemical state. The `CopernicusMarine` R package is developed apart from this programme and facilitates\nretrieval of information from \u003chttps://data.marine.copernicus.eu\u003e. With the package you can:\n\n * List available marine data for Copernicus and provide meta-information.\n * Download and use the data directly in R.\n\n## Why use `CopernicusMarine`\n\nCopernicus Marine offers access to their data services through a\n[Python application interface](https://pypi.org/project/copernicusmarine/).\nFor R users this requires complex installation procedures and is difficult to maintain in\na stable R package. The `CopernicusMarine` R package has\na much simpler installation procedure (see below) and does not depend on\nthird party software, other than packages available from [CRAN](https://cran.r-project.org/).\n\n## Installation\n\n\u003e Get CRAN version\n```{r eval=FALSE}\ninstall.packages(\"CopernicusMarine\")\n```\n\u003e Get development version on github\n```{r eval=FALSE}\ndevtools::install_github('pepijn-devries/CopernicusMarine')\n```\n\n## Usage\n\nThe package provides an interface between R and the Copernicus Marine services. Note that for some of these\nservices you need an account and have to comply with\n[specific terms](https://marine.copernicus.eu/user-corner/service-commitments-and-licence). The usage section\nbriefly shows three different ways of obtaining data from Copernicus:\n\n * [Downloading a subset](#sec-subset)\n * [Downloading a full dataset](#sec-full)\n * [Using the WMTS server](#sec-wtms)\n\nPlease check the manual for complete documentation of the package.\n\n\u003ch3 id=\"sec-subset\"\u003eDownloading a subset\u003c/h3\u003e\n\nUnfortunately, downloading subsets is not operational in R due to some\n[technical issues](https://github.com/pepijn-devries/CopernicusMarine/issues/42).\nIt seems that it might take some time to get this fixed. In the meantime,\nyou could have a look at this\n[work-around](https://github.com/pepijn-devries/CopernicusMarine/issues/42#issuecomment-2079745370).\n\n\u003c!-- The code below assumes that you have registered your account details using `options(CopernicusMarine_uid = \"my_user_name\")` and --\u003e\n\u003c!-- `options(CopernicusMarine_pwd = \"my_password\")`. If you are comfortable that it is secure enough, you can also store these --\u003e\n\u003c!-- options in your `.Rprofile` such that they will be loaded each session. Otherwise, you can also provide your account details --\u003e\n\u003c!-- as arguments to the functions. --\u003e\n\n\u003c!-- The example below demonstrates how to subset a specific layer for a specific product. The subset is constrained by --\u003e\n\u003c!-- the `region`, `timerange` and `verticalrange` arguments. The subset is downloaded to the temporary --\u003e\n\u003c!-- file specified with `destination` and can be read using the [`{stars}`](https://r-spatial.github.io/stars/) package. --\u003e\n\n\u003c!-- ```{r download-subset, eval=TRUE} --\u003e\n\u003c!-- destination \u003c- tempfile(\"copernicus\", fileext = \".nc\") --\u003e\n\n\u003c!-- cms_download_subset( --\u003e\n\u003c!--   destination   = destination, --\u003e\n\u003c!--   product       = \"GLOBAL_ANALYSISFORECAST_PHY_001_024\", --\u003e\n\u003c!--   layer         = \"cmems_mod_glo_phy-cur_anfc_0.083deg_P1D-m\", --\u003e\n\u003c!--   variable      = \"sea_water_velocity\", --\u003e\n\u003c!--   region        = c(-1, 50, 10, 55), --\u003e\n\u003c!--   timerange     = c(\"2021-01-01\", \"2021-01-02\"), --\u003e\n\u003c!--   verticalrange = c(0, -2) --\u003e\n\u003c!-- ) --\u003e\n\n\u003c!-- mydata \u003c- stars::read_stars(destination) --\u003e\n\n\u003c!-- plot(mydata[\"vo\"], col = hcl.colors(100), axes = TRUE) --\u003e\n\u003c!-- ``` --\u003e\n\n\u003ch3 id=\"sec-full\"\u003eDownloading a complete Copernicus marine product\u003c/h3\u003e\n\nIf you don't want to subset the data and want the complete set, you can download\ncomplete native files, if these are available for your product.\nYou can list available files with:\n\n```{r, eval=TRUE}\nnative_files \u003c-\n  cms_list_native_files(\n    \"GLOBAL_ANALYSISFORECAST_PHY_001_024\",\n    \"cmems_mod_glo_phy-cur_anfc_0.083deg_P1D-m\")\nnative_files\n```\n\nDownloading the first file can be done with:\n```{r, eval=FALSE}\ncms_download_native(\n  destination   = tempdir(),\n  product       = \"GLOBAL_ANALYSISFORECAST_PHY_001_024\",\n  layer         = \"cmems_mod_glo_phy_anfc_0.083deg_PT1H-m\",\n  pattern       = \"m_20220630\"\n)\n```\nThe file would be stored in the specified destination folder.\nBy default the progress is printed as files can be very large and may take some time to download.\n\n\u003ch3 id=\"sec-wmts\"\u003eCopernicus Web Map Tile Services (WMTS)\u003c/h3\u003e\n\nWeb Map Tile Services (WMTS) allow to quickly plot pre-rendered images onto a map. This may not be useful when\nyou need the data for analyses but is handy for quick visualisations, inspection or presentation of data.\nIn R it is very easy to add WMTS layers to an interactive map using [leaflet](https://rstudio.github.io/leaflet/)\nstatically and is not interactive).\n\n```{r leaflet, eval=TRUE, message=FALSE, warning=FALSE}\nleaflet::leaflet() |\u003e\n  leaflet::setView(lng = 3, lat = 54, zoom = 4) |\u003e\n  leaflet::addProviderTiles(\"Esri.WorldImagery\") |\u003e\n  addCmsWMTSTiles(\n    product     = \"GLOBAL_ANALYSISFORECAST_PHY_001_024\",\n    layer       = \"cmems_mod_glo_phy-thetao_anfc_0.083deg_P1D-m\",\n    variable    = \"thetao\"\n  )\n```\n\n### Citing the data you use\n\nA Copernicus account comes with several terms of use. One of these is that you\n[properly cite](https://help.marine.copernicus.eu/en/articles/4444611-how-to-cite-copernicus-marine-products-and-services)\nthe data you use in publications. In fact, we also have credit the data used in this documentation, which can be easily\ndone with the following code:\n\n```{r, eval=TRUE}\ncms_cite_product(\"GLOBAL_ANALYSISFORECAST_PHY_001_024\")$doi\n```\n\n## Resources\n\n```{r, eval=TRUE, echo=FALSE}\ncop_det \u003c- cms_product_details(\"GLOBAL_ANALYSISFORECAST_PHY_001_024\")\n```\n\n * [E.U. Copernicus Marine Service Information](https://data.marine.copernicus.eu)\n * `r sprintf(\"[%s - %s (%s); DOI:%s](https://doi.org/%s)\", cop_det$title, cop_det$id, cop_det$properties$creationDate, cop_det[[\"sci:doi\"]], cop_det[[\"sci:doi\"]])`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpepijn-devries%2FCopernicusMarine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpepijn-devries%2FCopernicusMarine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpepijn-devries%2FCopernicusMarine/lists"}