EMODnetWCS

Access Marine Data via the EMODnet Web Coverage Service data through R.
https://github.com/EMODnet/emodnet.wcs

Category: Sustainable Development
Sub Category: Data Catalogs and Interfaces

Keywords

biology dataproducts emodnet geospatial marine-data r-package raster-data wcs

Keywords from Contributors

geocoding

Last synced: about 14 hours ago
JSON representation

Repository metadata

Access EMODnet Web Coverage Service data through R

README.Rmd

          ---
output: github_document
---



```{r setup, include=FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# emodnet.wcs



[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) 
[![CRAN status](https://www.r-pkg.org/badges/version/emodnet.wcs)](https://CRAN.R-project.org/package=emodnet.wcs) 
[![R-CMD-check](https://github.com/EMODnet/emodnet.wcs/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/EMODnet/emodnet.wcs/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/EMODnet/emodnet.wcs/graph/badge.svg)](https://app.codecov.io/gh/EMODnet/emodnet.wcs)


The goal of emodnet.wcs is to allow interrogation of and access to EMODnet geographic raster data in R though the [EMODnet Web Coverage Services](https://github.com/EMODnet/Web-Service-Documentation#web-coverage-service-wcs).
EMODnet raster datasets, such as habitat maps or bathymetry, are available through Web Coverage Services (WCS). 
These data are continuous, gridded, and often used for spatial visualization or environmental modeling. 
See below for available Services (data sources).
This package was developed by Sheffield University as part of EMODnet Biology WP4.

[Web Coverage services (WCS)](https://www.ogc.org/standards/wcs) is a standard created by the OGC that refers to the receiving of geospatial information as 'coverages': digital geospatial information representing space-varying phenomena.
One can think of it as Web Feature Service (WFS) for raster data.
It gets the 'source code' of the map, but in this case it's not raw vectors but raw imagery.

An important distinction must be made between WCS and Web Map Service (WMS).
They are similar, and can return similar formats, but a WCS is able to return more information, including valuable metadata and more formats.
It additionally allows more precise queries, potentially against multi-dimensional backend formats.

## Installation

You can install the development version of emodnet.wcs from GitHub with:

```r
# install.packages("pak")
pak::pak("EMODnet/emodnet.wcs")
```

Load the library

```{r load-lib}
library(emodnet.wcs)
```

If you want to avoid reading messages from emodnet.wcs such as "WCS client created successfully", 
set the `"emodnet.wcs.quiet"` option to `TRUE`.

```r
options("emodnet.wcs.quiet" = TRUE)
```

## Available services (data sources)

All available services are contained in the tibble returned by `emdn_wcs()`.

```{r services, echo=FALSE}

knitr::kable(emdn_wcs())
```


To explore available services you can use `View()` or your usual way to explore `data.frames`.

## Connect to a data source: create service client

Create new WCS Client.
Specify the service using the `service` argument.

```{r wcs-init}
wcs <- emdn_init_wcs_client(service = "biology")
```

## Get metadata about a service and available coverages

Get service level and a subset of coverage level metadata, compiled for easy review by supplying a `WCSClient` object to `emdn_get_wcs_info`.

```{r wcs-info}
emdn_get_wcs_info(wcs)
```

Info can also be extracted using a service name instead of a `WCSClient` object.

```{r wcs-info-name}
emdn_get_wcs_info(service = "biology")
```

Get more detailed coverage metadata about specific coverage.

```{r wcs-info-coverage}
emdn_get_coverage_info(
  wcs,
  coverage_ids = "Emodnetbio__aca_spp_19582016_L1"
)
```

> **Note**
> 
> To minimize the number of requests sent to webservices, these functions use [`memoise`](https://memoise.r-lib.org/) to cache results inside the active R session.
> To clear the cache, re-start R or run `memoise::forget(emdn_get_wcs_info)`/`memoise::forget(emdn_get_coverage_info)`

The package also offers a number of functions for extracting individual metadata in more usable forms. e.g.

```{r}
emdn_get_coverage_ids(wcs)
```

For more details, please refer to the [Getting metadata about Services \& Coverages](https://emodnet.github.io/emodnet.wcs/articles/metadata.html) article in the `emodnet.wcs` online documentation.

## Download coverages

The package also provides a function to download full or subsets of coverages from emodnet.wcs services.

The following example downloads a spatial subset of a coverage using a bounding box.

```{r}
wcs <- emdn_init_wcs_client(service = "human_activities")

cov <- emdn_get_coverage(
  wcs,
  # pseudomercator (EPSG 3857) in this case:
  crs = "EPSG:3857",
  bbox = c(
    xmin = 484177.9,
    ymin = 6957617.3,
    xmax = 1035747,
    ymax = 7308616.2
  ),
  coverage_id = "emodnet__vesseldensity_all",
  nil_values_as_na = FALSE
)
```

```{r}
terra::plot(cov)
```

For more details on downloading coverages, please refer to the [Download Coverages](https://emodnet.github.io/emodnet.wcs/articles/coverages.html) article in the `emodnet.wcs` online documentation.

```{r, include=FALSE}
fs::dir_ls(type = "file", glob = "*.tif") |>
  fs::file_delete()
```

## Citation

To cite emodnet.wcs, please use the output from `citation(package = "emodnet.wcs")`.

```{r}
citation(package = "emodnet.wcs")
```


## Unlock the Full Potential of the EMODnet Web Services: Access Feature and Gridded datasets.

### Access EMODnet's Web Feature Service data through emodnet.wfs

The goal of [emodnet.wfs](https://docs.ropensci.org/emodnet.wfs) is to allow interrogation of and access to [EMODnet's, European Marine Observation and Data Network, geographic vector data](https://emodnet.ec.europa.eu/en/emodnet-web-service-documentation#inline-nav-3) in R through the [EMODnet Web Feature Services](https://emodnet.ec.europa.eu/en/data-0). 
[Web Feature services (WFS)](https://www.ogc.org/standards/wfs/) represent a change in the way geographic information is created, modified and exchanged on the Internet and offer direct fine-grained access to geographic information at the feature and feature property level. 
Features are representation of geographic entities, such as a coastlines, marine protected areas, offshore platforms, or fishing areas. In WFS, features have geometry (spatial information) and attributes (descriptive data).
emodnet.wfs aims at offering an user-friendly interface to this rich data.

### Access EMODnet gridded and tabular datasets through the ERDDAP Server and rerddap in R

Both WFS and WCS EMODnet services are based on a federated system: each EMODnet thematic lot manages their servers and data, ensuring that their data are exposed both via WFS and WCS. The twin R packages `emodnet.wfs` and `emodnet.wcs` simplify the access to all the entry points by collecting them in single places, which are the packages themselves. 

In contrast, the [EMODnet ERDDAP Server](https://erddap.emodnet.eu) is centrally managed by the EMODnet Central Portal, offering a single access point to all gridded and tabular datasets. ERDDAP simplifies access to datasets such as digital terrain models, vessel density or environmental data. It is particularly suited for large-scale, multidimensional data analysis. In R, the `rerddap` package allows users to query and subset ERDDAP data programmatically, enabling efficient analysis and integration into workflows. For example, researchers can retrieve datasets on vessel density. 

```{r rerddap}
# install.packages("rerrdap")
library(rerddap)

# This is the url where the EMODnet ERDDAP server is located
erddap_url <- "https://erddap.emodnet.eu/erddap/"

# Inspect all available datasets
ed_datasets(url = erddap_url)

# Find datasets with the key words "vessel density"
ed_search(query = "vessel density", url = erddap_url)

# Inspect more info about the vessel density dataset, using its identifier
human_activities_data_info <- info(
  datasetid = "humanactivities_9f8a_3389_f08a",
  url = erddap_url
)
human_activities_data_info

# Retrieve the vessel density at a particular time period
year_2020_gridded_data <- griddap(
  datasetx = human_activities_data_info,
  time = c("2020-03-18", "2020-03-19")
)
head(year_2020_gridded_data$data)
```

More functionalities are available through `rerddap`. Feel free to explore the [rerddap website](https://docs.ropensci.org/rerddap/) to find out what else can you do with the EMODnet datasets in ERDDAP.


## Code of Conduct

Please note that the emodnet.wcs project is released with a [Contributor Code of Conduct](https://emodnet.github.io/emodnet.wcs/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.



        

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 29 days ago

Total Commits: 256
Total Committers: 2
Avg Commits per committer: 128.0
Development Distribution Score (DDS): 0.258

Commits in past year: 65
Committers in past year: 1
Avg Commits per committer in past year: 65.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Anna Krystalli a****i@g****m 190
Maëlle Salmon m****n@y****e 66

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 57
Total pull requests: 26
Average time to close issues: about 2 months
Average time to close pull requests: about 22 hours
Total issue authors: 5
Total pull request authors: 2
Average comments per issue: 1.02
Average comments per pull request: 0.46
Merged pull request: 25
Bot issues: 5
Bot pull requests: 0

Past year issues: 18
Past year pull requests: 12
Past year average time to close issues: 29 days
Past year average time to close pull requests: 1 day
Past year issue authors: 2
Past year pull request authors: 1
Past year average comments per issue: 1.39
Past year average comments per pull request: 1.0
Past year merged pull request: 11
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/EMODnet/emodnet.wcs

Top Issue Authors

  • annakrystalli (32)
  • maelle (18)
  • github-actions[bot] (5)
  • pnogas67 (1)
  • pepijn-devries (1)

Top Pull Request Authors

  • maelle (13)
  • annakrystalli (13)

Top Issue Labels

  • bug (10)
  • documentation (7)
  • enhancement (5)
  • tests (3)
  • ows4R (1)
  • emodnet-servers (1)

Top Pull Request Labels


Dependencies

DESCRIPTION cran
  • R >= 4.1 depends
  • ows4R >= 0.3 depends
  • checkmate * imports
  • curl * imports
  • glue * imports
  • httr * imports
  • memoise * imports
  • purrr * imports
  • rlang * imports
  • sf * imports
  • tibble * imports
  • usethis * imports
  • covr * suggests
  • httptest * suggests
  • testthat >= 3.0.0 suggests
  • webmockr * suggests
  • withr * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/lint.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgcheck.yaml actions
  • ropensci-review-tools/pkgcheck-action main composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action 4.1.4 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/pr-fetch v1 composite
  • r-lib/actions/pr-push v1 composite
  • r-lib/actions/setup-r v1 composite
  • r-lib/actions/setup-r-dependencies v1 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite

Score: 3.7376696182833684