Skip to main content

PyPI version fury.io Conda Downloads Documentation Status Build Status Coverage Status GitHub license

PyLandStats

Open-source Pythonic library to compute landscape metrics within the PyData stack (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.read_geotiff('data/vaud_g100_clc00_V18_5.tif')
    
    ls.plot_landscape(legend=True)
    

    landscape-vaud

  • 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'])
    class_metrics_df
    
    class_val proportion_of_landscape edge_density
    1 7.702 4.459
    2 92.298 4.459
  • Analyze the spatio-temporal evolution of landscapes:

    input_fnames = [
        'data/vaud_g100_clc00_V18_5.tif',
        'data/vaud_g100_clc06_V18_5a.tif',
        'data/vaud_g100_clc12_V18_5a.tif'
    ]
    
    sta = pls.SpatioTemporalAnalysis(
        input_fnames, metrics=[
            'proportion_of_landscape',
            'edge_density',
            'fractal_dimension_am',
            'landscape_shape_index',
            'shannon_diversity_index'
        ], classes=[1], dates=[2000, 2006, 2012], 
    )
    
    fig, axes = plt.subplots(1, 3, figsize=(15, 5))
    for metric, ax in zip(
        ['proportion_of_landscape', 'edge_density', 'fractal_dimension_am'], axes):
        sta.plot_metric(metric, class_val=1, ax=ax)
    fig.suptitle('Class-level metrics (urban)')
    

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

Metadata

Release files for pylandstats 2.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylandstats 2.3.0
File Size Uploaded Provenance Actions
pylandstats-2.3.0.tar.gz 49.5 kB Without provenance Details for pylandstats-2.3.0.tar.gz

Release files / pylandstats-2.3.0.tar.gz

Download URL pylandstats-2.3.0.tar.gz
Size 49.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0fd2b54a7b8eda3e7bb5fe5ebd0f16e73d8c037228c7c1b0811ed905d1a61e96
BLAKE2b-256 checksum
How to use checksums
f026b914ce124013d659491c76744e5c290262087205c514316bffafb63998c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.13

Security for pylandstats 2.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.3.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page