gem / oq-engine

OpenQuake Engine: a software for Seismic Hazard and Risk Analysis
https://github.com/gem/oq-engine/#openquake-engine
GNU Affero General Public License v3.0
380 stars 276 forks source link

Fix the ShakeMap calculator #4895

Closed micheles closed 5 years ago

micheles commented 5 years ago

@VSilva says:

Previously we thought that the values of ground shaking we were reading (grid = contents.get('download/grid.xml')) were the median ground shaking. However, the USGS has improved heavily the documentation of the shakemap system, and what they are providing is actually the mean ground shaking. For this reason, in order to convert the values they are providing to the lognormal mean mu (which is required for the calculations of the ground motion fields), we cannot simply compute numpy.log of that. We need to use the following formulae: numpy.log(m)-sigma**2/2 , where m is the mean (read directly from the grid.xml file) and sigma is the lognormal standard deviation (read directly from the uncertainty.xml file). The mu and sigma are the values that are used for the generation of the cross correlated ground motion fields. This error was not really easy to identify because since the mean and the median are so similar, there were almost no differences in the generated ground motion fields.

There is a second point we need to address. Before the shakemap system was not taking into account site amplification, so we were amplifying the shaking (def amplify_gmfs(imts, vs30s, gmfs)). However, now they are doing this apriori, so for the majority of the cases we don’t need to do that. We were already expecting that, so we included this functionality as an option (defined by the variable site_effects). I would like to ask you to just include this variable as False by default.

micheles commented 5 years ago

Actually we are already using the right formula, so I just changed the default for site_effects to False. We checked with Vitor that the numbers are correct on a controlled case that we added to the tests.