Example #1
0
from openquake.baselib.general import DictArray
from openquake.hazardlib import nrml, lt, sourceconverter, calc, site, valid
from openquake.hazardlib.calc.hazard_curve import classical
from openquake.hazardlib.geo.point import Point

# a point source with 2(mag) x 2(npd) x 2(hdd) = 8 ruptures
ps = nrml.get('''\
<pointSource id="P" name="P" tectonicRegion="Active Shallow Crust">
  <pointGeometry>
      <gml:Point><gml:pos>1 0</gml:pos></gml:Point>
      <upperSeismoDepth>0</upperSeismoDepth>
      <lowerSeismoDepth>10</lowerSeismoDepth>
   </pointGeometry>
   <magScaleRel>WC1994</magScaleRel>
   <ruptAspectRatio>1.5</ruptAspectRatio>
   <truncGutenbergRichterMFD aValue="3" bValue="1" maxMag="7" minMag="5"/>
   <nodalPlaneDist>
      <nodalPlane dip="30" probability=".3" rake="0" strike="45"/>
      <nodalPlane dip="30" probability=".7" rake="90" strike="45"/>
   </nodalPlaneDist>
   <hypoDepthDist>
      <hypoDepth depth="4" probability=".5"/>
      <hypoDepth depth="8" probability=".5"/>
   </hypoDepthDist>
</pointSource>''')


def scaling_rates(srcs):
    return [getattr(src, 'scaling_rate', 1.) for src in srcs]

Example #2
0
asource = nrml.get('''\
<areaSource
  id="1"
  name="Area Source"
  tectonicRegion="Stable Continental Crust">
  <areaGeometry>
      <gml:Polygon>
          <gml:exterior>
              <gml:LinearRing>
                  <gml:posList>
                    -1.5 -1.5 -1.3 -1.1 1.1 .2 1.3 -1.8
                  </gml:posList>
              </gml:LinearRing>
          </gml:exterior>
      </gml:Polygon>
      <upperSeismoDepth>0</upperSeismoDepth>
      <lowerSeismoDepth>10 </lowerSeismoDepth>
  </areaGeometry>
  <magScaleRel>WC1994</magScaleRel>
  <ruptAspectRatio>1</ruptAspectRatio>
  <truncGutenbergRichterMFD aValue="4.5" bValue="1" maxMag="7" minMag="5"/>
  <nodalPlaneDist>
    <nodalPlane dip="90" probability=".33" rake="0" strike="0"/>
    <nodalPlane dip="60" probability=".33" rake="0" strike="0"/>
    <nodalPlane dip="30" probability=".34" rake="0" strike="0"/>
  </nodalPlaneDist>
  <hypoDepthDist>
     <hypoDepth depth="5" probability=".5"/>
     <hypoDepth depth="10" probability=".5"/>
  </hypoDepthDist>
</areaSource>''')