PyLandStats
An open-source Pythonic library to compute landscape metrics.
https://github.com/martibosch/pylandstats
Category: Natural Resources
Sub Category: Soil and Land
Keywords
land-change-analysis landscape-ecology landscape-metrics python raster
Keywords from Contributors
archiving observation measur transforms optimize conversion projection meshing profiles generic
Last synced: 28 minutes ago
JSON representation
Repository metadata
Computing landscape metrics in the Python ecosystem
- Host: GitHub
- URL: https://github.com/martibosch/pylandstats
- Owner: martibosch
- License: gpl-3.0
- Created: 2018-11-12T15:13:10.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-04-14T20:35:40.000Z (12 days ago)
- Last Synced: 2025-04-17T14:11:55.242Z (10 days ago)
- Topics: land-change-analysis, landscape-ecology, landscape-metrics, python, raster
- Language: Python
- Homepage: https://doi.org/10.1371/journal.pone.0225734
- Size: 896 KB
- Stars: 92
- Watchers: 3
- Forks: 16
- Open Issues: 4
- Releases: 17
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
README.md
PyLandStats
Open-source library to compute landscape metrics in the Python ecosystem (NumPy, pandas, matplotlib...)
Citation: Bosch M. 2019. "PyLandStats: An open-source Pythonic library to compute landscape metrics". PLOS ONE, 14(12), 1-19. doi.org/10.1371/journal.pone.0225734
Features
-
Read GeoTiff files of land use/cover:
import pylandstats as pls ls = pls.Landscape("../data/processed/veveyse-AS18_4.tif") ls.plot_landscape(legend=True)
-
Compute pandas data frames of landscape metrics at the patch, class and landscape level:
class_metrics_df = ls.compute_class_metrics_df( metrics=["proportion_of_landscape", "edge_density", "euclidean_nearest_neighbor_mn"] ) class_metrics_df
class_val proportion_of_landscape edge_density euclidean_nearest_neighbor_mn 1 7.749572 19.102211 309.244705 2 56.271868 50.599270 229.079970 3 33.946252 38.167200 253.299859 4 2.032308 3.722177 552.835154 -
Analyze the spatio-temporal evolution of landscapes:
import matplotlib.pyplot as plt input_filepaths = [ "../data/processed/veveyse-AS97R_4.tif", "../data/processed/veveyse-AS09R_4.tif", "../data/processed/veveyse-AS18_4.tif", ] sta = pls.SpatioTemporalAnalysis(input_filepaths, dates=["1992", "2004", "2012"]) sta.plot_metric("contagion")
-
Zonal analysis of landscapes
See the documentation and the pylandstats-notebooks repository for a more complete overview.
Installation
The easiest way to install PyLandStats is with conda:
$ conda install -c conda-forge pylandstats
which will install PyLandStats and all of its dependencies. Alternatively, you can install PyLandStats using pip:
$ pip install pylandstats
Nevertheless, note that in order to define zones by vector geometries in ZonalAnalysis
, or in order to use the the BufferAnalysis
and SpatioTemporalBufferAnalysis
classes, PyLandStats requires geopandas, which cannot be installed with pip. If you already have the dependencies for geopandas installed in your system, you might then install PyLandStats with the geo
extras as in:
$ pip install pylandstats[geo]
and you will be able to use the aforementioned features (without having to use conda).
Development install
To install a development version of PyLandStats, you can first use conda to create an environment with all the dependencies and activate it as in:
$ conda create -n pylandstats -c conda-forge geopandas matplotlib-base rasterio scipy openblas
$ conda activate pylandstats
and then clone the repository and use pip to install it in development mode
$ git clone https://github.com/martibosch/pylandstats.git
$ cd pylandstats/
$ pip install -e .
Acknowledgments
- The computation of the adjacency matrix in transonic has been implemented by Pierre Augier (paugier)
- Several information theory-based metrics from Nowosad and Stepinski [1] were added by achennu
- With the support of the École Polytechnique Fédérale de Lausanne (EPFL)
- The Corine Land Cover datasets used for the test datasets were produced with funding by the European Union
References
- Nowosad, J., & Stepinski, T. F. (2019). Information theory as a consistent framework for quantification and classification of landscape patterns. Landscape Ecology, 34(9), 2091-2101.
Owner metadata
- Name: Martí Bosch
- Login: martibosch
- Email:
- Kind: user
- Description: Doctor in civil and environmental engineering. Urban sprawl, Python, and a bit of landscape ecology and complexity
- Website: https://fosstodon.org/@martibosch
- Location: Lausanne
- Twitter: mortybosch
- Company: EPFL
- Icon url: https://avatars.githubusercontent.com/u/5831581?u=bbb7524d7940ede763089006bffe9f92e22608ce&v=4
- Repositories: 83
- Last ynced at: 2024-06-11T15:35:50.373Z
- Profile URL: https://github.com/martibosch
GitHub Events
Total
- Create event: 19
- Issues event: 7
- Release event: 5
- Watch event: 8
- Delete event: 18
- Issue comment event: 19
- Push event: 102
- Pull request event: 28
Last Year
- Create event: 19
- Issues event: 7
- Release event: 5
- Watch event: 8
- Delete event: 18
- Issue comment event: 19
- Push event: 102
- Pull request event: 28
Committers metadata
Last synced: 5 days ago
Total Commits: 323
Total Committers: 6
Avg Commits per committer: 53.833
Development Distribution Score (DDS): 0.065
Commits in past year: 52
Committers in past year: 4
Avg Commits per committer in past year: 13.0
Development Distribution Score (DDS) in past year: 0.192
Name | Commits | |
---|---|---|
Martí Bosch | m****h@e****h | 302 |
dependabot[bot] | 4****] | 9 |
paugier | p****r@u****r | 5 |
pre-commit-ci[bot] | 6****] | 3 |
Arjun Chennu | a****u@g****m | 2 |
Martí Bosch | m****2@g****m | 2 |
Committer domains:
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 24
Total pull requests: 44
Average time to close issues: about 1 year
Average time to close pull requests: about 2 months
Total issue authors: 20
Total pull request authors: 5
Average comments per issue: 3.33
Average comments per pull request: 1.43
Merged pull request: 28
Bot issues: 0
Bot pull requests: 21
Past year issues: 3
Past year pull requests: 17
Past year average time to close issues: 8 months
Past year average time to close pull requests: 17 days
Past year issue authors: 2
Past year pull request authors: 4
Past year average comments per issue: 2.0
Past year average comments per pull request: 0.88
Past year merged pull request: 9
Past year bot issues: 0
Past year bot pull requests: 14
Top Issue Authors
- emuise (2)
- mouzui (2)
- simon-tarr (2)
- ffrosch (2)
- gislfzhao (1)
- Baharehfa (1)
- 1810174827 (1)
- paulomur (1)
- TGrmn (1)
- cisluis (1)
- kareed1 (1)
- achennu (1)
- JasperSTV (1)
- jennykri (1)
- ferreirav (1)
Top Pull Request Authors
- martibosch (18)
- dependabot[bot] (16)
- pre-commit-ci[bot] (5)
- paugier (4)
- achennu (1)
Top Issue Labels
Top Pull Request Labels
- dependencies (16)
- github_actions (2)
Package metadata
- Total packages: 2
-
Total downloads:
- pypi: 3,278 last-month
- Total dependent packages: 0 (may contain duplicates)
- Total dependent repositories: 2 (may contain duplicates)
- Total versions: 58
- Total maintainers: 1
pypi.org: pylandstats
Computing landscape metrics in the Python ecosystem.
- Homepage:
- Documentation: https://pylandstats.readthedocs.io/
- Licenses: GPL-3.0
- Latest release: 3.1.0 (published 2 months ago)
- Last Synced: 2025-04-26T06:01:39.526Z (1 day ago)
- Versions: 41
- Dependent Packages: 0
- Dependent Repositories: 1
- Downloads: 3,278 Last month
-
Rankings:
- Dependent packages count: 7.303%
- Stargazers count: 8.358%
- Downloads: 8.659%
- Forks count: 9.371%
- Average: 11.152%
- Dependent repos count: 22.068%
- Maintainers (1)
conda-forge.org: pylandstats
Open-source Pythonic library to compute landscape metrics in the Python ecosystem (NumPy, pandas, matplotlib...)
- Homepage: https://github.com/martibosch/pylandstats
- Licenses: GPL-3.0-or-later
- Latest release: 2.4.2 (published over 3 years ago)
- Last Synced: 2025-04-02T02:10:39.271Z (25 days ago)
- Versions: 17
- Dependent Packages: 0
- Dependent Repositories: 1
-
Rankings:
- Dependent repos count: 24.103%
- Stargazers count: 38.807%
- Average: 39.025%
- Forks count: 41.652%
- Dependent packages count: 51.54%
Dependencies
- x.strip *
- actions/checkout v4 composite
- actions/download-artifact v3 composite
- actions/setup-python v4 composite
- actions/upload-artifact v3 composite
- heinrichreimer/github-changelog-generator-action v2.1.1 composite
- pypa/gh-action-pypi-publish release/v1 composite
- softprops/action-gh-release v1 composite
- actions/checkout v4 composite
- codecov/codecov-action v3 composite
- mamba-org/setup-micromamba v1 composite
- pydata-sphinx-theme ==0.13.3
- black *
- geopandas *
- matplotlib >= 2.2
- numba platform_system == 'Windows'
- numpy >= 1.15
- pandas >= 0.23
- rasterio >= 1.0.0
- scipy >= 1.0.0
- transonic >= 0.4.0
Score: 14.452011193656991