onstove.MCA.get_index#
- MCA.get_index(datasets: dict[str, list[str]] = 'all', buffer: bool = False, name: str | None = None)[source]#
Computes a standard index based on the
datasets
provided.It calls the general
index()
method with the provideddatasets
, normalizes the results including or excluding areas defined by the buffer and returns aRasterLayer
with the computed data and thebase_layer
RasterLayer.meta
information.- Parameters:
- datasets: dictionary of ``category``-``list of layer names`` pairs, default ‘all’
Specifies which dataset(s) to use to compute the index.
datasets={'category_1': ['layer_1', 'layer_2'], 'category_2': [...]}
- buffer: str, default ``False``
Whether to buffer the areas outside the
RasterLayer.distance_limit
.- name: str, optional
Name used to create the
RasterLayer
- Returns:
RasterLayer
The weighted average of the
RasterLayer.normalized
datasets based on their definedRasterLayer.weight
Examples
Clean cooking potential index for Biomass ICS created for Nepal:
>>> nepal.layers['Electricity']['Existing infra'].inverse = False >>> nepal.layers['OnStove']['LPG_cost_mean'].inverse = False >>> nepal.layers['Biomass']['Traveltime'].inverse = True >>> nepal.layers['Demographics']['Wealth'].inverse = True >>> nepal.layers['Demographics']['Population'].inverse = False >>> nepal.layers['OnStove']['maximum_net_benefit_per_household'].inverse = False >>> nepal.layers['OnStove']['available_biogas_mean'].inverse = True ... >>> nepal.layers['Electricity']['Existing infra'].distance_limit = None >>> nepal.layers['OnStove']['LPG_cost_mean'].distance_limit = None >>> nepal.layers['Biomass']['Traveltime'].distance_limit = None >>> nepal.layers['Demographics']['Wealth'].distance_limit = None >>> nepal.layers['Demographics']['Population'].distance_limit = None >>> nepal.layers['OnStove']['maximum_net_benefit_per_household'].distance_limit = None >>> nepal.layers['OnStove']['available_biogas_mean'].distance_limit = None ... >>> nepal.layers['Electricity']['Existing infra'].weight = 2.7 >>> nepal.layers['OnStove']['LPG_cost_mean'].weight = 3.3 >>> nepal.layers['Biomass']['Traveltime'].weight = 4.3 >>> nepal.layers['Demographics']['Wealth'].weight = 4.6 >>> nepal.layers['Demographics']['Population'].weight = 2 >>> nepal.layers['OnStove']['maximum_net_benefit_per_household'].weight = 4.1 >>> nepal.layers['OnStove']['available_biogas_mean'].weight = 3.3 ... >>> biomass_ics_index = nepal.get_index(datasets={'Demographics': ['Population', 'Wealth'], ... 'Electricity': ['Existing infra'], ... 'Biomass': ['Traveltime'], ... 'OnStove': ['LPG_cost_mean', ... 'maximum_net_benefit_per_household', ... 'available_biogas_mean']}, ... buffer=True, name='Biomass ICS T3')
Plotting this index produces the following output:
Biomass ICS clean cooking potential index created with OnStove