oasislmf.preparation.gul_inputs

Functions

get_gul_input_items(location_df, keys_df[, ...])

Generates and returns a Pandas dataframe of GUL input items.

write_gul_input_files(gul_inputs_df, target_dir, ...)

Writes the standard Oasis GUL input files to a target directory, using a

Module Contents

oasislmf.preparation.gul_inputs.get_gul_input_items(location_df, keys_df, correlations=False, peril_correlation_group_df=None, exposure_profile=get_default_exposure_profile(), damage_group_id_cols=None, hazard_group_id_cols=None, do_disaggregation=True)[source]

Generates and returns a Pandas dataframe of GUL input items.

Parameters:
  • exposure_df (pandas.DataFrame) – Exposure dataframe

  • keys_df (pandas.DataFrame) – Keys dataframe

  • output_dir (str) – the output directory where input files are stored

  • exposure_profile (dict) – Exposure profile

  • damage_group_id_cols (list[str]) – Columns to be used to generate a hashed damage group id.

  • hazard_group_id_cols (list[str]) – Columns to be used to generate a hashed hazard group id.

  • do_disaggregation (bool) – If True, disaggregates by the number of buildings

Returns:

GUL inputs dataframe

Return type:

pandas.DataFrame

oasislmf.preparation.gul_inputs.write_gul_input_files(gul_inputs_df, target_dir, correlations_df, output_dir, oasis_files_prefixes=OASIS_FILES_PREFIXES['gul'], chunksize=2 * 10**5)[source]

Writes the standard Oasis GUL input files to a target directory, using a pre-generated dataframe of GUL input items. The files written are

items.csv
coverages.csv

and optionally a complex items file in case of a complex/custom model.

Parameters:
  • gul_inputs_df (pandas.DataFrame) – GUL inputs dataframe

  • target_dir (str) – Target directory in which to write the files

  • oasis_files_prefixes – Oasis GUL input file name prefixes

  • oasis_files_prefixes – dict

  • chunksize (int) – The chunk size to use when writing out the input files

Returns:

GUL input files dict

Return type:

dict