GNS-Science / simple-toshi-ui

basic react UI for Toshi API - experimental using react-relay
GNU Affero General Public License v3.0
0 stars 1 forks source link

Feature: hazard PGA/SA plot view on InversionSolution #119

Closed chrisbc closed 2 years ago

chrisbc commented 3 years ago

AS SRM Team

we want to view hazard curves (PGA/SA) alongside other InversionSolution plots

So that hazard impacts are easily assessed

Done when:

Query examples:

Queries:

query is0 {
  node(id:"SW52ZXJzaW9uU29sdXRpb246MjcwNS4wTWVEN0M=") {
    __typename
    ... on InversionSolution {
      tables {table_type table_id}
    }
  }
}

query get_table {
    node(id: "VGFibGU6Mzk5UXEyVFA=") {
    ... on Table {
      id
      name
      created
      table_type
      object_id
      column_headers
      column_types
      rows
      dimensions{k v}
    }
  }
}

returning ....

{
  "data": {
    "node": {
      "__typename": "InversionSolution",
      "tables": [
        {
          "table_type": "MFD_CURVES",
          "table_id": "VGFibGU6Mzk1WnY1RXA="
        },
        {
          "table_type": "HAZARD_SITES",
          "table_id": "VGFibGU6Mzk5UXEyVFA="
        }
      ]
    }
  }
}

Note the ID required is for "table_type": "HAZARD_SITES"

and then ....

{
  "data": {
    "node": {
      "id": "VGFibGU6Mzk5UXEyVFA=",
      "name": "Inversion Solution Site Hazard",
      "created": "2021-10-17T23:40:33.487890+00:00",
      "table_type": "HAZARD_SITES",
      "object_id": "SW52ZXJzaW9uU29sdXRpb246MjcwNS4wTWVEN0M=",
      "column_headers": [
        "forecast_timespan",
        "bg_seismicity",
        "iml_period",
        "gmpe",
        "location",
        "lat",
        "lon",
        "x",
        "y"
      ],
      "column_types": [
        "double",
        "string",
        "double",
        "string",
        "string",
        "double",
        "double",
        "double",
        "double"
      ],
      "rows": [
        [
          "50",
          "INCLUDE",
          "0.0",
          "ASK_2014",
          "Wellington",
          "-41.276825",
          "174.777969",
          "0.00010000000000000009",
          "1.0"
        ],
        [
          "50",
          "INCLUDE",
          "0.0",
          "ASK_2014",
          "Wellington",
          "-41.276825",
          "174.777969",
          "0.0001299999999999999",
          "1.0"
        ],
        [
          "50",
          "INCLUDE",
          "0.0",
          "ASK_2014",
          "Wellington",
          "-41.276825",
          "174.777969",
          "0.00016",
          "1.0"
        ],
        [
          "50",
          "INCLUDE",
          "0.0",
          "ASK_2014",
          "Wellington",
          "-41.276825",
          "174.777969",
          "0.00019999999999999985",
          "1.0"
        ],
        [
          "50",
          "INCLUDE",
          "0.0",
          "ASK_2014",
          "Wellington",
          "-41.276825",
          "174.777969",
          "0.00025",
          "1.0"
        ],
        [
          "50",
          "INCLUDE",
          "0.0",
          "ASK_2014",
          "Wellington",
          "-41.276825",
          "174.777969",
          "0.0003200000000000001",
          "1.0"
        ],
....etc
chrisbc commented 2 years ago

example taken from https://earthquake.usgs.gov/hazards/interactive/

image