Skip to content
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

Fix to LanzanoEtAl2016 #6672

Merged
merged 1 commit into from Apr 7, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions debian/changelog
@@ -1,3 +1,6 @@
[Claudia Mascandola]
* Fix to LanzanoEtAl2016 in presence of a "bas" term in the site model

[Nicolas Schmid]
* Improve performance for ShakeMap calculations when spatialcorr and crosscorr
are both set to 'no'
Expand Down
10 changes: 8 additions & 2 deletions openquake/calculators/tests/classical_test.py
Expand Up @@ -37,7 +37,7 @@
case_34, case_35, case_36, case_37, case_38, case_39, case_40, case_41,
case_42, case_43, case_44, case_45, case_46, case_47, case_48, case_49,
case_50, case_51, case_52, case_53, case_54, case_55, case_56, case_57,
case_58, case_59, case_60, case_61, case_62)
case_58, case_59, case_60, case_61, case_62, case_64)

aac = numpy.testing.assert_allclose

Expand Down Expand Up @@ -868,4 +868,10 @@ def test_case_62(self):
# multisurface with kite faults
self.run_calc(case_62.__file__, 'job.ini')
[f] = export(('hcurves/mean', 'csv'), self.calc.datastore)
self.assertEqualFiles('expected/hcurve-mean.csv', f)
self.assertEqualFiles('expected/hcurve-mean.csv', f)

def test_case_64(self):
# LanzanoEtAl2016 with bas term
self.run_calc(case_64.__file__, 'job.ini')
[f] = export(('hcurves/mean', 'csv'), self.calc.datastore)
self.assertEqualFiles('expected/hcurve-mean.csv', f)
3 changes: 1 addition & 2 deletions openquake/hazardlib/gsim/lanzano_2016.py
Expand Up @@ -198,8 +198,7 @@ def _get_basin_effect_term(self, sites, C):
and the correction is applied.
"""
delta = np.zeros(len(sites.vs30))
idx = (sites.bas == 1.0)
delta[idx] = 1.0
delta[sites.bas == 1] = 1.0

return C['dbas'] * delta

Expand Down
1 change: 1 addition & 0 deletions openquake/hazardlib/site.py
Expand Up @@ -125,6 +125,7 @@ def _extract(array_or_float, indices):
'z1pt4': numpy.float64,
'backarc': numpy.bool,
'xvf': numpy.float64,
'bas': numpy.bool,

# Parameters for site amplification
'ampcode': ampcode_dt,
Expand Down
@@ -0,0 +1 @@
12,44.3
Empty file.
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<nrml
xmlns="http://openquake.org/xmlns/nrml/0.4"
xmlns:gml="http://www.opengis.net/gml"
>
<sourceModel
name="None"
>
<areaSource
id="516"
name="Appennino emiliano"
tectonicRegion="Active Shallow Crust"
>
<areaGeometry>
<Polygon>
<exterior>
<LinearRing>
<posList>
11.10120233 44.38567008 10.83778578 44.19320654 9.95750184 44.5349863 10.29987328 44.68097767 11.10120233 44.38567008
</posList>
</LinearRing>
</exterior>
</Polygon>
<upperSeismoDepth>
1.0
</upperSeismoDepth>
<lowerSeismoDepth>
10.0
</lowerSeismoDepth>
</areaGeometry>
<magScaleRel>
WC1994
</magScaleRel>
<ruptAspectRatio>
1.0
</ruptAspectRatio>
<truncGutenbergRichterMFD aValue="4.5" bValue="1.0" minMag="5.0" maxMag="7.0"/>
<nodalPlaneDist>
<nodalPlane dip="90.0" probability="1.0" rake="0.0" strike="0.0"/>
</nodalPlaneDist>
<hypoDepthDist>
<hypoDepth
depth="5.0"
probability="1.0"
>
1.0 5.0
</hypoDepth>
</hypoDepthDist>
</areaSource>
</sourceModel>
</nrml>
@@ -0,0 +1,3 @@
#,,,"generated_by='OpenQuake engine 3.12.0-git9e1d02cbc8', start_date='2021-04-07T12:01:13', checksum=4123219593, kind='mean', investigation_time=50.0, imt='PGA'"
lon,lat,depth,poe-0.0050000
12.00000,44.30000,0.00000,7.909805E-01
20 changes: 20 additions & 0 deletions openquake/qa_tests_data/classical/case_64/gmpe_logic_tree.xml
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>

<nrml xmlns:gml="http://www.opengis.net/gml"
xmlns="http://openquake.org/xmlns/nrml/0.4">
<logicTree logicTreeID='lt1'>

<logicTreeBranchingLevel branchingLevelID="bl1">
<logicTreeBranchSet uncertaintyType="gmpeModel" branchSetID="bs1"
applyToTectonicRegionType="Active Shallow Crust">

<logicTreeBranch branchID="b1">
<uncertaintyModel>LanzanoEtAl2016_RJB</uncertaintyModel>
<uncertaintyWeight>1.0</uncertaintyWeight>
</logicTreeBranch>

</logicTreeBranchSet>
</logicTreeBranchingLevel>

</logicTree>
</nrml>
30 changes: 30 additions & 0 deletions openquake/qa_tests_data/classical/case_64/job.ini
@@ -0,0 +1,30 @@
[general]

description = LanzanoEtAl2016
calculation_mode = classical
random_seed = 23

[geometry]
sites_csv = GRID_Mascandola.csv

[logic_tree]

number_of_logic_tree_samples = 0

[erf]

rupture_mesh_spacing = 40
width_of_mfd_bin = 2
area_source_discretization = 40

[site_params]
site_model_file = site_model.csv

[calculation]

source_model_logic_tree_file = source_model_logic_tree.xml
gsim_logic_tree_file = gmpe_logic_tree.xml
investigation_time = 50.0
intensity_measure_types_and_levels = {"PGA": [0.005]}
truncation_level = 0.5
maximum_distance = 100.0
2 changes: 2 additions & 0 deletions openquake/qa_tests_data/classical/case_64/site_model.csv
@@ -0,0 +1,2 @@
lon,lat,vs30,vs30measured,bas
12,44.3,800,0,0
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<nrml xmlns:gml="http://www.opengis.net/gml"
xmlns="http://openquake.org/xmlns/nrml/0.4">
<logicTree logicTreeID="lt1">
<logicTreeBranchingLevel branchingLevelID="bl1">
<logicTreeBranchSet uncertaintyType="sourceModel"
branchSetID="bs1">
<logicTreeBranch branchID="b1">
<uncertaintyModel>br8_ItaliaShareGRtot_ML_M2_150518_stat_MOD.xml</uncertaintyModel>
<uncertaintyWeight>1.0</uncertaintyWeight>
</logicTreeBranch>
</logicTreeBranchSet>
</logicTreeBranchingLevel>
</logicTree>
</nrml>