oasislmf.pytools.gulmc.aggregate¶
This file contains specific functionality needed for aggregate vulnerabilities.
Attributes¶
Functions¶
Generate empty map to store the definitions of aggregate vulnerability functions. |
|
Generate empty map to store the weights of individual vulnerability functions in each aggregate vulnerability. |
|
|
Load the aggregate vulnerability definitions from file. |
|
Load the vulnerability weights definitions from file. |
|
Rearrange aggregate vulnerability definitions from tabular format to a map between aggregate |
Polpulate the useful (areaperil_id, vulnerability_i) in areaperil_vuln_i_to_weight with the weight from aggregate_weights |
Module Contents¶
- oasislmf.pytools.gulmc.aggregate.gen_empty_agg_vuln_to_vuln_ids()[source]¶
Generate empty map to store the definitions of aggregate vulnerability functions.
- Returns:
dict[int, list[int]]: map of aggregate vulnerability id to list of vulnerability ids.
- oasislmf.pytools.gulmc.aggregate.gen_empty_areaperil_vuln_idx_to_weights()[source]¶
Generate empty map to store the weights of individual vulnerability functions in each aggregate vulnerability.
- Returns:
dict[AGG_VULN_WEIGHTS_KEY_TYPE, AGG_VULN_WEIGHTS_VAL_TYPE]: map of areaperil_id, vulnerability id to weight.
- oasislmf.pytools.gulmc.aggregate.read_aggregate_vulnerability(storage: oasis_data_manager.filestore.backends.base.BaseStorage, ignore_file_type=set())[source]¶
Load the aggregate vulnerability definitions from file.
- Args:
storage: (BaseStorage) the storage manager for fetching model data ignore_file_type (Set[str]): file extension to ignore when loading.
- Returns:
np.array[AggregateVulnerability]: aggregate vulnerability table.
- oasislmf.pytools.gulmc.aggregate.read_vulnerability_weights(storage: oasis_data_manager.filestore.backends.base.BaseStorage, ignore_file_type=set())[source]¶
Load the vulnerability weights definitions from file.
- Args:
storage: (BaseStorage) the storage manager for fetching model data ignore_file_type (Set[str]): file extension to ignore when loading.
- Returns:
np.array[VulnerabilityWeight]: vulnerability weights table.
- oasislmf.pytools.gulmc.aggregate.process_aggregate_vulnerability(aggregate_vulnerability)[source]¶
Rearrange aggregate vulnerability definitions from tabular format to a map between aggregate vulnerability id and the list of vulnerability ids that it is made of.
- Args:
aggregate_vulnerability (np.array[AggregateVulnerability]): aggregate vulnerability table.
- Returns:
dict[int, list[int]]: map of aggregate vulnerability id to list of vulnerability ids.
- oasislmf.pytools.gulmc.aggregate.process_vulnerability_weights(areaperil_vuln_i_to_weight, vuln_dict, aggregate_weights)[source]¶
Polpulate the useful (areaperil_id, vulnerability_i) in areaperil_vuln_i_to_weight with the weight from aggregate_weights
- Args:
areaperil_vuln_i_to_weight: dict of useful (areaperil_id, vulnerability_i) to 0. (weight placeholder to be updated) vuln_dict: vuln_dict (Tuple[Dict[int, int]): vulnerability dictionary, vuln_id => vuln_i. aggregate_weights (np.array[VulnerabilityWeight]): vulnerability weights table.