Expand input tables

Functions

_combine_parameter_invoer_sources(tables)

Combineert de geo-gerefereerde parameter invoer met de handmatige invoer die oorspronkelijk uit de Excel kwam.

_gather_hrd_frag_line_from_geopackage(ref, ...)

_gather_other_freq_line(ref, tables)

Gather a freq line that is not from the HRD-database, and not from a .csv-file. It originates from the Excel,

_gather_frag_line_from_csv(csv_file_name, ...)

_collect_fragility_values(tables, fragility_refs, ...)

Collects the fragility values from the different sources. The sources are (a) the HRD-file, (b) the Excel input

_add_fragility_values_to_combined_parameter_invoer(...)

Haalt uit de fragility values Excel de arrays op en vervang in de df_parameter_invoer_combined de referentie

_collect_right_columns_combined_parameter_invoer(...)

Parameter tabel omzetten naar juiste kolommen. Enkel per uittredepunt, scenario en parameter de

_construct_df_identifiers(geopackage_filepath, tables)

Create identifiers table.

_gather_required_input_parameters(geopackage_filepath)

_expand(df_parameter_invoer_combined, df_identifiers, ...)

_concat_collection(collection)

run_expand_input_tables(geopackage_filepath[, ...])

Performs logic to expand all parameter input from different levels to input on uittredepunt-level.

Module Contents

_combine_parameter_invoer_sources(tables)

Combineert de geo-gerefereerde parameter invoer met de handmatige invoer die oorspronkelijk uit de Excel kwam. Zodoende kan vanuit één dataframe de invoer geëxplodeerd worden naar invoer per uittredepunt.

Parameters:

tables (Inputparametertables)

Return type:

pandas.DataFrame

_gather_hrd_frag_line_from_geopackage(ref, geopackage_filepath)
Parameters:
  • ref (str)

  • geopackage_filepath (str)

_gather_other_freq_line(ref, tables)

Gather a freq line that is not from the HRD-database, and not from a .csv-file. It originates from the Excel, either directly from the Excel, or imported into the ‘fragility_values_invoer_hrd’-database table.

Parameters:
Returns:

_gather_frag_line_from_csv(csv_file_name, geopackage_filepath)
Parameters:
  • csv_file_name (str)

  • geopackage_filepath (str)

_collect_fragility_values(tables, fragility_refs, geopackage_filepath)

Collects the fragility values from the different sources. The sources are (a) the HRD-file, (b) the Excel input file, and (c) the csv folder.

Parameters:
Returns:

Returns a dataframe with columns fragility_values_ref and fragility_values.

Return type:

pandas.DataFrame

_add_fragility_values_to_combined_parameter_invoer(df_parameter_invoer_combined, tables, geopackage_filepath, drop_ref=True)

Haalt uit de fragility values Excel de arrays op en vervang in de df_parameter_invoer_combined de referentie met de daadwerkelijke fragility values.

Parameters:
  • df_parameter_invoer_combined (pandas.DataFrame)

  • tables (Inputparametertables)

  • geopackage_filepath (str)

  • drop_ref (bool)

Return type:

pandas.DataFrame

_collect_right_columns_combined_parameter_invoer(df_parameter_invoer_combined)

Parameter tabel omzetten naar juiste kolommen. Enkel per uittredepunt, scenario en parameter de parameterinvoer.

Parameters:

df_parameter_invoer_combined (pandas.DataFrame)

Return type:

pandas.DataFrame

_construct_df_identifiers(geopackage_filepath, tables)

Create identifiers table.

The identifiers table is a table with unique rows (unique uittredepunt, vak and scenario combo). It is used as a base to explode to input per scenario and uittredepunt.

Parameters:
_gather_required_input_parameters(geopackage_filepath)
Parameters:

geopackage_filepath (str)

Return type:

List[str]

_expand(df_parameter_invoer_combined, df_identifiers, geopackage_filepath)
Parameters:
  • df_parameter_invoer_combined (pandas.DataFrame)

  • df_identifiers (pandas.DataFrame)

  • geopackage_filepath (str)

Return type:

Dict[str, pandas.DataFrame]

_concat_collection(collection)
Parameters:

collection (Dict[str, pandas.DataFrame])

run_expand_input_tables(geopackage_filepath, add_frag_ref=False, tables=None)

Performs logic to expand all parameter input from different levels to input on uittredepunt-level.

Parameters:
  • geopackage_filepath (str)

  • add_frag_ref (bool) – Indien True, dan wordt voor parameter input met een distribution_type ‘cdf_curve’ de referentie naar de invoer behouden. Deze is niet nodig voor de berekeningen, maar wordt wel gebruikt voor de visualisaties.

  • tables (Optional[Inputparametertables])

Returns:

DataFrame with columns parameter_name, vak_id, uittredepunt_id, ondergrondscenario_naam and parameter_input.

Return type:

pandas.DataFrame