replication of scenario risk using openquake library

71 views
Skip to first unread message

Hyeuk Ryu

unread,
Oct 9, 2017, 11:44:57 PM10/9/17
to OpenQuake Users
Hi,

I am trying to replicate result of the scenario risk demo by calling the openquake library as function. I managed to get the same ground motion field, but not the loss value. For this exercise, I made some changes in the job.ini (where truncation_level = 0, number_of_ground_motion_fields=1, maximum_distance was set 2000, ie. arbitrary large number for comparison purpose). 

I'm suspecting epsilon value for the difference, but not able to confirm it. Would you be able to check the attached python code, and let me know some solution?
Thanks.

Regards,

Hyeuk


Michele Simionato

unread,
Oct 10, 2017, 12:46:24 AM10/10/17
to OpenQuake Users
I see no attachment, perhaps something went wrong. However, speaking from experience, it is usually difficult to get the epsilons right, so that is certainly a good candidate to explain the discrepancies, especially if the losses you get are very similar. The trick to check if it is the epsilons is to  set `ignore_covs=true` in the job.ini, then the epsilons will be ignored (it is as if they were all zeros) and you should get the same result since the GMFs are the same.
HTH,

         Michele

Hyeuk Ryu

unread,
Oct 10, 2017, 12:50:30 AM10/10/17
to OpenQuake Users
Hi Michele,

Thanks for your kind reply. FYI, here I attach the code. I'm not sure what happened though.
Thanks.

Regards,

Hyeuk
replicate_scen_risk.py
Message has been deleted

Michele Simionato

unread,
Oct 12, 2017, 1:12:07 AM10/12/17
to OpenQuake Users
Hi Hyeuk,

I see what you are trying to do. The idea of letting people to use the engine as a library has been a design goal for the engine from day one. However, one thing is theory, another is practice.
In practice until now the engine has been so complex and evolving so fast that it has been effectively impossible to use it as a library. The users would have to change their scripts at every
release to cope with the evolution. The situation with hazardlib and the Hazard Modeller Toolkit is much better, since they are mostly stable, but for what concerns the risk part things are still changing
daily. Just yesterday, for instance, a major refactoring of the risk calculators has been performed (https://github.com/gem/oq-engine/pull/3111).  This situation will not continue forever. For
instance the classical calculator is now mostly stable and I anticipate that the risk calculators (except the event based ones) will become mostly stable in a few months. Then it will become
possible for us to write tutorials on how to use the engine as a library, and I could tell you how to fix your script. Now I cannot because we are still in a fluid phase.

Having said that, we very much appreciate your efforts, since you are effectively acting as a beta tester for the fine points of the engine. Thanks!
Please keep up the good work,

     Michele


On Tuesday, October 10, 2017 at 5:44:57 AM UTC+2, Hyeuk Ryu wrote:

Michele Simionato

unread,
Oct 13, 2017, 3:11:20 AM10/13/17
to OpenQuake Users
Here is an example of how an user can use the engine libraries to implement his own scenario risk calculator: https://github.com/gem/oq-engine/pull/3127.
This is the way it will work in the forthcoming release of the engine (2.7.0). As you can see, it is quite sophisticated, and requires a deep understanding of
the internals of the engine. Hopefully things will get simpler in the future. On the plus side, things have never been so simple, it is the first time in 5 years
that I can show a script like this, in the past it would have been a lot more complicated ;-)
HTH,

       Michele
Reply all
Reply to author
Forward
0 new messages