oasislmf.preparation.summaries¶
Functions¶
|
|
|
|
|
Create a DataFrame with linking information between Ktools OasisFiles |
|
Create a factorized col (summary ids) based on a list of oed column names |
|
Json file with list Available / Recommended columns for use in the summary reporting |
|
Writes a summary map file, used to build summarycalc xref files. |
|
Top level function for creating the summaryxref files from the manager.py |
|
Create exposure summary as dictionary of TIVs and number of locations |
|
Create exposure summary as dictionary of TIVs and number of locations |
Module Contents¶
- oasislmf.preparation.summaries.get_summary_mapping(inputs_df, oed_hierarchy, is_fm_summary=False)[source]¶
Create a DataFrame with linking information between Ktools OasisFiles And the Exposure data
- Parameters:
inputs_df (pandas.DataFrame) – datafame from gul_inputs.get_gul_input_items(..) / il_inputs.get_il_input_items(..)
is_fm_summary (bool) – Indicates whether an FM summary mapping is required
- Returns:
Subset of columns from gul_inputs_df / il_inputs_df
- Return type:
pandas.DataFrame
- oasislmf.preparation.summaries.merge_oed_to_mapping(summary_map_df, exposure_df, oed_column_join, oed_column_info)[source]¶
Create a factorized col (summary ids) based on a list of oed column names
:param :summary_map_df dataframe return from get_summary_mapping :type summary_map_df: pandas.DataFrame
- Parameters:
{‘Col_A’: 0, ‘Col_B’: 1, ‘Col_C’: 2}
- Returns:
New DataFrame of summary_map_df + exposure_df merged on exposure index
- Return type:
pandas.DataFrame
- oasislmf.preparation.summaries.write_summary_levels(exposure_df, accounts_df, exposure_data, target_dir)[source]¶
Json file with list Available / Recommended columns for use in the summary reporting
Available: Columns which exists in input files and has at least one non-zero / NaN value Recommended: Columns which are available + also in the list of useful groupings SUMMARY_LEVEL_LOC
- {
- ‘GUL’: {
- ‘available’: [‘AccNumber’,
‘LocNumber’, ‘istenant’, ‘buildingid’, ‘countrycode’, ‘latitude’, ‘longitude’, ‘streetaddress’, ‘postalcode’, ‘occupancycode’, ‘constructioncode’, ‘locperilscovered’, ‘BuildingTIV’, ‘ContentsTIV’, ‘BITIV’, ‘PortNumber’],
- ‘IL’: {
… etc …
}
}
- oasislmf.preparation.summaries.write_mapping_file(sum_inputs_df, target_dir, is_fm_summary=False)[source]¶
Writes a summary map file, used to build summarycalc xref files.
- oasislmf.preparation.summaries.generate_summaryxref_files(location_df, account_df, model_run_fp, analysis_settings, il=False, ri=False, rl=False, gul_item_stream=False, fmpy=False)[source]¶
Top level function for creating the summaryxref files from the manager.py
- Parameters:
model_run_fp (str) – Model run directory file path
analysis_settings (dict) – Model analysis settings file
il (bool) – Boolean to indicate the insured loss level mode - false if the source accounts file path not provided to Oasis files gen.
ri (bool) – Boolean to indicate the RI loss level mode - false if the source accounts file path not provided to Oasis files gen.
rl (bool) – Boolean to indicate the RL loss level mode - false if the source accounts file path not provided to Oasis files gen.
gul_items (bool) – Boolean to gul to use item_id instead of coverage_id
fmpy (bool) – Boolean to indicate whether fmpy python version will be used
- oasislmf.preparation.summaries.get_exposure_summary(exposure_df, keys_df, exposure_profile=get_default_exposure_profile())[source]¶
Create exposure summary as dictionary of TIVs and number of locations grouped by peril and validity respectively. returns a python dict().
- oasislmf.preparation.summaries.write_exposure_summary(target_dir, exposure_df, keys_fp, keys_errors_fp, exposure_profile)[source]¶
Create exposure summary as dictionary of TIVs and number of locations grouped by peril and validity respectively. Writes dictionary as json file to disk.
- Parameters:
- Returns:
Exposure summary file path
- Return type: