Skip to main content

EcoScape habitat connectivity computation.

Project description

EcoScape Connectivity Computation

This package implements the computation of connectivity and flow according to the EcoScape algorithm.

Authors

Project home page

Usage

The package can be used both from the command line, and as a python module. For command line options, do:

ecoscape-connectivity --help

As a Python module, the main function is compute_connectivity:

from ecoscape_connectivity import compute_connectivity

def compute_connectivity(habitat_fn=None,
                         terrain_fn=None,
                         connectivity_fn=None,
                         flow_fn=None,
                         permeability_dict=None,
                         gap_crossing=2,
                         num_gaps=10,
                         num_simulations=400,
                         seed_density=4,
                         single_tile=False,
                         tile_size=1000,
                         tile_border=256,
                         minimum_habitat=1e-4,
                         in_memory=False,
                         generate_flow_memory=False)

The computation will be much faster if you run it with GPU support.

The output connectivity and flow are encoded in the output geotiffs as follows:

  • For connectivity, the values from [0, 1] are linearly rescaled to the range 0..255 and encoded as integers, so that 0 corresponds to no connectivity, and 255 to maximum connectivity.
  • For flow, the values of $f \in [0, \infty)$ are encoded in log-scale via $20 \cdot log_{10} (1 + f)$ (so that the flow is expressed in dB, like sound intensity), and clipped to integers in the 0..255 range.

Arguments:

  • habitat_fn: name of habitat geotiff, or (if used as module) the GeoTiff object from habitat geotiff. This file must contain 0 = non habitat, and 1 = habitat.
  • terrain_fn: name of the landscape matrix geotiff, or (if used as module) the GeoTiff object from landscape matrix geotiff. This file contains terrain categories that are translated via permeability_dict.
  • connectivity_fn: output file name for connectivity.
  • flow_fn: output file name for flow. If None, the flow is not computed, and the computation is faster.
  • permeability_dict: Permeability dictionary. Gives the permeability of each terrain type, translating from the terrain codes, to the permeability in [0, 1]. If a terrain type is not found in the dictionary, it is assumed it has permeability 0.
  • gap_crossing: size of gap crossing in pixels.
  • num_gaps: number of gaps that can be crossed during dispersal.
  • num_simulations: Number of simulations that are done.
  • seed_density: density of seeds. There are this many seeds for every square with edge of dispersal distance.
  • single_tile: if True, instead of iterating over small tiles, tries to read the input as a single large tile. This is faster, but might not fit into memory.
  • tile_size: size of (square) tile in pixels.
  • tile_border: size of tile border in pixels.
  • minimum_habitat: if a tile has a fraction of habitat smaller than this, it is skipped. This saves time in countries where the habitat is only on a small portion.
  • in_memory: whether the connectivity and flow should be saved in memory only. Because such files would be deleted on close, the open memory files will be returned as (repop_file, grad_file). Note that the parameters connectivity_fn and flow_fn are ignored if this is set to True, and at least connectivity will be returned. Flow is also generated only if generate_flow_memory is True. Only for use as module.
  • generate_flow_memory: whether the flow should be generated in memory. Only used if in_memory is True. Only for use as module.

Example Notebooks

Here you can find a Colab Notebook that demonstrates connectivity computation.

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_connectivity-0.0.5.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

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

ecoscape_connectivity-0.0.5-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file ecoscape_connectivity-0.0.5.tar.gz.

File metadata

  • Download URL: ecoscape_connectivity-0.0.5.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.11

File hashes

Hashes for ecoscape_connectivity-0.0.5.tar.gz
Algorithm Hash digest
SHA256 efe373c7f730e019f6a20a9a5d768defa863915c94b90752f79dc1d34bae74ba
MD5 9e8e2e0d36abf0f08f89e270ef02f06c
BLAKE2b-256 7a3d171872a754b940c28dc28816a15c9ad6cbf51c58035fc189ad51750fe806

See more details on using hashes here.

File details

Details for the file ecoscape_connectivity-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for ecoscape_connectivity-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f2f0d37379b7261e96a8b32f2d3112b8e9a5fbbf5d2cdb1c3119088e5445ea87
MD5 1bd87553561efa3848c7fab6289067d5
BLAKE2b-256 39872b30570a8bcf2862b881e58c35daa84e70ebdf914fbcb5f94b4ddd5b8701

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