MetOffice / qgis-plugin-edr

GNU General Public License v3.0
3 stars 1 forks source link

CovJSON parsing fails for DMI EDR API on wave model data #41

Open petergarnaes opened 3 weeks ago

petergarnaes commented 3 weeks ago

The CovJSON output provided below fails to be parsed by the plugin, and the error message WARNING Environmental Data Retrieval : Loading of '/my/download/folder/wam_dw_8705e0ed-7e6f-4bdb-b2b5-9e97e9eb4f6b.covjson' failed due to the following exception: list index out of range does not provide enough information to debug the issue further. The CovJSON below should be valid, as it is parsed as valid by the official CovJSON playground.

{
  "type" : "Coverage",
  "title" : {
    "en" : "Grid Feature"
  },
  "domain" : {
    "type" : "Domain",
    "domainType" : "Grid",
    "axes" : {
      "t" : {
        "values" : [ "2024-06-26T06:00:00.000Z", "2024-06-26T07:00:00.000Z", "2024-06-26T08:00:00.000Z", "2024-06-26T09:00:00.000Z", "2024-06-26T10:00:00.000Z", "2024-06-26T11:00:00.000Z", "2024-06-26T12:00:00.000Z", "2024-06-26T13:00:00.000Z", "2024-06-26T14:00:00.000Z", "2024-06-26T15:00:00.000Z", "2024-06-26T16:00:00.000Z", "2024-06-26T17:00:00.000Z", "2024-06-26T18:00:00.000Z", "2024-06-26T19:00:00.000Z", "2024-06-26T20:00:00.000Z", "2024-06-26T21:00:00.000Z", "2024-06-26T22:00:00.000Z", "2024-06-26T23:00:00.000Z", "2024-06-27T00:00:00.000Z", "2024-06-27T01:00:00.000Z", "2024-06-27T02:00:00.000Z", "2024-06-27T03:00:00.000Z", "2024-06-27T04:00:00.000Z", "2024-06-27T05:00:00.000Z", "2024-06-27T06:00:00.000Z", "2024-06-27T07:00:00.000Z", "2024-06-27T08:00:00.000Z", "2024-06-27T09:00:00.000Z", "2024-06-27T10:00:00.000Z", "2024-06-27T11:00:00.000Z", "2024-06-27T12:00:00.000Z", "2024-06-27T13:00:00.000Z", "2024-06-27T14:00:00.000Z", "2024-06-27T15:00:00.000Z", "2024-06-27T16:00:00.000Z", "2024-06-27T17:00:00.000Z", "2024-06-27T18:00:00.000Z", "2024-06-27T19:00:00.000Z", "2024-06-27T20:00:00.000Z", "2024-06-27T21:00:00.000Z", "2024-06-27T22:00:00.000Z", "2024-06-27T23:00:00.000Z", "2024-06-28T00:00:00.000Z", "2024-06-28T01:00:00.000Z", "2024-06-28T02:00:00.000Z", "2024-06-28T03:00:00.000Z", "2024-06-28T04:00:00.000Z", "2024-06-28T05:00:00.000Z", "2024-06-28T06:00:00.000Z", "2024-06-28T07:00:00.000Z", "2024-06-28T08:00:00.000Z", "2024-06-28T09:00:00.000Z", "2024-06-28T10:00:00.000Z", "2024-06-28T11:00:00.000Z", "2024-06-28T12:00:00.000Z", "2024-06-28T13:00:00.000Z", "2024-06-28T14:00:00.000Z", "2024-06-28T15:00:00.000Z", "2024-06-28T16:00:00.000Z", "2024-06-28T17:00:00.000Z", "2024-06-28T18:00:00.000Z" ]
      },
      "x" : {
        "values" : [ 10.416667321696877 ],
        "bounds" : [ 10.416667321696877, 10.416667321696877 ]
      },
      "y" : {
        "values" : [ 56.09000353794545 ],
        "bounds" : [ 56.09000353794545, 56.09000353794545 ]
      }
    },
    "referencing" : [ {
      "coordinates" : [ "x", "y" ],
      "system" : {
        "type" : "GeographicCRS",
        "id" : "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
      }
    }, {
      "coordinates" : [ "t" ],
      "system" : {
        "type" : "TemporalRS",
        "calendar" : "Gregorian"
      }
    } ]
  },
  "parameters" : {
    "significant-wave-height" : {
      "type" : "Parameter",
      "description" : {
        "en" : "Significant wave height"
      },
      "observedProperty" : {
        "label" : {
          "en" : "https://apps.ecmwf.int/codes/grib/param-db?id=131074"
        }
      }
    }
  },
  "ranges" : {
    "significant-wave-height" : {
      "type" : "NdArray",
      "dataType" : "float",
      "axisNames" : [ "t", "y", "x" ],
      "shape" : [ 61, 1, 1 ],
      "values" : [ 0.17847079, 0.17334384, 0.18359774, 0.1755411, 0.16333407, 0.17041415, 0.18188876, 0.20825595, 0.22681063, 0.20874423, 0.1821329, 0.18359774, 0.22607821, 0.24902743, 0.3120157, 0.4008829, 0.38745517, 0.32178134, 0.3017618, 0.28149813, 0.28833407, 0.31641024, 0.32080477, 0.34766024, 0.35596102, 0.33935946, 0.35840243, 0.36035556, 0.30810946, 0.3173868, 0.3256876, 0.29785556, 0.28808993, 0.27490634, 0.27002352, 0.25928134, 0.26904696, 0.28271884, 0.27441806, 0.29980868, 0.31299227, 0.24756259, 0.26123446, 0.31543368, 0.3095743, 0.34058017, 0.30395907, 0.31836337, 0.28760165, 0.25439852, 0.22754306, 0.20068759, 0.22070712, 0.27637118, 0.3671915, 0.44824618, 0.49512118, 0.54297274, 0.5566446, 0.54004306, 0.5185587 ]
    }
  }
}

It is returned by a position query, is it because the plugin expects a PointSeries or Point domain type, instead of a 1x1 grid? The axes object wouldn't change even if it was a PointSeries or Point though 🤔

m-burgoyne commented 3 weeks ago

Yes the QGIS plugin expects Position query query CovJSON responses to be either PointSeries (for a time series) or a Point

i.e.

{
  "type" : "Coverage",
  "title" : {
    "en" : "Grid Feature"
  },
  "domain" : {
    "type" : "Domain",
    "domainType" : "PointSeries",
    "axes" : {
      "t" : {
        "values" : [ "2024-06-26T06:00:00.000Z", "2024-06-26T07:00:00.000Z", "2024-06-26T08:00:00.000Z", "2024-06-26T09:00:00.000Z", "2024-06-26T10:00:00.000Z", "2024-06-26T11:00:00.000Z", "2024-06-26T12:00:00.000Z", "2024-06-26T13:00:00.000Z", "2024-06-26T14:00:00.000Z", "2024-06-26T15:00:00.000Z", "2024-06-26T16:00:00.000Z", "2024-06-26T17:00:00.000Z", "2024-06-26T18:00:00.000Z", "2024-06-26T19:00:00.000Z", "2024-06-26T20:00:00.000Z", "2024-06-26T21:00:00.000Z", "2024-06-26T22:00:00.000Z", "2024-06-26T23:00:00.000Z", "2024-06-27T00:00:00.000Z", "2024-06-27T01:00:00.000Z", "2024-06-27T02:00:00.000Z", "2024-06-27T03:00:00.000Z", "2024-06-27T04:00:00.000Z", "2024-06-27T05:00:00.000Z", "2024-06-27T06:00:00.000Z", "2024-06-27T07:00:00.000Z", "2024-06-27T08:00:00.000Z", "2024-06-27T09:00:00.000Z", "2024-06-27T10:00:00.000Z", "2024-06-27T11:00:00.000Z", "2024-06-27T12:00:00.000Z", "2024-06-27T13:00:00.000Z", "2024-06-27T14:00:00.000Z", "2024-06-27T15:00:00.000Z", "2024-06-27T16:00:00.000Z", "2024-06-27T17:00:00.000Z", "2024-06-27T18:00:00.000Z", "2024-06-27T19:00:00.000Z", "2024-06-27T20:00:00.000Z", "2024-06-27T21:00:00.000Z", "2024-06-27T22:00:00.000Z", "2024-06-27T23:00:00.000Z", "2024-06-28T00:00:00.000Z", "2024-06-28T01:00:00.000Z", "2024-06-28T02:00:00.000Z", "2024-06-28T03:00:00.000Z", "2024-06-28T04:00:00.000Z", "2024-06-28T05:00:00.000Z", "2024-06-28T06:00:00.000Z", "2024-06-28T07:00:00.000Z", "2024-06-28T08:00:00.000Z", "2024-06-28T09:00:00.000Z", "2024-06-28T10:00:00.000Z", "2024-06-28T11:00:00.000Z", "2024-06-28T12:00:00.000Z", "2024-06-28T13:00:00.000Z", "2024-06-28T14:00:00.000Z", "2024-06-28T15:00:00.000Z", "2024-06-28T16:00:00.000Z", "2024-06-28T17:00:00.000Z", "2024-06-28T18:00:00.000Z" ]
      },
      "x" : {
        "values" : [ 10.416667321696877 ]
        },
      "y" : {
        "values" : [ 56.09000353794545 ]
      }
    },
    "referencing" : [ {
      "coordinates" : [ "x", "y" ],
      "system" : {
        "type" : "GeographicCRS",
        "id" : "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
      }
    }, {
      "coordinates" : [ "t" ],
      "system" : {
        "type" : "TemporalRS",
        "calendar" : "Gregorian"
      }
    } ]
  },
  "parameters" : {
    "significant-wave-height" : {
      "type" : "Parameter",
      "description" : {
        "en" : "Significant wave height"
      },
      "observedProperty" : {
        "label" : {
          "en" : "https://apps.ecmwf.int/codes/grib/param-db?id=131074"
        }
      }
    }
  },
  "ranges" : {
    "significant-wave-height" : {
      "type" : "NdArray",
      "dataType" : "float",
      "axisNames" : [ "t" ],
      "shape" : [ 61 ],
      "values" : [ 0.17847079, 0.17334384, 0.18359774, 0.1755411, 0.16333407, 0.17041415, 0.18188876, 0.20825595, 0.22681063, 0.20874423, 0.1821329, 0.18359774, 0.22607821, 0.24902743, 0.3120157, 0.4008829, 0.38745517, 0.32178134, 0.3017618, 0.28149813, 0.28833407, 0.31641024, 0.32080477, 0.34766024, 0.35596102, 0.33935946, 0.35840243, 0.36035556, 0.30810946, 0.3173868, 0.3256876, 0.29785556, 0.28808993, 0.27490634, 0.27002352, 0.25928134, 0.26904696, 0.28271884, 0.27441806, 0.29980868, 0.31299227, 0.24756259, 0.26123446, 0.31543368, 0.3095743, 0.34058017, 0.30395907, 0.31836337, 0.28760165, 0.25439852, 0.22754306, 0.20068759, 0.22070712, 0.27637118, 0.3671915, 0.44824618, 0.49512118, 0.54297274, 0.5566446, 0.54004306, 0.5185587 ]
    }
  }
}
petergarnaes commented 3 weeks ago

Okay, I would assume it should be okay, since the EDR standard does not say anything about what type of CoverageJSON can be returned for each of the queries.

At least a better error/warning message could be considered