onstove.OnStove#

class onstove.OnStove(project_crs: pyproj.CRS | int | None = None, cell_size: float = None, output_directory: str = 'output')#

The OnStove class is used to perform a geospatial cost-benefit analysis on clean cooking access.

OnStove determines the net-benefits of cooking with different stoves across an area with regards to capital, fuel, and operation and maintenance costs, as well as benefits from reduced morbidity, reduced mortality, time saved and emissions avoided. The model identifies the stove that can provide cooking in each settlement achieving the highest net-benefit.

Note

The OnStove class inherits all functionalities from the DataProcessor class.

Parameters:
project_crs: pyproj.CRS or int, optional

See the DataProcessor class for details.

cell_size: float, optional

See the DataProcessor class for details.

output_directory: str, default ‘output’

A folder path where to save the output datasets.

Attributes:
rows
cols
specs
techs
base_fuel
energy_per_meal
gwp
clean_cooking_access_u
clean_cooking_access_r
electrified_weight

Spatial weighted average factor used to calibrate the current electrified population.

Methods

add_layer(category, name, path, layer_type)

Adds a new layer (type VectorLayer or RasterLayer) to the MCA class

add_mask_layer(category, name, path[, ...])

Adds a vector layer to self.mask_layer, which will be used to mask all other layers into is boundaries

align_layers([datasets])

Ensures that the coordinate system and resolution of the raster is the same as the base layer

calibrate_current_pop()

Calibrates the spatial population in each cell according to the user defined population in the start year (Population_start_year in the specs dictionary) and saves it in the Calibrated_pop column of the main GeoDataFrame (gdf).

calibrate_urban_manual()

Calibrates the urban rural split based on population density.

calibrate_urban_rural_split(GHS_path)

Calibrates the urban rural split using spatial data from the GHS SMOD dataset.

current_elec()

Calculates a binary variable that defines which settlements are at least partially electrified.

distance_to_electricity([hv_lines, ...])

Calculates the distance to electricity infrastructure.

extract_emissions_costs_saved()

Extracts the economic value of the emissions by adopt each stove type across the study area.

extract_fuel_costs()

Extracts the total fuel costs needed in order to adopt each stove type across the study area.

extract_health_costs_saved()

Extracts the healh costs avoded from adopting each stove type selected across the study area.

extract_investment_costs()

Extracts the total investment costs needed in order to adopt each stove type across the study area.

extract_lives_saved()

Extracts the number of deaths avoided from adopting each stove type selected across the study area and saves the data in the deaths_avoided column of the gdf.

extract_om_costs()

Extracts the total operation and maintenance costs needed in order to adopt each stove type across the study area.

extract_opportunity_cost()

Extracts the opportunity cost of adopting each stove type selected across the study area.

extract_reduced_emissions()

Extracts the reduced emissions achieved by adopting each stove type selected across the study area.

extract_salvage()

Extracts the total salvage costs in order to adopt each stove type across the study area.

extract_time_saved()

Extracts the total time saved from adopting each stove type selected across the study area.

final_elec()

Calibrates the electrified population within each cell.

get_clean_cooking_access()

Calculates the clean cooking access in rural and urban settlements.

get_distance_rasters([datasets])

Goes through all layer and call their .distance_raster method

get_value_of_time()

Calculates the value of time based on the minimum wage ($/h) and a spatial representation of wealth.

mask_layers([datasets])

Uses the a mask layer in self.mask_layer to mask all other layers to its boundaries.

maximum_net_benefit(techs[, restriction])

Extracts the technology or technology combinations producing the highest net-benefit in each cell.

normalize(column[, inverse])

Uses the MinMax method to normalize the data from a column of the gdf GeoDataFrame.

normalize_rasters([datasets, buffer])

Goes through all layer and call their .normalize method

number_of_households()

Calculates the number of households withing each cell based on their urban/rural classification and a defined household size.

population_to_dataframe([layer])

Takes a population RasterLayer as input and extracts the populated points to the main GeoDataFrame saved in the gdf attribute.

raster_to_dataframe(layer[, name, method, ...])

Takes a RasterLayer and a method (sample or read) and extracts the values from the raster layer to the main GeoDataFrame (gdf).

read_model(path)

Reads a model from a pickle

read_scenario_data(path_to_config[, delimiter])

Reads the scenario data into a dictionary

read_tech_data(path_to_config[, delimiter])

Reads the technology data from a csv file into a dictionary

reproject_layers([datasets])

Reprojects the layers specified by the user.

run([technologies, restriction])

Runs the model using the defined technologies as options to cook with.

save_datasets([datasets])

Saves all layers that have not been previously saved

set_base_fuel([techs])

Defines the base fuel properties according to the technologies tagged as is_base = True or a list of technologies as input.

set_postgres(dbname, user, password)

Wrapper function to set a connection to a PostgreSQL database using the psycopg2.connect class.

summary([total, pretty, labels])

techshare_sumtoone()

This function checks if the sum of shares in the technology dictionary is 1.0.

to_pickle(name)

Saves the model as a pickle.

create_layer

extract_wealth_index

gdf_to_csv

plot

plot_benefit_distribution

plot_costs_benefits

plot_split

to_image

to_raster