oasislmf.pytools.gulmc.items ============================ .. py:module:: oasislmf.pytools.gulmc.items .. autoapi-nested-parse:: This file contains specific functionality to read and process items files. Attributes ---------- .. autoapisummary:: oasislmf.pytools.gulmc.items.logger Functions --------- .. autoapisummary:: oasislmf.pytools.gulmc.items.read_items oasislmf.pytools.gulmc.items.generate_item_map oasislmf.pytools.gulmc.items.process_items Module Contents --------------- .. py:data:: logger .. py:function:: read_items(input_path, ignore_file_type=set(), dynamic_footprint=False, legacy=False) Load the items from the items file. Args: input_path (str): the path pointing to the file ignore_file_type (Set[str]): file extension to ignore when loading. Returns: Tuple[Dict[int, int], List[int], Dict[int, int], List[Tuple[int, int]], List[int]] vulnerability dictionary, vulnerability IDs, areaperil to vulnerability index dictionary, areaperil ID to vulnerability index array, areaperil ID to vulnerability array .. py:function:: generate_item_map(items, coverages) Generate item_map; requires items to be sorted. Args: items (numpy.ndarray[int32, int32, int32]): 1-d structured array storing `item_id`, `coverage_id`, `group_id` for all items. items need to be sorted by increasing areaperil_id, vulnerability_id in order to output the items in correct order. Returns: item_map (Dict[ITEM_MAP_KEY_TYPE, ITEM_MAP_VALUE_TYPE]): dict storing the mapping between areaperil_id, vulnerability_id to item. areaperil_ids_map (Dict[int, Dict[int, int]]) dict storing the mapping between each areaperil_id and all the vulnerability ids associated with it. .. py:function:: process_items(items, valid_area_peril_id, agg_vuln_to_vulns=None) Processes the Items loaded from the file extracting meta data around the vulnerability data. Args: items: (List[Item]) Data loaded from the vulnerability file valid_area_peril_id: array of area_peril_id to be included (if none, all are included). agg_vuln_to_vulns (dict[tuple[areaperil_int, int], int]): dict with aggregate vulnerability definitions. Returns: (Tuple[Dict[int, int], Dict[int, int], np.array[int], np.array[int], dict[int, dict[int, int]], List[int]) vulnerability dictionary, areaperil to vulnerability index dictionary, areaperil to vulnerability index array, vuln id to vuln idx for each vulnerability in each areaperil, list of all used vulnerability ids.