Skip to content

Added loss type liquefaction #10051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion openquake/calculators/tests/scenario_damage_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from openquake.qa_tests_data.scenario_damage import (
case_1, case_1c, case_2, case_3, case_4, case_4b, case_5, case_5a,
case_6, case_7, case_8, case_9, case_10, case_11, case_12, case_13,
case_14, case_16, case_17, case_18, case_19, case_20)
case_14, case_16, case_17, case_18, case_19, case_20, case_21)
from openquake.calculators.tests import CalculatorTestCase, strip_calc_id
from openquake.calculators.extract import extract
from openquake.calculators.export import export
Expand Down Expand Up @@ -297,6 +297,13 @@ def test_case_20(self):
[fname] = out[('aggrisk', 'csv')]
self.assertEqualFiles('expected/aggrisk.csv', fname)

def test_case_21(self):
# infrastructure risk for structural and liquefaction loss types
out = self.run_calc(case_21.__file__, 'job.ini', exports='csv')
[agg_csv, aggparent_csv] = out[('aggrisk', 'csv')]
self.assertEqualFiles('expected/aggrisk.csv', agg_csv)
self.assertEqualFiles('expected/aggrisk-parent.csv', aggparent_csv)


def losses(aid, alt):
E = len(alt.event_id.unique())
Expand Down
2 changes: 2 additions & 0 deletions openquake/commonlib/oqvalidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,8 @@ class OqParam(valid.ParamSet):
'residents_vulnerability',
'area_vulnerability',
'number_vulnerability',
'liquefaction_fragility',
'liquefaction_vulnerability',
'post_loss_amplification',
}
# old name => new name
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#,,,,,,,,,"generated_by='OpenQuake engine 3.22.0-git4588b0bb77', start_date='2024-10-14T10:44:37', checksum=4092734058, investigation_time=None, risk_investigation_time=None"
loss_type,parent_id,rlz_id,no_damage,slight,moderate,extensive,complete,non_operational_value,non_operational_ratio
structural,A,0,1.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00
structural,A,1,1.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00
liquefaction,A,0,1.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00
liquefaction,A,1,1.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00
structural,B,0,1.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00
structural,B,1,1.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00
liquefaction,B,0,1.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00
liquefaction,B,1,1.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00
structural,E1,0,1.00000E-01,0.00000E+00,0.00000E+00,0.00000E+00,9.00000E-01,9.00000E-01,9.00000E-01
structural,E1,1,2.00000E-01,0.00000E+00,0.00000E+00,0.00000E+00,8.00000E-01,8.00000E-01,8.00000E-01
liquefaction,E1,0,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,1.00000E+00,1.00000E+00,1.00000E+00
liquefaction,E1,1,0.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,1.00000E+00,1.00000E+00,1.00000E+00
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#,,,,,,,,"generated_by='OpenQuake engine 3.22.0-git4588b0bb77', start_date='2024-10-14T10:44:37', checksum=4092734058, investigation_time=None, risk_investigation_time=None"
loss_type,rlz_id,no_damage,slight,moderate,extensive,complete,non_operational_value,non_operational_ratio
structural,0,2.10000E+00,0.00000E+00,0.00000E+00,0.00000E+00,9.00000E-01,9.00000E-01,3.00000E-01
structural,1,2.20000E+00,0.00000E+00,0.00000E+00,0.00000E+00,8.00000E-01,8.00000E-01,2.66667E-01
liquefaction,0,2.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,1.00000E+00,1.00000E+00,3.33333E-01
liquefaction,1,2.00000E+00,0.00000E+00,0.00000E+00,0.00000E+00,1.00000E+00,1.00000E+00,3.33333E-01
16 changes: 16 additions & 0 deletions openquake/qa_tests_data/scenario_damage/case_21/exposure.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<nrml xmlns="http://openquake.org/xmlns/nrml/0.4">
<exposureModel id="ex1" category="infrastructure" taxonomySource="">
<description>Road Network Demo</description>
<conversions>
<costTypes>
</costTypes>
</conversions>
<tagNames>type start_node end_node purpose weight parent_id</tagNames>
<occupancyPeriods></occupancyPeriods>
<assets>
exposure_demo_nodes.csv
exposure_demo_edges.csv
</assets>
</exposureModel>
</nrml>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,lon,lat,taxonomy,number,type,start_node,end_node,purpose,weight,parent_id
E1,89.955,24.615,bridge1,1,edge,A,B,NA,1,E1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,lon,lat,taxonomy,number,type,start_node,end_node,purpose,weight,parent_id
A,89.95,24.61,connection,1,node,NA,NA,connection,1,A
B,89.96,24.62,connection,1,node,NA,NA,connection,1,B
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<nrml xmlns="http://openquake.org/xmlns/nrml/0.5">
<fragilityModel id="1" assetCategory="RDN" lossCategory="liquefaction">
<description>Road Network</description>
<limitStates>slight moderate extensive complete</limitStates>
<fragilityFunction id="bridge1" format="discrete">
<imls imt="LiqProb" noDamageLimit="0">0 0.3 0.6 1</imls>
<poes ls="slight">0 1 1 1</poes>
<poes ls="moderate">0 1 1 1</poes>
<poes ls="extensive">0 1 1 1</poes>
<poes ls="complete">0 1 1 1</poes>
</fragilityFunction>
<fragilityFunction id="connection" format="discrete">
<imls imt="LiqProb" noDamageLimit="0">0 0.5 1 1.5</imls>
<poes ls="slight">0 0 0 1</poes>
<poes ls="moderate">0 0 0 1</poes>
<poes ls="extensive">0 0 0 1</poes>
<poes ls="complete">0 0 0 1</poes>
</fragilityFunction>
</fragilityModel>
</nrml>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<nrml xmlns="http://openquake.org/xmlns/nrml/0.5">
<fragilityModel id="1" assetCategory="RDN" lossCategory="structural">
<description>Road Network</description>
<limitStates>slight moderate extensive complete</limitStates>
<fragilityFunction id="connection" format="discrete">
<imls imt="PGA" noDamageLimit="0">0 0.5 1 1.5</imls>
<poes ls="slight">0 0 0 1</poes>
<poes ls="moderate">0 0 0 1</poes>
<poes ls="extensive">0 0 0 1</poes>
<poes ls="complete">0 0 0 1</poes>
</fragilityFunction>
<fragilityFunction id="bridge1" format="discrete">
<imls imt="PGA" noDamageLimit="0">0 0.3 0.6 1</imls>
<poes ls="slight">0 1 1 1</poes>
<poes ls="moderate">0 1 1 1</poes>
<poes ls="extensive">0 1 1 1</poes>
<poes ls="complete">0 1 1 1</poes>
</fragilityFunction>
</fragilityModel>
</nrml>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version='1.0' encoding='UTF-8'?>
<nrml>
<logicTree logicTreeID="">
<logicTreeBranchSet branchSetID="bs_00" uncertaintyType="gmpeModel" applyToTectonicRegionType="active shallow crust strikeslip or reverse">
<logicTreeBranch branchID="b_00_01">
<uncertaintyModel>

AbrahamsonEtAl2014RegCHN
</uncertaintyModel>
<uncertaintyWeight>0.50</uncertaintyWeight>
</logicTreeBranch>
<logicTreeBranch branchID="b_00_04">
<uncertaintyModel>
ChiouYoungs2014
</uncertaintyModel>
<uncertaintyWeight>0.50</uncertaintyWeight>
</logicTreeBranch>
</logicTreeBranchSet>
</logicTree>
</nrml>
39 changes: 39 additions & 0 deletions openquake/qa_tests_data/scenario_damage/case_21/job.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[General]
description = Bangladesh scenario 1885_manikganj - liquefaction
calculation_mode = scenario_damage
random_seed = 113
ses_seed = 1025

[site_params]
site_model_file = site_model.csv

[rupture]
rupture_model_file = rupture.xml
rupture_mesh_spacing = 2.0

[Secondary perils]
secondary_perils = AllstadtEtAl2022Liquefaction

[Calculation parameters]
intensity_measure_types = PGA, PGV
cross_correlation = Bradley2012
truncation_level = 3
maximum_distance = 300
number_of_ground_motion_fields = 10
gsim_logic_tree_file = gmpe_logic_tree_ascr.xml


[exposure]
exposure_file = exposure.xml

[fragility]
structural_fragility_file = fragility_model_shaking.xml
liquefaction_fragility_file = fragility_model_liq.xml

[consequence]
consequence_file = {'taxonomy': 'non_operational.csv'}

[risk_calculation]
discrete_damage_distribution = true
aggregate_by = parent_id
infrastructure_connectivity_analysis = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
taxonomy,consequence,loss_type,slight,moderate,extensive,complete
bridge1,non_operational,structural,0,0,0,1
connection,non_operational,structural,0,0,0,1
bridge1,non_operational,liquefaction,0,0,0,1
connection,non_operational,liquefaction,0,0,0,1
31 changes: 31 additions & 0 deletions openquake/qa_tests_data/scenario_damage/case_21/rupture.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<nrml
xmlns="http://openquake.org/xmlns/nrml/0.5"
xmlns:gml="http://www.opengis.net/gml"
>
<simpleFaultRupture>
<magnitude>
7.2522481E+00
</magnitude>
<rake>
9.0000000E+01
</rake>
<hypocenter depth="1.2071068E+01" lat="2.4222114E+01" lon="9.0140013E+01"/>
<simpleFaultGeometry>
<gml:LineString>
<gml:posList>
9.0010790E+01 2.3820714E+01 8.9990907E+01 2.3859943E+01 8.9998430E+01 2.3992675E+01 9.0021000E+01 2.4103911E+01 9.0021537E+01 2.4213536E+01 9.0000848E+01 2.4454549E+01 8.9991175E+01 2.4507212E+01 8.9991175E+01 2.4624360E+01
</gml:posList>
</gml:LineString>
<dip>
4.5000000E+01
</dip>
<upperSeismoDepth>
5.0000000E+00
</upperSeismoDepth>
<lowerSeismoDepth>
2.0000000E+01
</lowerSeismoDepth>
</simpleFaultGeometry>
</simpleFaultRupture>
</nrml>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
site_id,lon,lat,vs30,z1pt0,z2pt5,gwd,precip,dc,dr,dw,slope,cohesion_mid,friction_mid,saturation,dry_density
0,89.95,24.61,183,513.4083567,3.093638299,0.946059358,1796,187,1.80517065,1.80517065,20,20000,35,2,1500
1,89.96,24.62,221,502.7851667,2.493037557,2.853437095,1833,183,5.991748144,5.991748144,20,20000,35,2,1500
2,89.9655,24.615,211,506.1375293,2.628660223,0.076295109,1775,195,2.63670763,2.63670763,20,20000,35,2,1500
5 changes: 2 additions & 3 deletions openquake/risklib/riskmodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@
F32 = numpy.float32
F64 = numpy.float64

LTYPE_REGEX = '|'.join(valid.cost_type.choices) + '|area|number|residents'
RISK_TYPE_REGEX = re.compile(r'(%s|occupants|fragility)_([\w_]+)'
% LTYPE_REGEX)
LTYPE_REGEX = '|'.join(valid.cost_type.choices) + '|area|number|residents|liquefaction'
RISK_TYPE_REGEX = re.compile(r'(%s|occupants|fragility)_([\w_]+)' % LTYPE_REGEX)


def _assert_equal(d1, d2):
Expand Down
1 change: 1 addition & 0 deletions openquake/risklib/scientific.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
structural_ins+contents_ins+business_interruption_ins
nonstructural_ins+contents_ins+business_interruption_ins
structural_ins+nonstructural_ins+contents_ins+business_interruption_ins
liquefaction
'''.split())

TOTLOSSES = [lt for lt in LOSSTYPE if '+' in lt]
Expand Down
Loading