mapme.biodiversity
Efficient analysis of spatial biodiversity datasets for global portfolios
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.6%) to scientific vocabulary
Keywords
environment
eo
gis
mapme
spatial
sustainability
Last synced: 6 months ago
·
JSON representation
Repository
Efficient analysis of spatial biodiversity datasets for global portfolios
Basic Info
- Host: GitHub
- Owner: mapme-initiative
- License: gpl-3.0
- Language: R
- Default Branch: main
- Homepage: https://mapme-initiative.github.io/mapme.biodiversity
- Size: 44.9 MB
Statistics
- Stars: 41
- Watchers: 2
- Forks: 11
- Open Issues: 29
- Releases: 17
Topics
environment
eo
gis
mapme
spatial
sustainability
Created about 4 years ago
· Last pushed 6 months ago
Metadata Files
Readme
Changelog
License
README.Rmd
--- output: github_document --- [](https://github.com/mapme-initiative/mapme.biodiversity/actions) [](https://app.codecov.io/github/mapme-initiative/mapme.biodiversity?branch=main) [](https://cran.r-project.org/web/checks/check_results_mapme.biodiversity.html) [](https://CRAN.R-project.org/package=mapme.biodiversity) [-brightgreen.svg?style=flat)](https://choosealicense.com/licenses/gpl-3.0/) # mapme.biodiversity## About Biodiversity areas, especially primary forests, provide multiple ecosystem services for the local population and the planet as a whole. The rapid expansion of human land use into natural ecosystems and the impacts of the global climate crisis put natural ecosystems and the global biodiversity under threat. The mapme.biodiversity package helps to analyse a number of biodiversity related indicators and biodiversity threats based on freely available geodata-sources such as the Global Forest Watch. It supports computational efficient routines and heavy parallel computing in cloud-infrastructures such as AWS or Microsoft Azure using in the statistical programming language R. The package allows for the analysis of global biodiversity portfolios with a thousand or millions of AOIs which is normally only possible on dedicated platforms such as the Google Earth Engine. It provides the possibility to e.g. analyse the World Database of Protected Areas (WDPA) for a number of relevant indicators. The primary use case of this package is to support scientific analysis and data science for individuals and organizations who seek to preserve the planet biodiversity. Its development is funded by the German Development Bank KfW. ## Installation ### Stable version The package and its dependencies can be installed from CRAN via: ```{r install-cran, eval = FALSE} install.packages("mapme.biodiversity", dependencies = TRUE) ``` Windows and macOS binary packages are available from here. ### Development version To install the development version, use the following command: ```{r install-devel, eval = FALSE} if (isFALSE(require("remotes", quietly = TRUE))) install.packages("remotes", dependencies = TRUE) remotes::install_github("https://github.com/mapme-initiative/mapme.biodiversity", dependencies = TRUE) ``` ## Available resources and indicators Below is a list of the resources currently supported by `mapme.biodiversity`. ```{r available_resources, echo = FALSE} knitr::kable(mapme.biodiversity::available_resources()[, c("name", "description", "licence")]) ``` Next, is a list of supported indicators. ```{r available_indicators, echo = FALSE} knitr::kable(mapme.biodiversity::available_indicators()[, c("name", "description")]) ``` ## Usage example `{mapme.biodiversity}` works by constructing a portfolio from an sf object. Specific raster and vector resource matching the spatio-temporal extent of the portfolio are made available locally. Once all required resources are available, indicators can be calculated individually for each asset in the portfolio. ```{r resources} library(mapme.biodiversity) library(sf) ``` Once you have decided on an indicator you are interested in, you can start by making the required resource available for your portfolio. Using `mapme_options()` you can set an output directory, control the maximum size of polygons before they are chunked into smaller parts, and control the verbosity of the package. A portfolio is represented by an sf-object. It is required for the object to only contain geometries of type `POLYGON` and `MULTIPOLYGON` as assets. We can request the download of a resource for the spatial extent of our portfolio by using the `get_resources()` function. We simply supply our portfolio and one or more resource functions. Once the resources were made available, we can query the calculation of an indicator by using the `calc_indicators()` function. This function also expects the portfolio as input and one or more indicator functions. Once the indicator has been calculated for all assets in a portfolio, the data is returned as a nested list column to the original portfolio object. The output of each indicator is standardized to common format, consisting of a tibble with columns `datetime`, `variable`, `unit`, and `value`. We can transform the the data to long format by using `portfolio_long()`. ```{r calculation} mapme_options( outdir = system.file("res", package = "mapme.biodiversity"), chunk_size = 1e6, # in ha verbose = FALSE ) aoi <- system.file("extdata", "sierra_de_neiba_478140_2.gpkg", package = "mapme.biodiversity") %>% sf::read_sf() %>% get_resources( get_gfw_treecover(version = "GFC-2023-v1.11"), get_gfw_lossyear(version = "GFC-2023-v1.11"), get_gfw_emissions() ) %>% calc_indicators(calc_treecover_area_and_emissions(years = 2016:2017, min_size = 1, min_cover = 30)) %>% portfolio_long() aoi ``` ## Using cloud storages `{mapme.biodiversity}` leverages GDAL's capabilities for data I/O. For users of this package, that means that integrating a cloud storage is as easy as setting up a configuration file and changing the `outdir` argument in `mapme_options()`. While you could also decide to use environment variables, we recommend to set up a GDAL config file. You can find GDAL's documentation on this topic [here](https://gdal.org/en/latest/user/configoptions.html#gdal-configuration-file). Suppose that we want to use an AWS S3 bucket that we control to write resource data to. Let's assume this bucket is already set up and we wish to refer to it in our R code as `mapme-data`. The GDAL configuration file should look something like this: ```{ini} [credentials] [.mapme-data] path=/vsis3/mapme-data AWS_SECRET_ACCESS_KEY=
AWS_ACCESS_KEY_ID= ``` The connection will be handled based on GDAL's virtual file system. You can find documentation on specific options for your cloud provider [here](https://gdal.org/en/latest/user/virtual_file_systems.html#network-based-file-systems). Ideally, you would also set the following in the `.Renviron` file in your user's home directory to ensure that GDAL is aware of this configuration when an R session is started: ```{ini} GDAL_CONFIG_FILE = " " ``` Then, in your scripts set the `outdir` option to the value specified with the `path` variable in the configuration file: ```{r s3-outdir, eval = FALSE} mapme_options(outdir = "/vsis3/mapme-data") ``` ## A note on parallel computing `{mapme.biodiversity}` follows the parallel computing paradigm of the [`{future}`](https://cran.r-project.org/package=future) package. That means that you as a user are in the control if and how you would like to set up parallel processing. Since `{mapme.biodiversity} v0.9`, we apply pre-chunking to all assets in the portfolio. That means that assets are split up into components of roughly the size of `chunk_size`. These components can than be iterated over in parallel to speed up processing. Indicator values will be aggregated automatically. ```{r parallel-1, eval = FALSE} library(future) plan(cluster, workers = 6) ``` As another example, with the code below one would apply parallel processing of 2 assets, with each having 4 workers available to process chunks, thus requiring a total of 8 available cores on the host machine. Be sure to not request more workers than available on your machine. ```{r parallel, eval = FALSE} library(progressr) plan(cluster, workers = 2) with_progress({ aoi <- calc_indicators( aoi, calc_treecover_area_and_emissions( min_size = 1, min_cover = 30 ) ) }) plan(sequential) # close child processes ``` ## More info Head over to the [online documentation](https://mapme-initiative.github.io/mapme.biodiversity/index.html) to find more detailed information about the package.
Owner
- Name: mapme-initiative
- Login: mapme-initiative
- Kind: organization
- Website: https://mapme-initiative.org/
- Repositories: 6
- Profile: https://github.com/mapme-initiative
GitHub Events
Total
- Create event: 15
- Commit comment event: 2
- Release event: 1
- Issues event: 42
- Watch event: 9
- Delete event: 13
- Member event: 2
- Issue comment event: 75
- Push event: 334
- Pull request event: 41
- Fork event: 4
Last Year
- Create event: 15
- Commit comment event: 2
- Release event: 1
- Issues event: 42
- Watch event: 9
- Delete event: 13
- Member event: 2
- Issue comment event: 76
- Push event: 334
- Pull request event: 41
- Fork event: 4
Committers
Last synced: 6 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Darius A. Görgen | i****o@d****m | 374 |
| Darius Görgen | d****2@w****e | 152 |
| Darius A. Görgen | D****2@w****e | 74 |
| Ohm-Np | o****5@g****m | 65 |
| Zivan Karaman | 3****n@u****m | 37 |
| Petutschnig, Andreas | A****g@a****e | 15 |
| Andreas Petutschnig | k****n@u****m | 12 |
| fBedecarrats | f****s@g****m | 11 |
| Om Prakash Bhandari | 5****p@u****m | 9 |
| Johannes Schielein | j****n@p****t | 7 |
| melvinhlwong | 3****g@u****m | 6 |
| ADiamondra | r****8@g****m | 1 |
| Davis Vaughan | d****s@r****m | 1 |
| root | r****t@D****4 | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 198
- Total pull requests: 341
- Average time to close issues: 2 months
- Average time to close pull requests: 3 days
- Total issue authors: 21
- Total pull request authors: 9
- Average comments per issue: 3.17
- Average comments per pull request: 1.52
- Merged pull requests: 301
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 39
- Pull requests: 51
- Average time to close issues: 7 days
- Average time to close pull requests: 4 days
- Issue authors: 10
- Pull request authors: 5
- Average comments per issue: 1.1
- Average comments per pull request: 1.12
- Merged pull requests: 41
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- goergen95 (75)
- Jo-Schie (30)
- fBedecarrats (28)
- karpfen (25)
- zivankaraman (8)
- Shirobakaidou (8)
- Ohm-Np (6)
- KornTob (3)
- ADiamondra (3)
- thomas-thivillon (1)
- lenaigmoign (1)
- vuillota (1)
- cboettig (1)
- ghost (1)
- rsbivand (1)
Pull Request Authors
- goergen95 (265)
- karpfen (31)
- zivankaraman (23)
- fBedecarrats (11)
- Ohm-Np (5)
- Jo-Schie (2)
- ADiamondra (2)
- DavisVaughan (1)
- melvinhlwong (1)
Top Labels
Issue Labels
bug (18)
enhancement (14)
new indicator (12)
documentation (8)
JOSS (4)
fast-lane (2)
to-do (1)
discussion (1)
wontfix (1)
good first issue (1)
Pull Request Labels
enhancement (10)
new indicator (6)
bug (5)
fast-lane (1)
Packages
- Total packages: 1
-
Total downloads:
- cran 574 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 17
- Total maintainers: 1
cran.r-project.org: mapme.biodiversity
Efficient Monitoring of Global Biodiversity Portfolios
- Homepage: https://mapme-initiative.github.io/mapme.biodiversity/
- Documentation: http://cran.r-project.org/web/packages/mapme.biodiversity/mapme.biodiversity.pdf
- License: GPL (≥ 3)
-
Latest release: 0.9.4
published 10 months ago
Rankings
Forks count: 10.1%
Stargazers count: 15.1%
Average: 25.4%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Downloads: 36.6%
Maintainers (1)
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.5.0 depends
- curl * imports
- data.table * imports
- dplyr * imports
- httr * imports
- magrittr * imports
- pbapply * imports
- purrr * imports
- rvest * imports
- sf * imports
- stringr * imports
- terra * imports
- tibble * imports
- tidyr * imports
- tidyselect * imports
- DiagrammeR * suggests
- SPEI * suggests
- exactextractr * suggests
- ggplot2 * suggests
- knitr * suggests
- lwgeom * suggests
- rmarkdown * suggests
- testthat >= 3.0.0 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/pkgdown.yaml
actions
- 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 v2 composite
- r-lib/actions/pr-push v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 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
## About
Biodiversity areas, especially primary forests, provide multiple ecosystem services for the local population and the planet as a whole. The rapid expansion of human land use into natural ecosystems and the impacts of the global climate crisis put natural ecosystems and the global biodiversity under threat.
The mapme.biodiversity package helps to analyse a number of biodiversity related indicators and biodiversity threats based on freely available geodata-sources such as the Global Forest Watch. It supports computational efficient routines and heavy parallel computing in cloud-infrastructures such as AWS or Microsoft Azure using in the statistical programming language R. The package allows for the analysis of global biodiversity portfolios with a thousand or millions of AOIs which is normally only possible on dedicated platforms such as the Google Earth Engine. It provides the possibility to e.g. analyse the World Database of Protected Areas (WDPA) for a number of relevant indicators. The primary use case of this package is to support scientific analysis and data science for individuals and organizations who seek to preserve the planet biodiversity. Its development is funded by the German Development Bank KfW.
## Installation
### Stable version
The package and its dependencies can be installed from CRAN via:
```{r install-cran, eval = FALSE}
install.packages("mapme.biodiversity", dependencies = TRUE)
```
Windows and macOS binary packages are available from here.
### Development version
To install the development version, use the following command:
```{r install-devel, eval = FALSE}
if (isFALSE(require("remotes", quietly = TRUE))) install.packages("remotes", dependencies = TRUE)
remotes::install_github("https://github.com/mapme-initiative/mapme.biodiversity", dependencies = TRUE)
```
## Available resources and indicators
Below is a list of the resources currently supported by `mapme.biodiversity`.
```{r available_resources, echo = FALSE}
knitr::kable(mapme.biodiversity::available_resources()[, c("name", "description", "licence")])
```
Next, is a list of supported indicators.
```{r available_indicators, echo = FALSE}
knitr::kable(mapme.biodiversity::available_indicators()[, c("name", "description")])
```
## Usage example
`{mapme.biodiversity}` works by constructing a portfolio from an sf object. Specific raster and vector resource matching the spatio-temporal extent of the portfolio are made available locally. Once all required resources are available, indicators can be calculated individually for each asset in the portfolio.
```{r resources}
library(mapme.biodiversity)
library(sf)
```
Once you have decided on an indicator you are interested in, you can start by making the required resource available for your portfolio. Using `mapme_options()` you can set an output directory, control the maximum size of polygons before they are chunked into smaller parts, and control the verbosity of the package.
A portfolio is represented by an sf-object. It is required for the object to only contain geometries of type `POLYGON` and `MULTIPOLYGON` as assets. We can request the download of a resource for the spatial extent of our portfolio by using the `get_resources()` function. We simply supply our portfolio and one or more resource functions. Once the resources were made available, we can query the calculation of an indicator by using the `calc_indicators()` function. This function also expects the portfolio as input and one or more indicator functions. Once the indicator has been calculated for all assets in a portfolio, the data is returned as a nested list column to the original portfolio object. The output of each indicator is standardized to common format, consisting of a tibble with columns `datetime`, `variable`, `unit`, and `value`. We can transform the the data to long format by using `portfolio_long()`.
```{r calculation}
mapme_options(
outdir = system.file("res", package = "mapme.biodiversity"),
chunk_size = 1e6, # in ha
verbose = FALSE
)
aoi <- system.file("extdata", "sierra_de_neiba_478140_2.gpkg", package = "mapme.biodiversity") %>%
sf::read_sf() %>%
get_resources(
get_gfw_treecover(version = "GFC-2023-v1.11"),
get_gfw_lossyear(version = "GFC-2023-v1.11"),
get_gfw_emissions()
) %>%
calc_indicators(calc_treecover_area_and_emissions(years = 2016:2017, min_size = 1, min_cover = 30)) %>%
portfolio_long()
aoi
```
## Using cloud storages
`{mapme.biodiversity}` leverages GDAL's capabilities for data I/O. For users of this package, that means that integrating a cloud storage is as easy as setting up a configuration file and changing the `outdir` argument in `mapme_options()`. While you could also decide to use environment variables, we recommend to set up a GDAL config file. You can find GDAL's documentation on this topic [here](https://gdal.org/en/latest/user/configoptions.html#gdal-configuration-file).
Suppose that we want to use an AWS S3 bucket that we control to write resource data to. Let's assume this bucket is already set up and we wish to refer to it in our R code as `mapme-data`. The GDAL configuration file should look something like this:
```{ini}
[credentials]
[.mapme-data]
path=/vsis3/mapme-data
AWS_SECRET_ACCESS_KEY=