onstove.OnStove#
- class onstove.OnStove(project_crs: pyproj.CRS | int | None = None, cell_size: float = None, output_directory: str = 'output')#
The
OnStoveclass 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
OnStoveclass inherits all functionalities from theDataProcessorclass.- Parameters:
- project_crs: pyproj.CRS or int, optional
See the
DataProcessorclass for details.- cell_size: float, optional
See the
DataProcessorclass 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_weightSpatial 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
Calibrates the spatial population in each cell according to the user defined population in the start year (
Population_start_yearin thespecsdictionary) and saves it in theCalibrated_popcolumn of the main GeoDataFrame (gdf).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.
Calculates a binary variable that defines which settlements are at least partially electrified.
distance_to_electricity([hv_lines, ...])Calculates the distance to electricity infrastructure.
Extracts the economic value of the emissions by adopt each stove type across the study area.
Extracts the total fuel costs needed in order to adopt each stove type across the study area.
Extracts the healh costs avoded from adopting each stove type selected across the study area.
Extracts the total investment costs needed in order to adopt each stove type across the study area.
Extracts the number of deaths avoided from adopting each stove type selected across the study area and saves the data in the
deaths_avoidedcolumn of thegdf.Extracts the total operation and maintenance costs needed in order to adopt each stove type across the study area.
Extracts the opportunity cost of adopting each stove type selected across the study area.
Extracts the reduced emissions achieved by adopting each stove type selected across the study area.
Extracts the total salvage costs in order to adopt each stove type across the study area.
Extracts the total time saved from adopting each stove type selected across the study area.
Calibrates the electrified population within each cell.
Calculates the clean cooking access in rural and urban settlements.
get_distance_rasters([datasets])Goes through all layer and call their .distance_raster method
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_layerto 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
gdfGeoDataFrame.normalize_rasters([datasets, buffer])Goes through all layer and call their .normalize method
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
gdfattribute.raster_to_dataframe(layer[, name, method, ...])Takes a
RasterLayerand a method (sampleorread) 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
technologiesas 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])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