GithubHelp home page GithubHelp logo

gns-science / toshi-hazard-haste Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 619 KB

A caching API for hazard components.

License: GNU Affero General Public License v3.0

Makefile 1.50% Python 98.50%

toshi-hazard-haste's Introduction

toshi-hazard-haste's People

Contributors

chrisbc avatar

Watchers

 avatar Robin Pringle avatar  avatar

toshi-hazard-haste's Issues

Fix: interpolation onto PoE

We want interpolation of the hazard onto a desired PoE to be robust against numerical "quirks" in the hazard curve.

Interpolation of the hazard curve onto a desired probability of exceedence (PoE) assumes that the hazard probability curve monotonically decreases as shaking level (acceleration) increases. However there are two identified ways in which this may not be true:

  • at very high probability (low shaking level) numerical precision can cause the probability to increase with shaking level. This has been observed to occur over the first two shaking levels
  • at very high shaking levels the probability is 0 and does not decrease further as shaking level increases

Done when:

  • small increases in probability at low shaking does not cause a problem
  • curves with 0 probability at high levels of shaking do not cause a problem
  • other cases of the hazard curve not monotonically decreasing with shaking level are logged as warning for manual inspection

Investigate: data issue w 'SLT_TAG_FINAL' 0.9 percentile

running:

time poetry run python -m toshi_hazard_haste.cli build -c demo/config.toml -w 1

on git ref
commit 0ea7e3eae431a1cb842a49f545337903e106b2be (HEAD -> feature/mp-speedup)

with config.toml:

# cli command configuration example
hazard_model_ids = ["SLT_TAG_FINAL"]
vs30s = [ 400 ]
imts = ["PGA", "SA(0.5)", "SA(1.0)", "SA(1.5)" ] # SANJAY for gridded
site_list = "NZ_0_2_NB_1_1"         #0.2 degree NZ grid
poes = [0.1, 0.02] #, 0.63, 0.86]
aggs = ["mean", "0.8", "0.9"]

produces:

sort_key_first_val -38.400~174.800:400:PGA:0.9:SLT_TAG_FINAL
condition_expr ((((nloc_001 IN ({'S': '-38.400~174.800'}) AND vs30 IN ({'N': '400'})) AND imt IN ({'S': 'PGA'})) AND agg IN ({'S': '0.9'})) AND hazard_model_id IN ({'S': 'SLT_TAG_FINAL'}))
get_hazard_rlz_curves_v3: qry <pynamodb.pagination.ResultIterator object at 0x7fc3d28ad190>
Process GriddedHAzardWorkerMP-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/GNSDATA/API/toshi-hazard-haste/toshi_hazard_haste/gridded_hazard/gridded_hazard.py", line 61, in run
    for ghaz in process_gridded_hazard(*nt):
  File "/GNSDATA/API/toshi-hazard-haste/toshi_hazard_haste/gridded_hazard/gridded_hazard.py", line 27, in process_gridded_hazard
    grid_poes[index] = compute_hazard_at_poe(poe_lvl, accel_levels, poe_values, INVESTIGATION_TIME)
  File "/GNSDATA/API/toshi-hazard-haste/toshi_hazard_haste/gridded_hazard/gridded_poe.py", line 24, in compute_hazard_at_poe
    assert np.all(np.diff(xp) >= 0)  # raise is x_accel_levels not increasing or at least not dropping,
AssertionError

Feature: CoV maps

We want to be able to calculate coefficient of variation (CoV) maps for a given probability of exceedance (PoE).

This is done by (at every grid point)

  1. interpolate the mean hazard curve onto the desired PoE using the existing approach. The resulting shaking level is called the target_level
  2. Interpolate the CoV curve to get the CoV at the target_level. This is done by treating shaking levels as the x-values and CoV as the y values in the interpolation (opposite of how interpolation is done in step 1). NB: use log-log interpolation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.