PyLandslide.sensitivity.SensitivityEstimator

class PyLandslide.sensitivity.SensitivityEstimator(json_file, trials=5, *args, **kwargs)[source]

This class includes methods for performing sensitivity analyses based on the output CSV file of the weight range analysis plus generating and comparing landslide susceptibility raster layers.

__init__(json_file, trials=5, *args, **kwargs)[source]

Initialise a new SensitivityEstimator object.

Args:

json_file: JSON-based document specifying the configuration information for performing weight range calculation.

trials: the number of desired sensitivity trials (or iterations).

Methods

__init__(json_file[, trials])

Initialise a new SensitivityEstimator object.

check_class_upper_and_lower_bounds(upper, lower)

Takes a lists the upper and lower bounds of susceptibility classes and checks that all lower bounds are lower than the upper bounds.

compare(layer1, layer2)

Compares two susceptibility raster layers by calculating the percentage area within each susceptibility class and generating a raster layer of layer1 minus layer2.

create_results_dict()

Creates a dictionary for saving the results of the execute() method.

execute()

Performs a sensitivity analysis based on the weights CSV file and specified in the JSON-based document and the number of trials and creates a CSV file in the outputs folder containing the sensitivity results.

factor_data_preperation(factors)

Takes a list of dictionaries that include factor names and their associated raster files and returns lists of factor keys, names, files, geo profiles, and datasets.

generate(index, csv_sensitivity)

Generates a susceptibility raster layer using the generate_layer method, an input sensitivity CSV file, and the index of the desired trial for raster generation.

generate_layer(factor_weights, suffix)

Overlays the factor layers based on a set of weights and writes a resulting raster layer into teh output directory specified in the JSON-based document.

generate_random_weights(input_pd_table, ...)

Selects a random set of weights from the weight range CSV file.

load_data_from_json()

Loads the configuration JSON-based document assigned to self.json_file.

load_weight_csv_sensitivity_file(sens_csv)

Loads the weight range CSV file into a Pandas dataframe and returns the dataframe and its number of rows.

number_of_pixels_in_susceptibility_classes(...)

Takes a raster as an array and computes the percentage of pixels within each susceptibility class as specified in the JSON-based document and returns a list of the percentages.

overlay_factors(factor_weights)

Overlays the factor layers based on their weights and returns a list of the percentage areas within each susceptibility class.

setup()

Calls the load_data_from_json method to extract the information provided in the JSON-based document.

susceptibility_classes_data_preperation(...)

Takes a list of dictionaries that include susceptibility class names and their ranges and returns lists of class names, lower bounds, and upper bounds.