applying maximum_distance in computing ground motion field

27 views
Skip to first unread message

Hyeuk Ryu

unread,
Oct 11, 2017, 11:11:04 PM10/11/17
to OpenQuake Users
Hi,

I've got the following error message when I applied maximum_distnace in calling GmfComputer.compute:
I managed to avoid the error by replacing 200 with 20000, which does not exclude any site.
Thanks.

Regards,

Hyeuk


import numpy as np

from openquake.commonlib.readinput import (
    get_exposure, get_risk_model, get_oqparam, get_sitecol_assetcol, 
    get_rupture, get_gsims, get_imts)
from openquake.hazardlib.calc.gmf import ground_motion_fields, GmfComputer
from openquake.hazardlib.imt import SA, PGA, PGV
from openquake.hazardlib.gsim.chiou_youngs_2008 import ChiouYoungs2008
from openquake.hazardlib.calc.filters import IntegrationDistance

oqparam = get_oqparam('/Users/hyeuk/openquake/demos/risk/ScenarioDamage/job.ini')

exposure = get_exposure(oqparam)

rupture = get_rupture(oqparam)

sites, assets = get_sitecol_assetcol(oqparam, exposure)

# fields = ground_motion_fields(
#     rupture=rupture,
#     sites=sites,
#     imts=get_imts(oqparam),
#     gsim=oqparam.gsim,
#     truncation_level=oqparam.truncation_level,
#     realizations=oqparam.number_of_ground_motion_fields,
#     seed=oqparam.random_seed,
# )

imts = get_imts(oqparam)
gsim = oqparam.gsim
truncation_level = oqparam.truncation_level
#correlation_model = None
seed = oqparam.random_seed
realizations = oqparam.number_of_ground_motion_fields
maximum_distance = IntegrationDistance({'default': 200})

gc = GmfComputer(rupture, sites, [str(imt) for imt in imts], [gsim],
                 truncation_level, maximum_distance=maximum_distance)
res = gc.compute(gsim, realizations, seed)

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-0d440bff02d2> in <module>()
     37 gc = GmfComputer(rupture, sites, [str(imt) for imt in imts], [gsim],
     38                  truncation_level, maximum_distance=maximum_distance)
---> 39 res = gc.compute(gsim, realizations, seed)
     40 
     41 

/Users/hyeuk/anaconda2/envs/oq25/lib/python2.7/site-packages/openquake/hazardlib/calc/gmf.pyc in compute(self, gsim, num_events, seed)
    122             (len(self.imts), len(self.sites), num_events), numpy.float32)
    123         for imti, imt in enumerate(self.imts):
--> 124             result[imti] = self._compute(None, gsim, num_events, imt)
    125         return result
    126 

/Users/hyeuk/anaconda2/envs/oq25/lib/python2.7/site-packages/openquake/hazardlib/calc/gmf.pyc in _compute(self, seed, gsim, num_events, imt)
    178 
    179             intra_residual = stddev_intra * distribution.rvs(
--> 180                 size=(len(self.sites), num_events))
    181 
    182             if self.correlation_model is not None:

ValueError: operands could not be broadcast together with shapes (1432,1) (2273,10) 

Reply all
Reply to author
Forward
0 new messages