Skip to main content

EcoScape habitat and matrix layer creation

Project description

EcoScape Layers

This package implements the computation of the matrix (terrain) layer, habitat layers, and terrain-to-resistance mappings that are needed as inputs to the EcoScape algorithm.

Setup

Besides the dependencies outlined in requirements.txt, this package relies on an R script to download range maps from eBird. If you would like to download these range maps, ensure that you have R installed first.

In addition, to use the package to its fullest extent, you will need to have API keys for the IUCN Red List and eBird APIs, which are used to obtain various data on bird species:

For command line usage, define these keys as variables REDLIST_KEY and EBIRD_KEY in a Python file which can then be given as an argument. An example configuration file with dummy keys, sample_config.py, is provided for reference. For usage as a Python module, simply provide the keys upon initialization of any RedList instance.

The initial terrain raster that we use to produce our layers is a global map produced by Jung et al. and is available for download at https://zenodo.org/record/4058819 (iucn_habitatclassification_composite_lvl2_ver004.zip). It follows the IUCN Red List Habitat Classification Scheme.

Usage

This package can be used on the command line or as a Python module.

For the command line, view argument options with ecoscape_layers --help.

For use as a module, there is a main function generate_layers in layers.py that can be used for generating layers. layers.py also includes the code for the various classes and functions used by generate_layers.

Arguments

Required:

  • config: path to Python config file containing IUCN Red List and eBird API keys.

  • species_list: path to txt file of the bird species for which habitat layers should be generated, formatted as 6-letter eBird species codes on individual lines.

  • terrain: path to initial terrain raster.

Optional:

  • terrain_codes: path to a CSV containing terrain map codes. If it does not yet exist, a CSV based on the final terrain matrix layer will be created at this path.

  • species_range_folder: path to folder to which downloaded eBird range maps should be saved.

  • output_folder: path to output folder.

  • crs: desired common CRS of the outputted layers as an ESRI WKT string, or None to use the CRS of the input terrain raster.

    • Note: if the ESRI WKT string contains double quotes that are ignored when the string is given as a command line argument, use single quotes in place of double quotes.
  • resolution: desired resolution in the units of the chosen CRS, or None to use the resolution of the input terrain raster.

  • resampling: resampling method to use if reprojection of the input terrain layer is required; see https://gdal.org/programs/gdalwarp.html#cmdoption-gdalwarp-r for valid options.

  • bounds: four coordinate numbers representing a bounding box (xmin, ymin, xmax, ymax) for the output layers in terms of the chosen CRS.

  • padding: padding to add around the bounds in the units of the chosen CRS.

  • refine_method: method by which habitat pixels should be selected when creating a habitat layer.

    • forest: selects all forest pixels.
    • forest_add308: selects all forest pixels and pixels with code "308" (Shrubland – Mediterranean-type shrubby vegetation).
    • allsuitable: selects all terrain deemed suitable for the species, as determined by the IUCN Red List.
    • majoronly: selects all terrain deemed of major importance to the species, as determined by the IUCN Red List.

Known issues

  • The eBird and IUCN Red List scientific names do not agree for certain bird species, such as the white-headed woodpecker (eBird code: whhwoo). As the IUCN Red List API only accepts scientific names for its API queries, if this occurs for a bird species, the 6-letter eBird species code for the species must be manually matched to the corresponding scientific name from the IUCN Red List.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ecoscape-layers-0.0.3.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ecoscape_layers-0.0.3-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file ecoscape-layers-0.0.3.tar.gz.

File metadata

  • Download URL: ecoscape-layers-0.0.3.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.2

File hashes

Hashes for ecoscape-layers-0.0.3.tar.gz
Algorithm Hash digest
SHA256 4ec3ff7266292628887d7470277a8d787a70db179c71df0491706b0ac45bb3e0
MD5 b36b61d9b033e5aef2f14ef3239d20f4
BLAKE2b-256 9f2a347c4e67cfd3e648cad9793134f71eeb5f47acdb9224e511f9b602f85161

See more details on using hashes here.

File details

Details for the file ecoscape_layers-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for ecoscape_layers-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 38293604ac5674c78db3ab07b8af7e332c96269a0e9d044015b8167a2c0456c1
MD5 812b1de179c6bcba38b755d86e451b37
BLAKE2b-256 1e99b66aea578e1e0ece179ca5b8f310375191cd1f01eadfcd37fbc2b2661bf7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page