Skip to main content

PyPI version fury.io Build Status Coverage Status GitHub license Binder

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)

landscape-vaud

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 euclidean_nearest_neighbor
0 1 115 10600 92.17 2.409 1.130 1431.782
1 1 13 2600 200.00 1.625 1.100 223.607
2 1 2 600 300.00 1.000 1.012 223.607
3 1 69 6000 86.96 1.765 1.088 316.228
4 1 76 8800 115.79 2.444 1.137 316.228
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)')

spatiotemporal-analysis

See the pylandstats-notebooks repository for a more complete overview

Installation

To install use pip:

$ pip install pylandstats

If you want to use the BufferAnalysis, you will need geopandas. The easiest to install it is via conda-forge as in:

$ conda install -c conda-forge geopandas

and then install PyLandStats with the geo extras as in:

$ pip install pylandstats[geo]

Release files for pylandstats 0.4.1

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 0.4.1
File Size Uploaded
pylandstats-0.4.1.tar.gz 22.2 kB Details

Release files / pylandstats-0.4.1.tar.gz

Download URL pylandstats-0.4.1.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8c24fb1af883bd9f837db944f5b3daa7ce7fff3575dbc57a67fc0bf111466b6b
BLAKE2b-256 checksum
How to use checksums
072d6e83424397db00e21e5d3a05317a5af35bdb02ee53599dc0c39dffc8224b
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

Release history Release notifications | RSS feed

3.1.0

31 release files

3.0.3

31 release files

3.0.2

21 release files

3.0.1

17 release files

3.0.0

17 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.0

1 release file

2.2.1

1 release file

2.2.0

1 release file

2.1.3

1 release file

2.1.2

1 release file

2.1.1

1 release file

2.1.0

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.0

1 release file

This release

0.4.1 This release

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.1

2 release files

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