oasislmf.pytools.gulmc.aggregate

This file contains specific functionality needed for aggregate vulnerabilities.

Attributes

Functions

gen_empty_agg_vuln_to_vuln_ids()

Generate empty map to store the definitions of aggregate vulnerability functions.

gen_empty_areaperil_vuln_ids_to_weights()

Generate empty map to store the weights of individual vulnerability functions in each aggregate vulnerability.

read_aggregate_vulnerability(storage[, ignore_file_type])

Load the aggregate vulnerability definitions from file.

read_vulnerability_weights(storage[, ignore_file_type])

Load the vulnerability weights definitions from file.

process_aggregate_vulnerability(aggregate_vulnerability)

Rearrange aggregate vulnerability definitions from tabular format to a map between aggregate

process_vulnerability_weights(aggregate_weights, ...)

Rearrange vulnerability weights from tabular format to a map between (areaperil_id, vulnerability_id) and the vulnerability weight.

map_agg_vuln_ids_to_agg_vuln_idxs(agg_vulns, ...)

For each aggregate vulnerability listed in agg_vulns, map the individual vulnerability_ids that compose it

map_areaperil_vuln_id_to_weight_to_areaperil_vuln_idx_to_weight(...)

Make map between aggregate vulnerability id and the list of sub-vulnerability ids of which they are composed, where the

Module Contents

oasislmf.pytools.gulmc.aggregate.logger[source]
oasislmf.pytools.gulmc.aggregate.AGG_VULN_WEIGHTS_KEY_TYPE[source]
oasislmf.pytools.gulmc.aggregate.AGG_VULN_WEIGHTS_VAL_TYPE[source]
oasislmf.pytools.gulmc.aggregate.AggregateVulnerability[source]
oasislmf.pytools.gulmc.aggregate.VulnerabilityWeight[source]
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_ids_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(aggregate_weights, agg_vuln_to_vuln_id)[source]

Rearrange vulnerability weights from tabular format to a map between (areaperil_id, vulnerability_id) and the vulnerability weight.

Args:

aggregate_weights (np.array[VulnerabilityWeight]): vulnerability weights table. agg_vuln_to_vuln_id (dict[int, list[int]]): map of aggregate vulnerability id to list of vulnerability ids.

Returns:

dict[AGG_VULN_WEIGHTS_KEY_TYPE, AGG_VULN_WEIGHTS_VAL_TYPE]: map of areaperil_id, vulnerability id to weight.

oasislmf.pytools.gulmc.aggregate.map_agg_vuln_ids_to_agg_vuln_idxs(agg_vulns, agg_vuln_to_vuln_id, vuln_dict)[source]

For each aggregate vulnerability listed in agg_vulns, map the individual vulnerability_ids that compose it to the indices where they are stored in vuln_array.

Args:

agg_vulns (List[int32]) agg_vuln_to_vuln_id (dict[int, list[int]]): map of aggregate vulnerability id to list of vulnerability ids. vuln_dict (Tuple[Dict[int, int]): vulnerability dictionary.

Returns:
dict[int, list[int]]: map between aggregate vulnerability id and the list of indices where the individual vulnerability_ids

that compose it are stored in vuln_array.

oasislmf.pytools.gulmc.aggregate.map_areaperil_vuln_id_to_weight_to_areaperil_vuln_idx_to_weight(areaperil_to_vulns, areaperil_vuln_id_to_weight, vuln_dict)[source]

Make map between aggregate vulnerability id and the list of sub-vulnerability ids of which they are composed, where the value of the sub-vulnerability id is the internal pointer (i.e., the index, startinf from 0) to the dense array where they are stored, not the vulnerability id (which starts from 1).

Args:

areaperil_to_vulns (List[int32]) areaperil_vuln_id_to_weight (dict[AGG_VULN_WEIGHTS_KEY_TYPE, AGG_VULN_WEIGHTS_VAL_TYPE]): map of areaperil_id, vulnerability id to weight. vuln_dict (Tuple[Dict[int, int]): vulnerability dictionary.

Returns:
dict[AGG_VULN_WEIGHTS_KEY_TYPE, AGG_VULN_WEIGHTS_VAL_TYPE]: map between the areaperil id and the index where the vulnerability function

is stored in vuln_array and the vulnerability weight.