{"id":23885603,"url":"https://github.com/martibosch/pylandstats","last_synced_at":"2025-04-04T08:05:38.149Z","repository":{"id":46765161,"uuid":"157232414","full_name":"martibosch/pylandstats","owner":"martibosch","description":"Computing landscape metrics in the Python ecosystem","archived":false,"fork":false,"pushed_at":"2024-10-29T00:14:41.000Z","size":871,"stargazers_count":83,"open_issues_count":9,"forks_count":16,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-10-29T16:17:22.375Z","etag":null,"topics":["land-change-analysis","landscape-ecology","landscape-metrics","python","raster"],"latest_commit_sha":null,"homepage":"https://doi.org/10.1371/journal.pone.0225734","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martibosch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-12T15:13:10.000Z","updated_at":"2024-10-25T13:52:46.000Z","dependencies_parsed_at":"2023-09-21T19:46:26.275Z","dependency_job_id":"8ba5499d-b749-4bca-8b10-6521a2098c72","html_url":"https://github.com/martibosch/pylandstats","commit_stats":{"total_commits":302,"total_committers":6,"mean_commits":"50.333333333333336","dds":0.05960264900662249,"last_synced_commit":"438ab7593c86bde3670d3f48126dc6d46e382417"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martibosch%2Fpylandstats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martibosch%2Fpylandstats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martibosch%2Fpylandstats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martibosch%2Fpylandstats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martibosch","download_url":"https://codeload.github.com/martibosch/pylandstats/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234319553,"owners_count":18813552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["land-change-analysis","landscape-ecology","landscape-metrics","python","raster"],"created_at":"2025-01-04T05:45:16.005Z","updated_at":"2025-02-08T10:14:12.451Z","avatar_url":"https://github.com/martibosch.png","language":"Python","funding_links":[],"categories":["Landscape Metrics","Natural Resources"],"sub_categories":["Soil and Land"],"readme":"[![PyPI version fury.io](https://badge.fury.io/py/pylandstats.svg)](https://pypi.python.org/pypi/pylandstats/)\n[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pylandstats.svg)](https://anaconda.org/conda-forge/pylandstats)\n[![Documentation Status](https://readthedocs.org/projects/pylandstats/badge/?version=latest)](https://pylandstats.readthedocs.io/en/latest/?badge=latest)\n[![tests](https://github.com/martibosch/pylandstats/actions/workflows/tests.yml/badge.svg)](https://github.com/martibosch/pylandstats/blob/main/.github/workflows/tests.yml)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/martibosch/pylandstats/main.svg)](https://results.pre-commit.ci/latest/github/martibosch/pylandstats/main)\n[![codecov](https://codecov.io/github/martibosch/pylandstats/branch/main/graph/badge.svg?token=fqjSTzixmC)](https://codecov.io/github/martibosch/pylandstats)\n[![GitHub license](https://img.shields.io/github/license/martibosch/pylandstats.svg)](https://github.com/martibosch/pylandstats/blob/master/LICENSE)\n\n# PyLandStats\n\nOpen-source library to compute landscape metrics in the Python ecosystem (NumPy, pandas, matplotlib...)\n\n**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](https://doi.org/10.1371/journal.pone.0225734)\n\n## Features\n\n- Read GeoTiff files of land use/cover:\n\n  ```python\n  import pylandstats as pls\n\n  ls = pls.Landscape(\"../data/processed/veveyse-AS18_4.tif\")\n  ls.plot_landscape(legend=True)\n  ```\n\n  ![landscape-veveyse](figures/landscape.png)\n\n- Compute pandas data frames of landscape metrics at the patch, class and landscape level:\n\n  ```python\n  class_metrics_df = ls.compute_class_metrics_df(\n      metrics=[\"proportion_of_landscape\", \"edge_density\", \"euclidean_nearest_neighbor_mn\"]\n  )\n  class_metrics_df\n  ```\n\n  | class_val | proportion_of_landscape | edge_density | euclidean_nearest_neighbor_mn |\n  | --------: | ----------------------: | -----------: | ----------------------------: |\n  |         1 |                7.749572 |    19.102211 |                    309.244705 |\n  |         2 |               56.271868 |    50.599270 |                    229.079970 |\n  |         3 |               33.946252 |    38.167200 |                    253.299859 |\n  |         4 |                2.032308 |     3.722177 |                    552.835154 |\n\n- Analyze the spatio-temporal evolution of landscapes:\n\n  ```python\n  import matplotlib.pyplot as plt\n\n  input_filepaths = [\n      \"../data/processed/veveyse-AS97R_4.tif\",\n      \"../data/processed/veveyse-AS09R_4.tif\",\n      \"../data/processed/veveyse-AS18_4.tif\",\n  ]\n\n  sta = pls.SpatioTemporalAnalysis(input_filepaths, dates=[\"1992\", \"2004\", \"2012\"])\n  sta.plot_metric(\"contagion\")\n  ```\n\n  ![spatiotemporal-analysis](figures/spatiotemporal.png)\n\n- Zonal analysis of landscapes\n\nSee the [documentation](https://pylandstats.readthedocs.io/en/latest/?badge=latest) and the [pylandstats-notebooks](https://github.com/martibosch/pylandstats-notebooks) repository for a more complete overview.\n\n## Installation\n\nThe easiest way to install PyLandStats is with conda:\n\n```\n$ conda install -c conda-forge pylandstats\n```\n\nwhich will install PyLandStats and all of its dependencies. Alternatively, you can install PyLandStats using pip:\n\n```\n$ pip install pylandstats\n```\n\nNevertheless, 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](https://github.com/geopandas/geopandas), which cannot be installed with pip. If you already have [the dependencies for geopandas](https://geopandas.readthedocs.io/en/latest/install.html#dependencies) installed in your system, you might then install PyLandStats with the `geo` extras as in:\n\n```\n$ pip install pylandstats[geo]\n```\n\nand you will be able to use the aforementioned features (without having to use conda).\n\n### Development install\n\nTo install a development version of PyLandStats, you can first use conda to create an environment with all the dependencies and activate it as in:\n\n```\n$ conda create -n pylandstats -c conda-forge geopandas matplotlib-base rasterio scipy openblas\n$ conda activate pylandstats\n```\n\nand then clone the repository and use pip to install it in development mode\n\n```\n$ git clone https://github.com/martibosch/pylandstats.git\n$ cd pylandstats/\n$ pip install -e .\n```\n\n## Acknowledgments\n\n- The computation of the adjacency matrix in [transonic](https://github.com/fluiddyn/transonic) has been implemented by Pierre Augier ([paugier](https://github.com/paugier))\n- Several information theory-based metrics from Nowosad and Stepinski [1] were added by [achennu](https://github.com/achennu)\n- With the support of the École Polytechnique Fédérale de Lausanne (EPFL)\n- The Corine Land Cover datasets used for the test datasets were produced with funding by the European Union\n\n## References\n\n1. Nowosad, J., \u0026 Stepinski, T. F. (2019). Information theory as a consistent framework for quantification and classification of landscape patterns. Landscape Ecology, 34(9), 2091-2101.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartibosch%2Fpylandstats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartibosch%2Fpylandstats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartibosch%2Fpylandstats/lists"}