PyLandStats
Overview
Open-source Pythonic library to compute landscape metrics within the PyData stack (NumPy, pandas, matplotlib...)
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)
Compute pandas DataFrames of landscape metrics at the patch, class and landscape level
patch_metrics_df = ls.compute_patch_metrics_df()
patch_metrics_df.head()
| patch_id | class_val | area | perimeter | perimeter_area_ratio | shape_index | fractal_dimension |
|---|---|---|---|---|---|---|
| 0 | 1 | 115 | 10600 | 92.17 | 2.409 | 1.130 |
| 1 | 1 | 13 | 2600 | 200.00 | 1.625 | 1.100 |
| 2 | 1 | 2 | 600 | 300.00 | 1.000 | 1.012 |
| 3 | 1 | 69 | 6000 | 86.96 | 1.765 | 1.088 |
| 4 | 1 | 76 | 8800 | 115.79 | 2.444 | 1.137 |
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 |
Also analyze the spatio-temporal evolution of the landscape:
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 = sta.plot_metrics(
class_val=1,
metrics=['proportion_of_landscape', 'edge_density', 'fractal_dimension_am'],
num_cols=3)
fig.suptitle('Class-level metrics (urban)')
See the pylandstats-notebooks repository for a more complete overview
Installation
To install use pip:
$ pip install pylandstats
Or clone the repo:
$ git clone https://github.com/martibosch/pylandstats.git
$ python setup.py install
Metadata
Release files for pylandstats 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pylandstats-0.3.0.tar.gz | 20.8 kB | Without provenance | Details for pylandstats-0.3.0.tar.gz |
Release files / pylandstats-0.3.0.tar.gz
| Download URL | pylandstats-0.3.0.tar.gz |
|---|---|
| Size | 20.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47dcdba83ed4a07664123a7c8150af4db625ffd4e2dbf6b0dd2fad4b19020b81
|
|
BLAKE2b-256 checksum How to use checksums |
c8b2cf2b8d5178c774ae0ea0d261d0071a1307977f21f99fc287d2bb5a0a3d81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
|
Security for pylandstats 0.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.