curve_data.create_vuln_xml
¶
This is a script to convert curve info in other formats to NRML, v0.5.
It is being modified on a needs basis.
Module Contents¶
Functions¶
|
Add a variable name and value to an xml file. |
|
Write the top section of an nrml file. |
|
Write the curve info of an nrml file. |
|
Write the final section of an nrml file and close it. |
|
Read in a csv hazard curve file and convert it to an NRML file. |
|
Check that the titles and the water depths do not change |
Check that the depth values are the same for all workbooks. |
|
|
Read in the excel file info. Specific, undocumented format. |
Read an excel worksheet |
|
|
Read in an excel flood curve file and convert it to an NRML file. |
Attributes¶
- curve_data.create_vuln_xml.FLOOD_HOUSE_FABRIC = structural_domestic_flood_2012¶
- curve_data.create_vuln_xml.FLOOD_HOUSE_CONTENTS = contents_domestic_flood_2012¶
- curve_data.create_vuln_xml.LOSS_CAT_FABRIC = structural_loss_ratio¶
- curve_data.create_vuln_xml.LOSS_CAT_CONTENTS = contents_loss_ratio¶
- curve_data.create_vuln_xml.FLOOD_IMT = water depth above ground floor (m)¶
- curve_data.create_vuln_xml.xml_write_variable(xml_h, name, value)¶
Add a variable name and value to an xml file.
- Parameters:
xml_h – A handle to the xml file.
name – The name of the variable.
value – The value of the variable.
- curve_data.create_vuln_xml.write_nrml_top(xml_h, vulnerability_set_id, asset_category, loss_category)¶
Write the top section of an nrml file.
- Parameters:
xml_h – A handle to the xml file.
vulnerability_set_id – String name of the vulnerability set.
asset_category – String name of the assert category.
loss_category – String name of the loss category.
imt – String name of the intensity measure type.
imls – 1D vector of the intensity measure values (x-axis) of the vuln curve.
- curve_data.create_vuln_xml.write_nrml_curve(xml_h, vulnerability_function_id, imls: list, imt: str, loss_ratio, coef_var)¶
Write the curve info of an nrml file.
- Parameters:
xml_h – A handle to the xml file.
vulnerability_function_id – String name of the vuln function.
imls – 1D vector of the intensity measure values (x-axis) of the vuln curve.
imt – intensity measure type
loss_ratio – 1D vector of the loss ratio values (y-axis) of the vuln curve.
coef_var – 1D vector of the coefficient of variation values (y-axis) of the vuln curve.
- curve_data.create_vuln_xml.write_nrml_close(xml_h)¶
Write the final section of an nrml file and close it.
- Parameters:
xml_h – A handle to the xml file.
- curve_data.create_vuln_xml.csv_curve2nrml(csv_filename, xml_filename)¶
Read in a csv hazard curve file and convert it to an NRML file.
- Parameters:
csv_filename – The csv file to be read.
xml_filename – The NRML file to be written.
- curve_data.create_vuln_xml.validate_excel_curve_data(excel_file)¶
Check that the titles and the water depths do not change from sheet to sheet. The first 2 rows are titles. The first coulmn is the water depth.
- Parameters:
excel_file – The excel file to validate.
- curve_data.create_vuln_xml.check_identical_depths(wb)¶
Check that the depth values are the same for all workbooks. Check that the first colum, starting at the 4th row, is identical.
- Parameters:
wb – The excel workbook xlrd object.
- curve_data.create_vuln_xml.read_excel_curve_data(excel_file)¶
Read in the excel file info. Specific, undocumented format.
- Parameters:
excel_file – The excel workbook.
- curve_data.create_vuln_xml.read_excel_worksheet(wb)¶
Read an excel worksheet
- Parameters:
wb – The excel workbook xlrd object.
- curve_data.create_vuln_xml.excel_curve2nrml(contents_filename, fabric_filename, xls_filename)¶
Read in an excel flood curve file and convert it to an NRML file.
The excel file format is specific and best understood by looking at the file flood_2012_test.xlsx.
- Parameters:
contents_filename – The contents NRML file to be created.
fabric_filename – The fabric NRML file to be created.
xls_filename – The excel file that is the basis of the NRML files.
- curve_data.create_vuln_xml.parser¶