Skip to main content

Species distribution modeling tools

Project description

elapid logo

Contemporary species distribution modeling tools for python.

GitHub PyPI version Anaconda version PyPI downloads GitHub last commit DOI


Documentation: earth-chris.github.io/elapid

Source code: earth-chris/elapid


:snake: Introduction

elapid is a series of species distribution modeling tools for python. This includes a custom implementation of Maxent and a suite of methods to simplify working with biogeography data.

The name is an homage to A Biogeographic Analysis of Australian Elapid Snakes (H.A. Nix, 1986), the paper widely credited with defining the essential bioclimatic variables to use in species distribution modeling. It's also a snake pun (a python wrapper for mapping snake biogeography).


:seedling: Installation

pip install elapid or conda install -c conda-forge elapid

Installing glmnet is optional, but recommended. This can be done with pip install elapid[glmnet] or conda install -c conda-forge elapid glmnet. For more support, and for information on why this package is recommended, see this page.

The conda install is recommended for Windows users. While there is a pip distribution, you may experience some challenges. The easiest way to overcome them is to use Windows Subsystem for Linux (WSL). Otherwise, see this page for support.


:deciduous_tree: Why use elapid?

The amount and quality of bioegeographic data has increased dramatically over the past decade, as have cloud-based tools for working with it. elapid was designed to provide a set of modern, python-based tools for working with species occurrence records and environmental covariates to map different dimensions of a species' niche.

elapid supports working with modern geospatial data formats and uses contemporary approaches to training statistical models. It uses sklearn conventions to fit and apply models, rasterio to handle raster operations, geopandas for vector operations, and processes data under the hood with numpy.

This makes it easier to do things like fit/apply models to multi-temporal and multi-scale data, fit geographically-weighted models, create ensembles, precisely define background point distributions, and summarize model predictions.

It does the following things reasonably well:

:globe_with_meridians: Point sampling

Select random geographic point samples (aka background or pseudoabsence points) within polygons or rasters, handling nodata locations, as well as sampling from bias maps (using elapid.sample_raster(), elapid.sample_vector(), or elapid.sample_bias_file()).

:chart_with_upwards_trend: Vector annotation

Extract and annotate point data from rasters, creating GeoDataFrames with sample locations and their matching covariate values (using elapid.annotate()). On-the-fly reprojection, dropping nodata, multi-band inputs and multi-file inputs are all supported.

:bar_chart: Zonal statistics

Calculate zonal statistics from multi-band, multi-raster data into a single GeoDataFrame from one command (using elapid.zonal_stats()).

:bug: Feature transformations

Transform covariate data into derivative features to expand data dimensionality and improve prediction accuracy (like elapid.ProductTransformer(), elapid.HingeTransformer(), or the all-in-one elapid.MaxentFeatureTransformer()).

:bird: Species distribution modeling

Train and apply species distribution models based on annotated point data, configured with sensible defaults (like elapid.MaxentModel() and elapid.NicheEnvelopeModel()).

:satellite: Training spatially-aware models

Compute spatially-explicit sample weights, checkerboard train/test splits, or geographically-clustered cross-validation splits to reduce spatial autocorellation effects (with elapid.distance_weights(), elapid.checkerboard_split() and elapid.GeographicKFold()).

:earth_asia: Applying models to rasters

Apply any pixel-based model with a .predict() method to raster data to easily create prediction probability maps (like training a RandomForestClassifier() and applying with elapid.apply_model_to_rasters()).

:cloud: Cloud-native geo support

Work with cloud- or web-hosted raster/vector data (on https://, gs://, s3://, etc.) to keep your disk free of temporary files.

Check out some example code snippets and workflows on the Working with Geospatial Data page.


:snake: elapid requires some effort on the user's part to draw samples and extract covariate data. This is by design.

Selecting background samples, computing sample weights, splitting train/test data, and specifying training parameters are all critical modeling choices that have profound effects on inference and interpretation.

The extra flexibility provided by elapid enables more control over the seemingly black-box approach of Maxent, enabling users to better tune and evaluate their models.


How to cite

BibTeX:

@article{
  Anderson2023,
  title = {elapid: Species distribution modeling tools for Python}, journal = {Journal of Open Source Software}
  author = {Christopher B. Anderson},
  doi = {10.21105/joss.04930},
  url = {https://doi.org/10.21105/joss.04930},
  year = {2023},
  publisher = {The Open Journal},
  volume = {8},
  number = {84},
  pages = {4930},
}

Or click "Cite this repository" on the GitHub page.


Developed by

Christopher Anderson[^1] [^2]

Twitter Follow GitHub Stars

[^1]: Earth Observation Lab, Planet Labs PBC [^2]: Center for Conservation Biology, Stanford University

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

elapid-1.0.3.tar.gz (423.9 kB view details)

Uploaded Source

Built Distribution

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

elapid-1.0.3-py3-none-any.whl (436.5 kB view details)

Uploaded Python 3

File details

Details for the file elapid-1.0.3.tar.gz.

File metadata

  • Download URL: elapid-1.0.3.tar.gz
  • Upload date:
  • Size: 423.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for elapid-1.0.3.tar.gz
Algorithm Hash digest
SHA256 d15334f58ac8f86ab15e6d74b0b0b7d8e335b0494151ac9c4554fd91ad0d25f4
MD5 ac80fdc22c358156ef88e4ea3a63571b
BLAKE2b-256 1b028c74964f2203a526c4d9cb19c84ab8ebfd0c2be278867282f0be89d18c5e

See more details on using hashes here.

File details

Details for the file elapid-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: elapid-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 436.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for elapid-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 58007416ac1bdeedfd690eaa8c39d0cef7d9cf733215004d8ec4b20153268ff6
MD5 90b1bc08b0ab9c01e7df80f40cadd63c
BLAKE2b-256 486f5f3d46b90d550484aba9af844aa6721b59af744c10749f6272618244231a

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