lsapy.LandSuitabilityAnalysis#
- class lsapy.LandSuitabilityAnalysis(land_use, criteria, short_name=None, long_name=None, description=None, comment=None, attrs=None)[source]#
Data structure to define and run land suitability analysis.
The land suitability analysis is defined by a set of suitability criteria that are combined to compute the suitability.
- Parameters:
land_use (str) – A name for the land use.
criteria (dict[str, SuitabilityCriteria]) – A dictionary of suitability criteria where the key is the name of the criteria.
short_name (str, optional) – A short name for the land suitability analysis. The default is None. If provided, it will be stored as an attribute.
long_name (str, optional) – A long name for the land suitability analysis. The default is None. If provided, it will be stored as an attribute.
description (str, optional) – A description for the land suitability analysis. The default is None. If provided, it will be stored as an attribute.
comment (str, optional) – Additional information about the land suitability analysis. The default is None. If provided, it will be stored as an attribute.
attrs (Mapping[Any, Any], optional) – Arbitrary metadata to store with the land suitability analysis, in addition to the attributes short_name, long_name, description, and comment. The default is None.
Examples
Let first define the
SuitabilityCriteria(we use xclim package for the GDD computation):>>> from lsapy.utils import open_data >>> from lsapy.functions import SuitabilityFunction >>> from xclim.indicators.atmos import growing_degree_days
>>> drainage = open_data("land", variables="drainage") >>> tas = open_data("climate", variables="tas") >>> sc = { ... "drainage_class": SuitabilityCriteria( ... name="drainage_class", ... long_name="Drainage Class Suitability", ... weight=3, ... category="soilTerrain", ... indicator=drainage, ... func=SuitabilityFunction(name="discrete", params={"rules": {0: 0, 1: 0.1, 2: 0.5, 3: 0.9, 4: 1}}), ... ), ... "growing_degree_days": SuitabilityCriteria( ... name="growing_degree_days", ... long_name="Growing Degree Days Suitability", ... weight=1, ... category="climate", ... indicator=growing_degree_days(tas, thresh="10 degC", freq="YS-JUL"), ... func=SuitabilityFunction(name="vetharaniam2022_eq5", params={"a": -1.41, "b": 801}), ... ), ... }
Now we can define the
LandSuitabilityAnalysis:>>> lsa = LandSuitabilityAnalysis( ... land_use="land_use", ... short_name="land_suitability_analysis", ... long_name="Land Suitability Analysis", ... criteria=sc, ... )
The land suitability analysis can now be run:
>>> lsa.run(inplace=True)
- __init__(land_use, criteria, short_name=None, long_name=None, description=None, comment=None, attrs=None)[source]#
Methods
__init__(land_use, criteria[, short_name, ...])run([suitability_type, agg_methods, ...])Run the land suitability analysis.
Attributes
attrsDictionary of the Land Suitability Analysis attributes.