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 | None) – A short name for the land suitability analysis. The default is None. If provided, it will be stored as an attribute.

  • long_name (str | None) – A long name for the land suitability analysis. The default is None. If provided, it will be stored as an attribute.

  • description (str | None) – A description for the land suitability analysis. The default is None. If provided, it will be stored as an attribute.

  • comment (str | None) – Additional information about the land suitability analysis. The default is None. If provided, it will be stored as an attribute.

  • attrs (Mapping[Any, Any] | None) – 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
>>> import lsapy.standardize as lstd
>>> 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=lstd.discrete,
...         fparams={"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=lstd.vetharaniam2022_eq5,
...         fparams={"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

attrs

Dictionary of the Land Suitability Analysis attributes.

category

List of categories defined in the suitability criteria.

criteria

Dictionary of the suitability criteria.

criteria_by_category

Dictionary of criteria names grouped by category.

data

Dataset containing the computed suitability.

land_use

Name of the land use.

weights_by_category

Dictionary of total weights grouped by category.