oasislmf.preparation.gul_inputs

Functions

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

Generates and returns a Pandas dataframe of GUL input items.

write_complex_items_file(gul_inputs_df, complex_items_fp)

Writes a complex model items file.

write_sections_file(gul_inputs_df, sections_fp[, ...])

Writes a section id file based on the input location area perils.

write_amplifications_file(gul_inputs_df, amplifications_fp)

Writes an amplifications file. This is the mapping between item IDs and

write_items_file(gul_inputs_df, items_fp[, chunksize])

Writes an items file.

write_coverages_file(gul_inputs_df, coverages_fp[, ...])

Writes a coverages file.

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_complex_items_file(gul_inputs_df, complex_items_fp, chunksize=100000)[source]

Writes a complex model items file.

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

  • complex_items_fp (str) – Complex/custom model items file path

Returns:

Complex/custom model items file path

Return type:

str

oasislmf.preparation.gul_inputs.write_sections_file(gul_inputs_df, sections_fp, chunksize=100000)[source]

Writes a section id file based on the input location area perils.

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

  • dynamic_events_fp – events file path to output

oasislmf.preparation.gul_inputs.write_amplifications_file(gul_inputs_df, amplifications_fp, chunksize=100000)[source]

Writes an amplifications file. This is the mapping between item IDs and amplifications IDs.

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

  • amplifications_fp (str) – amplifications file path

Returns:

amplifications file path

Return type:

str

oasislmf.preparation.gul_inputs.write_items_file(gul_inputs_df, items_fp, chunksize=100000)[source]

Writes an items file.

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

  • items_fp (str) – Items file path

Returns:

Items file path

Return type:

str

oasislmf.preparation.gul_inputs.write_coverages_file(gul_inputs_df, coverages_fp, chunksize=100000)[source]

Writes a coverages file.

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

  • coverages_fp (str) – Coverages file path

Returns:

Coverages file path

Return type:

str

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