-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
151 lines (98 loc) · 5 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# EMODnetWCS
<!-- badges: start -->
[![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/EMODnetWCS)](https://CRAN.R-project.org/package=EMODnetWCS)
[![R-CMD-check](https://github.com/EMODnet/EMODnetWCS/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/EMODnet/EMODnetWCS/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/EMODnet/EMODnetWCS/branch/main/graph/badge.svg)](https://app.codecov.io/gh/EMODnet/EMODnetWCS?branch=master)
<!-- badges: end -->
The goal of EMODnetWCS 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). See below for available Services. 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 EMODnetWCS from GitHub with:
``` r
# install.packages("remotes")
remotes::install_github("EMODnet/EMODnetWCS")
```
Load the library
```{r load-lib}
library(EMODnetWCS)
```
## Available services
All available services are contained in the tibble returned by `emdn_wcs()`.
```{r services, echo=FALSE}
knitr::kable(emdn_wcs())
```
To explore available services in Rstudio use:
```r
View(emdn_wcs())
```
## 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 WCS 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__cal_fin_19582016_L1_err")
```
> **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/EMODnetWCS/articles/metadata.html) article in the `EMODnetWCS` online documentation.
## Downloading Coverages
The package also provides a function to download full or subsets of coverages from EMODnetWCS services.
The following example downloads a spatial subset of a coverage using a bounding box.
```{r}
cov <- emdn_get_coverage(wcs,
coverage_id = "Emodnetbio__cal_fin_19582016_L1_err",
bbox = c(xmin = 0,
ymin = 40,
xmax = 5,
ymax = 45),
nil_values_as_na = TRUE
)
cov
```
```{r}
terra::plot(cov)
```
For more details on downloading coverages, please refer to the [Download Coverages](https://emodnet.github.io/EMODnetWCS/articles/coverages.html) article in the `EMODnetWCS` online documentation.
```{r, include=FALSE}
fs::dir_ls(type = "file", glob = "*.tif") %>%
fs::file_delete()
```
## Citation
To cite EMODnetWCS, please use the output from `citation(package = "EMODnetWCS")`.
```{r}
citation(package = "EMODnetWCS")
```
## Code of Conduct
Please note that the EMODnetWCS project is released with a [Contributor Code of Conduct](https://emodnet.github.io/EMODnetWCS/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.