2.1.4. pelicun.db module

This module has classes and methods to manage databases used by pelicun.

Contents

convert_jsons_to_table(json_id_list, …)

save_to_standard_HDF(df, name, target_path)

Saves a DataFrame in a standard HDF format using h5py.

convert_json_files_to_HDF(data_source_dir, …)

Converts data from json files to a single HDF5 file

convert_Series_to_dict(comp_Series)

Converts data from a table to a json file

convert_P58_data_to_json(data_dir, target_dir)

Create JSON data files from publicly available P58 data.

create_HAZUS_EQ_json_files(data_dir, target_dir)

Create JSON data files from publicly available HAZUS data.

create_HAZUS_EQ_story_json_files(data_dir, …)

Create JSON data files from publicly available HAZUS data.

create_HAZUS_EQ_PGA_json_files(data_dir, …)

Create JSON data files from publicly available HAZUS data.

create_HAZUS_HU_json_files(data_dir, target_dir)

Create JSON data files from publicly available HAZUS data.

pelicun.db.dict_generator(indict, pre=None)[source]

Lists all branches of a tree defined by a dictionary.

The dictionary can have nested dictionaries and lists. When encountering a list, its elements are returned as separate branches with each element’s id created as a combination of the parent key and #i where i stands for the element number in the list.

This method can process a json file and break it up into independent branches.

pelicun.db.get_val_from_dict(indict, col)[source]

Gets the value from a branch of a dictionary.

The dictionary can have nested dictionaries and lists. When walking through lists, #i in the branch data identifies the ith element of the list.

This method can be used to travel branches of a dictionary previously defined by the dict_generator method above.

pelicun.db.save_to_standard_HDF(df, name, target_path, mode='w')[source]

Saves a DataFrame in a standard HDF format using h5py.

pelicun.db.convert_json_files_to_HDF(data_source_dir, DL_dir, db_name)[source]

Converts data from json files to a single HDF5 file

pelicun.db.convert_Series_to_dict(comp_Series)[source]

Converts data from a table to a json file

pelicun.db.convert_P58_data_to_json(data_dir, target_dir)[source]

Create JSON data files from publicly available P58 data.

FEMA P58 damage and loss information is publicly available in an Excel spreadsheet and also in a series of XML files as part of the PACT tool. Those files are copied to the resources folder in the pelicun repo. Here we collect the available information on Fragility Groups from those files and save the damage and loss data in the common SimCenter JSON format.

A large part of the Fragility Groups in FEMA P58 do not have complete damage and loss information available. These FGs are clearly marked with an incomplete flag in the JSON file and the ‘Undefined’ value highlights the missing pieces of information.

Parameters
data_dir: string

Path to the folder with the FEMA P58 Excel file and a ‘DL xml’ subfolder in it that contains the XML files.

target_dir: string

Path to the folder where the JSON files shall be saved.

pelicun.db.create_HAZUS_EQ_json_files(data_dir, target_dir)[source]

Create JSON data files from publicly available HAZUS data.

HAZUS damage and loss information is publicly available in the technical manuals. The relevant tables have been converted into a JSON input file (hazus_data_eq.json) that is stored in the ‘resources/HAZUS MH 2.1’ folder in the pelicun repo. Here we read that file (or a file of similar format) and produce damage and loss data for Fragility Groups in the common SimCenter JSON format.

HAZUS handles damage and losses at the assembly level differentiating only structural and two types of non-structural component assemblies. In this implementation we consider each of those assemblies a Fragility Group and describe their damage and its consequences in a FEMA P58-like framework but using the data from the HAZUS Technical Manual.

Parameters
data_dir: string

Path to the folder with the hazus_data_eq JSON file.

target_dir: string

Path to the folder where the results shall be saved. The population distribution file will be saved here, the DL JSON files will be saved to a ‘DL json’ subfolder.

pelicun.db.create_HAZUS_EQ_story_json_files(data_dir, target_dir)[source]

Create JSON data files from publicly available HAZUS data.

HAZUS damage and loss information is publicly available in the technical manuals. The relevant tables have been converted into a JSON input file (hazus_data_eq.json) that is stored in the ‘resources/HAZUS MH 2.1’ folder in the pelicun repo. Here we read that file (or a file of similar format) and produce damage and loss data for Fragility Groups in the common SimCenter JSON format.

HAZUS handles damage and losses at the assembly level differentiating only structural and two types of non-structural component assemblies. In this implementation we consider each of those assemblies a Fragility Group and describe their damage and its consequences in a FEMA P58-like framework but using the data from the HAZUS Technical Manual.

Parameters
data_dir: string

Path to the folder with the hazus_data_eq JSON file.

target_dir: string

Path to the folder where the results shall be saved. The population distribution file will be saved here, the DL JSON files will be saved to a ‘DL json’ subfolder.

pelicun.db.create_HAZUS_EQ_PGA_json_files(data_dir, target_dir)[source]

Create JSON data files from publicly available HAZUS data.

HAZUS damage and loss information is publicly available in the technical manuals. The relevant tables have been converted into a JSON input file (hazus_data_eq.json) that is stored in the ‘resources/HAZUS MH 2.1 earthquake PGA’ folder in the pelicun repo. Here we read that file (or a file of similar format) and produce damage and loss data for Fragility Groups in the common SimCenter JSON format.

HAZUS handles damage and losses at the assembly level. This method assumes that we use the fragility curves controlled by equivalent PGA from HAZUS. Those curves are only available for structural component assemblies. A Fragility Group is created for each of the structural configurations that describes their damage and its consequences in a FEMA P58-like framework but using the data from the HAZUS Technical Manual.

Parameters
data_dir: string

Path to the folder with the hazus_data_eq JSON file.

target_dir: string

Path to the folder where the results shall be saved. The population distribution file will be saved here, the DL JSON files will be saved to a ‘DL json’ subfolder.

pelicun.db.create_HAZUS_HU_json_files(data_dir, target_dir)[source]

Create JSON data files from publicly available HAZUS data.

HAZUS damage and loss information is publicly available in the technical manuals and the HAZUS software tool. The relevant data have been collected in a series of Excel files (e.g., hu_Wood.xlsx) that are stored in the ‘resources/HAZUS MH 2.1 hurricane’ folder in the pelicun repo. Here we read that file (or a file of similar format) and produce damage and loss data for Fragility Groups in the common SimCenter JSON format.

The HAZUS hurricane methodology handles damage and losses at the assembly level. In this implementation each building is represented by one Fragility Group that describes the damage states and their consequences in a FEMA P58-like framework but using the data from the HAZUS Technical Manual.

Note: HAZUS calculates lossess independently of damage using peak wind gust speed as a controlling variable. We fitted a model to the curves in HAZUS that assigns losses to each damage state and determines losses as a function of building damage. Results shall be in good agreement with those of HAZUS for the majority of building configurations. Exceptions and more details are provided in the … section of the documentation.

Parameters
data_dir: string

Path to the folder with the hazus_data_eq JSON file.

target_dir: string

Path to the folder where the results shall be saved. The population distribution file will be saved here, the DL JSON files will be saved to a ‘DL json’ subfolder.