GNS-Science / kororaa-graphql-api

The graphql application API for NZHSM Kororaa.
GNU Affero General Public License v3.0
0 stars 0 forks source link

KAPI Fix: Whangarei Hazard curves not resolving on FINAL model #47

Closed chrisbc closed 1 year ago

chrisbc commented 2 years ago

Description

the query below from Kororaa returns curves for Auckland only...

What I Did


{"query":"query HazardChartsPlotsViewQuery(\n  $hazard_model: String\n  $vs30s: [Int]\n  $imts: [String]\n  $locs: [String]\n  $aggs: [String]\n  $resolution: Float\n) {\n  hazard_curves(hazard_model: $hazard_model, vs30s: $vs30s, imts: $imts, locs: $locs, aggs: $aggs, resolution: $resolution) {\n    ok\n    locations {\n      lat\n      lon\n      resolution\n      code\n      name\n      key\n    }\n    curves {\n      hazard_model\n      imt\n      loc\n      agg\n      vs30\n      curve {\n        levels\n        values\n      }\n    }\n  }\n}\n","variables":{"hazard_model":"SLT_v8_gmm_v2_FINAL","vs30s":[175],"imts":["PGA","SA(0.1)","SA(0.2)","SA(0.3)","SA(0.4)","SA(0.5)","SA(0.7)","SA(1.0)","SA(1.5)","SA(2.0)","SA(3.0)","SA(4.0)","SA(5.0)","SA(6.0)","SA(7.5)","SA(10.0)"],"locs":["-35.72~174.32","-36.87~174.77"],"aggs":["mean","0.05","0.95","0.1","0.9"],"resolution":0.1}}```
chrisbc commented 2 years ago

Some API testing / inspection shows that this is in fact the correct behaviour....

Whangarei is not working correctly because the named locations use 0.01 degree precision and the NZ grid was done at 0.1 degrees.. Whangerei was not in the original hazard calcs so we don't have any 0.01 curve data available there. I think we can work around this by querying to the nearest 0.1 grid location for whangarei (or any other named location that doesn't return hazard). But it's lower priority now that I understand whats going on. 6:05 Another work around is to tweak Whangarei co-ords in Kororaa to align with 0.1 grid, but then the location names won't resolve.