Skip to main content

Computing landscape metrics in the Python ecosystem.

Project description

PyPI version fury.io Conda Downloads Documentation Status tests pre-commit.ci status codecov GitHub license

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)
    

    landscape-veveyse

  • 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")
    

    spatiotemporal-analysis

  • 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

  1. 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.

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

pylandstats-3.0.1.tar.gz (297.5 kB view details)

Uploaded Source

Built Distributions

pylandstats-3.0.1-cp312-cp312-musllinux_1_2_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12 musllinux: musl 1.2+ x86-64

pylandstats-3.0.1-cp312-cp312-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (72.6 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.17+ x86-64

pylandstats-3.0.1-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl (75.3 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.12+ i686 manylinux: glibc 2.17+ i686

pylandstats-3.0.1-cp312-cp312-macosx_11_0_arm64.whl (61.4 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pylandstats-3.0.1-cp311-cp311-musllinux_1_2_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.2+ x86-64

pylandstats-3.0.1-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (72.5 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.17+ x86-64

pylandstats-3.0.1-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl (75.1 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.12+ i686 manylinux: glibc 2.17+ i686

pylandstats-3.0.1-cp311-cp311-macosx_11_0_arm64.whl (62.3 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pylandstats-3.0.1-cp310-cp310-musllinux_1_2_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

pylandstats-3.0.1-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (72.5 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.17+ x86-64

pylandstats-3.0.1-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl (75.1 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.12+ i686 manylinux: glibc 2.17+ i686

pylandstats-3.0.1-cp310-cp310-macosx_11_0_arm64.whl (62.3 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pylandstats-3.0.1-cp39-cp39-musllinux_1_2_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.9 musllinux: musl 1.2+ x86-64

pylandstats-3.0.1-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (72.5 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.17+ x86-64

pylandstats-3.0.1-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl (75.1 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686 manylinux: glibc 2.17+ i686

pylandstats-3.0.1-cp39-cp39-macosx_11_0_arm64.whl (62.3 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

File details

Details for the file pylandstats-3.0.1.tar.gz.

File metadata

  • Download URL: pylandstats-3.0.1.tar.gz
  • Upload date:
  • Size: 297.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pylandstats-3.0.1.tar.gz
Algorithm Hash digest
SHA256 5f2456a25ecc304482094f443c7812dbc9f93639207d753b521390b85c3574c1
MD5 dede61830b06c145525ddd2221fd0754
BLAKE2b-256 00c587a94b8fa8404a7a8533aaab84ee120169f6eb08c6e1fad889878c9f014a

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2296ba745d27f68c4f9f358be95ed6dd0ffa6649ebbea04fd615580e043eb0f7
MD5 500474bd4e5c269e6f8d949e07ec2bc0
BLAKE2b-256 8e6d039bb61c05d3f3096cc90df3cd61ed2c8d01dba3a87321fda19bdee32c50

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp312-cp312-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp312-cp312-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1b2cd52275b12a7f2391372bf1b1fbd7fb8326d506e4f4da39cf00db2c4e0661
MD5 71da64ba620e1f9b0eced60f0b8bf193
BLAKE2b-256 76abe4511b1257af710f9a2866fe42cfbfc5abbd5dbfdec6004397f9019670d2

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 796285b2cd78137357925bafe0ccf9e3d46f00ad2be6982cd501f409db05d305
MD5 69bca086586917549330242713b47ade
BLAKE2b-256 8f841598e37eade2c2330c1749d4a345fed9c54c131570a4da55200f0c3cad5a

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b68c6f7064881cd11d97d7ed375b146af99a8fe511c50e3dd7d8ee8c947b89b4
MD5 cff17dbb11f97d4a5d9c336d547f6780
BLAKE2b-256 6a07a765aa6bc4267b0495aaa2c9a88845dfabbba80bebb7ed0abf64d329e62b

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 12223f1bd4481045f9215416949d3a4f0ea9b206e88f30df1d0462197e19c8e8
MD5 6da2ba2ebf4dce3c7b19ccaeeb584e98
BLAKE2b-256 54dbf80ff6ade2d17215701d8bba014a85228a77ef2fae9ab4b984ec5b29e896

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6a529e22b79cef731159994b040e4dd32d83687eda2d7386c4089446ed11a81c
MD5 6ec60c66f7fbeeccb123f1f2e3bbfc8d
BLAKE2b-256 f6c7b158d88dfa47fb3980366e01a0f3bc28421fc515caf36c5919ee04692de7

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 0820dd2e550abd3b3b8b407a68bf81f9ad3166abc75809d419a7710a53b0060c
MD5 1a82fad2079b6121693a8173d5efb164
BLAKE2b-256 f3093391123cfd05475002a5f8852bf08fd49f244923bffcc7964d13edebab33

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7b78cd25fa48f0bdc626187f2fc12cbe6a3249d0f707c4025d8d16c2bfa2c446
MD5 d64770fa95dd3b8574d2556f2f528630
BLAKE2b-256 17b2aa8b0cee49c217fb731e710ac19d13edd1a99123c25450e26ecc0bb0acd3

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 197fbbd8b8ec91b13bd6d787dc4e2e21a9337e0d0e1f88f2e91f7b5a8745f9ac
MD5 9d3d05a8bd2a8b1d09ed0c62c1929dbc
BLAKE2b-256 e27590ae6be04378380b626cb17092f0b39c73a2bddea7a37d27fa167d8043c7

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 72b43353e6c2e37f16f81235a680f7a26ebeef599bbe792625c303b29304ee5f
MD5 929324ad3135324d466bdc59750204fb
BLAKE2b-256 4e7d0ada56d61f4c3674df20698a6c67b1ec2c4ad99684f6243258b48656bac7

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 d10c09193eadfcc5ca9a881d7f2513a0e478e44aa5189227f4ea60db2a14f6dc
MD5 cd7b7606b8f9e6bc89725fef71c54dad
BLAKE2b-256 17e01775321de51193ec7423da282cecabb15f23b65cc8ea9c6c1ef1d2ad523a

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3ea3098aeb8785978a75a014a427d120efb27af747ee7b117c5299e7b549a0f2
MD5 d109848d1cf83ecad8d745c892d8f3d5
BLAKE2b-256 ce6ea8b335116b9b2020868c0468f24f3300df15fce471b5bcdb03e75fdddca9

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5c3473312377ce5ef23aac127a63800f0643a1a603bfd718905db4ec6dc16876
MD5 4092f0aaaa3c07fea8af6302fdd7292c
BLAKE2b-256 81b411a96209d84bb2dd691a7f4093a475d9ca4389f1c84d2ab05080cb02283d

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3a575fd6d34c5b6da209a5702e201326bf8e55eab6b971c38e898543ea4ff677
MD5 4a327dd9ca03d138d4cc5d805665186a
BLAKE2b-256 ea992b0ce93471d8f0584c4528416afb45dbe145f4d42691b864326cd882cf11

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 b2d75f3c8396dd866f0565aa576b739342c10689e6b58a1d4ee073c31324a2e5
MD5 1dcace2da7867e4d99454f89bd884f94
BLAKE2b-256 d47b3fc6fc8f705c8e3dc693e1703d9df81756e4a8d5b4f937d6682a5807d8ea

See more details on using hashes here.

File details

Details for the file pylandstats-3.0.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pylandstats-3.0.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c50f1299c74b5b59618f0474397b5c95191bf919db69320849e62e98bc9472ae
MD5 fb80ea71593ad71375b1668c6175de1d
BLAKE2b-256 eb4ecd1ff9cf40fd76bf64db3e86dfb2411d80e35ff28c8bf8c1bdb80c699ea9

See more details on using hashes here.

Supported by

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