A Python wrapper for Fragstats.
Project description
Python Wrapper for Fragstats
FragStatsPy a wrapper to Fragstats that allows for automated model setup and execution. While Fragstats currently provides a command-line tool for model execution, it does not provide command-line tools for model setup. FragStatsPy begins to fill that gap by providing functions to generate and manipulate Fragstats models from within Python.
Current functionality includes
- Model database generation
- Loading landscape layers
- Setting the output base path
- Defining a sampling strategy
- Linking user-defined tiles
- A general purpose SQL editor to allow for complete model manipulation (for savvy users)
- Access to the Fragstats native run commands (command-line)
Example Code
The code below will setup and run a Fragstats model to calculate the mean and standard deviation of patch sizes per user-defined region.
import src.frag_model as fspy
model = fspy.FragModel('model_py.fca')
model.set_output_base_path('model_outputs')
model.load_landscape_layer("geomorphic_patches.tif")
model.set_user_provided_tiles("regions.tif")
model.set_sampling_strategy(strategy='user_tiles', landscape=True)
model.toggle_metric(level='l', metric='AREA', stat='MN', on=True)
model.toggle_metric(level='l', metric='AREA', stat='SD', on=True)
model.run_model()
results = model.get_results()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
FragStatsPy-0.0.1.tar.gz
(5.0 kB
view hashes)
Built Distribution
Close
Hashes for FragStatsPy-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45ddd4ae6c181b786a57a8f7e6b8c4824b0612a57f495ccf0778365a38be1b19 |
|
MD5 | 0f7978306b9885f5fce37009888f55cb |
|
BLAKE2b-256 | 59e348735579a7ba480adb24640e93b8cb495a083aa177f74f54ccaf32cd6cfb |