Skip to content

Commit

Permalink
docs: add instructions to get data from ERDDAP. Fixes (#147) (#152)
Browse files Browse the repository at this point in the history
Co-authored-by: Maëlle Salmon <[email protected]>
  • Loading branch information
salvafern and maelle authored Feb 28, 2024
1 parent 3ef9dbe commit 972cad2
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 8 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Suggests:
testthis,
webmockr,
withr
Config/Needs/readme: rerddap
VignetteBuilder:
knitr
Remotes:
Expand Down
33 changes: 33 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,39 @@ emodnet_get_layers(
)
```

## Other web services

### EMODnet ERDDAP server

The EMODnet data are also published in an [ERDDAP server](https://erddap.emodnet.eu). You can access these data in R using the [rerddap R package](https://docs.ropensci.org/rerddap/):


```{r rerddap}
# install.packages("rerrdap")
library(rerddap)
erddap_url <- "https://erddap.emodnet.eu/erddap/"
rerddap::ed_datasets(url = erddap_url)
rerddap::ed_search(query = "vessel density", url = erddap_url)
human_activities_data_info <- rerddap::info(datasetid = 'humanactivities_9f8a_3389_f08a', url = erddap_url)
out
year_2020_gridded_data <- griddap(datasetx = human_activities_data_info, time = c('2020-03-18', '2020-03-19'))
head(year_2020_gridded_data$data)
```


### EMODnetWCS: Access EMODnet Web Coverage Service data

This package EMODnetWFS uses [Web Feature Services](https://www.ogc.org/standard/wfs/), hence it is limited to getting vector data. EMODnet also hosts raster data that can be accessed via [Web Coverage Services (WCS)](https://www.ogc.org/standard/wcs/). The R package [EMODnetWCS](https://github.com/EMODnet/EMODnetWCS) makes these data available in R.




## Citation

To cite EMODnetWFS, please use the output from `citation(package = "EMODnetWFS")`.
Expand Down
160 changes: 152 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,57 @@ wfs_bio <- emodnet_init_wfs_client(service = "biology")

wfs_bio
#> <WFSClient>
#> ....|-- url: https://geo.vliz.be/geoserver/Emodnetbio/wfs
#> ....|-- version: 2.0.0
#> ....|-- capabilities <WFSCapabilities>
#> Inherits from: <OWSClient>
#> Public:
#> attrs: list
#> capabilities: WFSCapabilities, OWSCapabilities, OGCAbstractObject, R6
#> clone: function (deep = FALSE)
#> defaults: list
#> describeFeatureType: function (typeName)
#> element: AbstractObject
#> encode: function (addNS = TRUE, geometa_validate = TRUE, geometa_inspire = FALSE,
#> ERROR: function (text)
#> getCapabilities: function ()
#> getCASUrl: function ()
#> getClass: function ()
#> getClassName: function ()
#> getConfig: function ()
#> getFeatures: function (typeName, ...)
#> getFeatureTypes: function (pretty = FALSE)
#> getHeaders: function ()
#> getNamespaceDefinition: function (recursive = FALSE)
#> getPwd: function ()
#> getToken: function ()
#> getUrl: function ()
#> getUser: function ()
#> getVersion: function ()
#> INFO: function (text)
#> initialize: function (url, serviceVersion = NULL, user = NULL, pwd = NULL,
#> isFieldInheritedFrom: function (field)
#> logger: function (type, text)
#> loggerType: NULL
#> namespace: OWSNamespace, R6
#> reloadCapabilities: function ()
#> url: https://geo.vliz.be/geoserver/Emodnetbio/wfs
#> verbose.debug: FALSE
#> verbose.info: FALSE
#> version: 2.0.0
#> WARN: function (text)
#> wrap: FALSE
#> Private:
#> cas_url: NULL
#> config: request
#> fromComplexTypes: function (value)
#> headers: EMODnetWFS R package 2.0.1.9001 https://github.com/EMODn ...
#> pwd: NULL
#> serviceName: WFS
#> system_fields: verbose.info verbose.debug loggerType wrap element names ...
#> token: NULL
#> user: NULL
#> xmlElement: AbstractObject
#> xmlExtraNamespaces: NULL
#> xmlNamespacePrefix: OWS
#> xmlNodeToCharacter: function (x, ..., indent = "", tagSeparator = "\n")
```

## Get WFS Layer info
Expand All @@ -106,8 +154,7 @@ emodnet_get_wfs_info(service = "biology")
#> 8 emodnet_wfs biology https://geo.… mediseh_h… EMOD… "Haloph… WFSF… sf
#> 9 emodnet_wfs biology https://geo.… mediseh_m… EMOD… "Maërl … WFSF… sf
#> 10 emodnet_wfs biology https://geo.… mediseh_m… EMOD… "Maërl … WFSF… sf
#> # ℹ 28 more rows
#> # ℹ 1 more variable: layer_namespace <chr>
#> # … with 27 more rows, and 1 more variable: layer_namespace <chr>
```

or you can pass a wfs client object.
Expand All @@ -128,8 +175,7 @@ emodnet_get_wfs_info(wfs_bio)
#> 8 emodnet_wfs biology https://geo.… mediseh_h… EMOD… "Haloph… WFSF… sf
#> 9 emodnet_wfs biology https://geo.… mediseh_m… EMOD… "Maërl … WFSF… sf
#> 10 emodnet_wfs biology https://geo.… mediseh_m… EMOD… "Maërl … WFSF… sf
#> # ℹ 28 more rows
#> # ℹ 1 more variable: layer_namespace <chr>
#> # … with 27 more rows, and 1 more variable: layer_namespace <chr>
```

You can also get info for specific layers from wfs object:
Expand All @@ -144,7 +190,7 @@ emodnet_get_layer_info(wfs = wfs_bio, layers = layers)
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 emodnet_wfs https://geo.vl… biology mediseh_p… EMOD… "Coastl… WFSF… sf
#> 2 emodnet_wfs https://geo.vl… biology mediseh_z… EMOD… "Zoster… WFSF… sf
#> # 1 more variable: layer_namespace <chr>
#> # … with 1 more variable: layer_namespace <chr>
```

Finally, you can get details on all available services and layers from
Expand Down Expand Up @@ -343,6 +389,104 @@ emodnet_get_layers(
#> 10 mediseh_posidonia_nodata.84 0 2.817453 MULTICURVE (LINESTRING (15....
```

## Other web services

### EMODnet ERDDAP server

The EMODnet data are also published in an [ERDDAP
server](https://erddap.emodnet.eu). You can access these data in R using
the [rerddap R package](https://docs.ropensci.org/rerddap/):

``` r
# install.packages("rerrdap")
library(rerddap)
#> Warning: package 'rerddap' was built under R version 4.2.3
#> Registered S3 method overwritten by 'hoardr':
#> method from
#> print.cache_info httr

# Set the URL of the EMODnet ERDDAP server.
url <- "https://erddap.emodnet.eu/erddap/"

# List all datasets
ed_datasets(url = url)
#> # A tibble: 12 × 16
#> griddap Subset tabledap Make.A.Graph wms files Title Summary FGDC
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 "" "https://erdda… https:/… https://erd… "" "" * Th… "This … ""
#> 2 "" "https://erdda… https:/… https://erd… "" "htt… Chin… "Chine… "htt…
#> 3 "" "https://erdda… https:/… https://erd… "" "" Chin… "Chine… "htt…
#> 4 "" "" https:/… https://erd… "" "htt… EMOD… "The d… ""
#> 5 "" "" https:/… https://erd… "" "htt… EMOD… "The d… ""
#> 6 "" "https://erdda… https:/… https://erd… "" "htt… EMOD… "The d… "htt…
#> 7 "" "https://erdda… https:/… https://erd… "" "" INDI… "INDIA… "htt…
#> 8 "" "" https:/… https://erd… "" "htt… Pres… "The p… "htt…
#> 9 "" "" https:/… https://erd… "" "htt… Pres… "The p… "htt…
#> 10 "" "" https:/… https://erd… "" "" PSMS… "Perma… ""
#> 11 "" "" https:/… https://erd… "" "htt… PSMS… "Perma… ""
#> 12 "" "https://erdda… https:/… https://erd… "" "htt… TAO/… "This … "htt…
#> # … with 7 more variables: ISO.19115 <chr>, Info <chr>, Background.Info <chr>,
#> # RSS <chr>, Email <chr>, Institution <chr>, Dataset.ID <chr>

# Search for datasets with "vessel density" in their name
ed_search("vessel density", url = url)
#> # A tibble: 17 × 2
#> title dataset_id
#> <chr> <chr>
#> 1 Vessel Density humanactivities_9f…
#> 2 Vessel Density humanactivities_e9…
#> 3 Vessel traffic density, 2019, All EMODPACE_VD_All
#> 4 Vessel traffic density, 2019, Cargo EMODPACE_VD_09_Car…
#> 5 Vessel traffic density, 2019, Dredging or underwater ops EMODPACE_VD_03_Dre…
#> 6 Vessel traffic density, 2019, Fishing EMODPACE_VD_01_Fis…
#> 7 Vessel traffic density, 2019, High Speed craft EMODPACE_VD_06_High
#> 8 Vessel traffic density, 2019, Miliary and law enforcement EMODPACE_VD_11_Mil…
#> 9 Vessel traffic density, 2019, Other EMODPACE_VD_00_Oth…
#> 10 Vessel traffic density, 2019, Passenger EMODPACE_VD_08_Pas…
#> 11 Vessel traffic density, 2019, Pleasure craft EMODPACE_VD_05_Ple…
#> 12 Vessel traffic density, 2019, Sailing EMODPACE_VD_04_Sai…
#> 13 Vessel traffic density, 2019, Service EMODPACE_VD_02_Ser…
#> 14 Vessel traffic density, 2019, Tanker EMODPACE_VD_10_Tan…
#> 15 Vessel traffic density, 2019, Tug and Towing EMODPACE_VD_07_Tug
#> 16 Vessel traffic density, 2019, Unknown EMODPACE_VD_12_Unk…
#> 17 Test PACE: HA Vessel density emodnet_pace_vesse…

# Get information about a specific dataset.
out <- rerddap::info('humanactivities_9f8a_3389_f08a', url = url)
out
#> <ERDDAP info> humanactivities_9f8a_3389_f08a
#> Base URL: https://erddap.emodnet.eu/erddap
#> Dataset Type: griddap
#> Dimensions (range):
#> time: (2017-01-01T00:00:00Z, 2021-12-01T00:00:00Z)
#> y: (604500.0, 7034500.0)
#> x: (-622500.0, 6884500.0)
#> Variables:
#> vd:
#> Units: seconds

# Request data for a certain time range.
res <- griddap(out, time = c('2020-03-18','2020-03-19'))
#> info() output passed to x; setting base url to: https://erddap.emodnet.eu/erddap
head(res$data)
#> x y time vd
#> 1 -622500 7034500 2020-04-01T00:00:00Z NA
#> 2 -621500 7034500 2020-04-01T00:00:00Z NA
#> 3 -620500 7034500 2020-04-01T00:00:00Z NA
#> 4 -619500 7034500 2020-04-01T00:00:00Z NA
#> 5 -618500 7034500 2020-04-01T00:00:00Z NA
#> 6 -617500 7034500 2020-04-01T00:00:00Z NA
```

### EMODnetWCS: Access EMODnet Web Coverage Service data

This package EMODnetWFS uses [Web Feature
Services](https://www.ogc.org/standard/wfs/), hence it is limited to
getting vector data. EMODnet also hosts raster data that can be accessed
via [Web Coverage Services (WCS)](https://www.ogc.org/standard/wcs/).
The R package [EMODnetWCS](https://github.com/EMODnet/EMODnetWCS) makes
these data available in R.

## Citation

To cite EMODnetWFS, please use the output from
Expand Down

0 comments on commit 972cad2

Please sign in to comment.