From a1ec93b6b4c3e33e3bdb11f97e87e00096c330d1 Mon Sep 17 00:00:00 2001 From: Jon Blower Date: Mon, 25 Apr 2022 06:47:30 +0100 Subject: [PATCH] Added playground JSON files and test routine (#31) --- test/test_data/playground/README.txt | 1 + .../playground/grid-categorical.covjson | 71 +++++++++++ .../playground/grid-domain-bng.covjson | 15 +++ test/test_data/playground/grid-domain.covjson | 15 +++ test/test_data/playground/grid-tiled.covjson | 53 ++++++++ .../playground/grid-tiled/a/0-0.covjson | 16 +++ .../playground/grid-tiled/a/0-1.covjson | 16 +++ .../playground/grid-tiled/a/0-2.covjson | 16 +++ .../playground/grid-tiled/a/0-3.covjson | 16 +++ .../playground/grid-tiled/a/1-0.covjson | 18 +++ .../playground/grid-tiled/a/1-1.covjson | 18 +++ .../playground/grid-tiled/a/1-2.covjson | 18 +++ .../playground/grid-tiled/a/1-3.covjson | 18 +++ .../playground/grid-tiled/a/2-0.covjson | 19 +++ .../playground/grid-tiled/a/2-1.covjson | 19 +++ .../playground/grid-tiled/a/2-2.covjson | 19 +++ .../playground/grid-tiled/a/2-3.covjson | 19 +++ .../playground/grid-tiled/b/0.covjson | 13 ++ .../playground/grid-tiled/b/1.covjson | 13 ++ .../playground/grid-tiled/c/all.covjson | 19 +++ test/test_data/playground/grid.covjson | 58 +++++++++ .../test_data/playground/multipolygon.covjson | 64 ++++++++++ .../playground/point-collection.covjson | 115 ++++++++++++++++++ test/test_data/playground/point.covjson | 90 ++++++++++++++ test/test_data/playground/pointseries.covjson | 80 ++++++++++++ .../playground/polygonseries.covjson | 61 ++++++++++ .../playground/profile-collection.covjson | 92 ++++++++++++++ test/test_data/playground/profile.covjson | 104 ++++++++++++++++ test/test_data/playground/trajectory.covjson | 63 ++++++++++ test/test_playground_coverages.py | 27 ++++ 30 files changed, 1166 insertions(+) create mode 100644 test/test_data/playground/README.txt create mode 100644 test/test_data/playground/grid-categorical.covjson create mode 100644 test/test_data/playground/grid-domain-bng.covjson create mode 100644 test/test_data/playground/grid-domain.covjson create mode 100644 test/test_data/playground/grid-tiled.covjson create mode 100644 test/test_data/playground/grid-tiled/a/0-0.covjson create mode 100644 test/test_data/playground/grid-tiled/a/0-1.covjson create mode 100644 test/test_data/playground/grid-tiled/a/0-2.covjson create mode 100644 test/test_data/playground/grid-tiled/a/0-3.covjson create mode 100644 test/test_data/playground/grid-tiled/a/1-0.covjson create mode 100644 test/test_data/playground/grid-tiled/a/1-1.covjson create mode 100644 test/test_data/playground/grid-tiled/a/1-2.covjson create mode 100644 test/test_data/playground/grid-tiled/a/1-3.covjson create mode 100644 test/test_data/playground/grid-tiled/a/2-0.covjson create mode 100644 test/test_data/playground/grid-tiled/a/2-1.covjson create mode 100644 test/test_data/playground/grid-tiled/a/2-2.covjson create mode 100644 test/test_data/playground/grid-tiled/a/2-3.covjson create mode 100644 test/test_data/playground/grid-tiled/b/0.covjson create mode 100644 test/test_data/playground/grid-tiled/b/1.covjson create mode 100644 test/test_data/playground/grid-tiled/c/all.covjson create mode 100644 test/test_data/playground/grid.covjson create mode 100644 test/test_data/playground/multipolygon.covjson create mode 100644 test/test_data/playground/point-collection.covjson create mode 100644 test/test_data/playground/point.covjson create mode 100644 test/test_data/playground/pointseries.covjson create mode 100644 test/test_data/playground/polygonseries.covjson create mode 100644 test/test_data/playground/profile-collection.covjson create mode 100644 test/test_data/playground/profile.covjson create mode 100644 test/test_data/playground/trajectory.covjson create mode 100644 test/test_playground_coverages.py diff --git a/test/test_data/playground/README.txt b/test/test_data/playground/README.txt new file mode 100644 index 0000000..4f23d1f --- /dev/null +++ b/test/test_data/playground/README.txt @@ -0,0 +1 @@ +These are complete CoverageJSON objects, copied from the CoverageJSON playground. They are included here to perform a "sanity check" that all the coverages validate against the schema. diff --git a/test/test_data/playground/grid-categorical.covjson b/test/test_data/playground/grid-categorical.covjson new file mode 100644 index 0000000..18bf4f0 --- /dev/null +++ b/test/test_data/playground/grid-categorical.covjson @@ -0,0 +1,71 @@ +{ + "type" : "Coverage", + "domain" : { + "type" : "Domain", + "domainType" : "Grid", + "axes": { + "x" : { "values": [-10,-5,0] }, + "y" : { "values": [40,50] }, + "t" : { "values": ["2010-01-01T00:12:20Z"] } + }, + "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" : { + "LC": { + "type" : "Parameter", + "description" : { + "en": "Land Cover according to xyz classification" + }, + "observedProperty" : { + "id" : "http://example.com/landcover", + "label" : { + "en": "XYZ Land Cover" + }, + "categories" : [{ + "id": "http://example.com/landcover/categories/grass", + "label": { + "en": "Grass" + }, + "description": { + "en": "Very green grass." + }, + "preferredColor": "#01A611" + }, { + "id": "http://example.com/landcover/categories/rocks", + "label": { + "en": "Rock" + }, + "description": { + "en": "Just rocks." + }, + "preferredColor": "#A0A0A0" + }] + }, + "categoryEncoding": { + "http://example.com/landcover/categories/grass": 1, + "http://example.com/landcover/categories/rocks": 2 + } + } + }, + "ranges" : { + "LC" : { + "type" : "NdArray", + "dataType": "integer", + "axisNames": ["t","y","x"], + "shape": [1, 2, 3], + "values" : [ 1, 1, null, 2, 1, 2 ] + } + } +} \ No newline at end of file diff --git a/test/test_data/playground/grid-domain-bng.covjson b/test/test_data/playground/grid-domain-bng.covjson new file mode 100644 index 0000000..5fd3461 --- /dev/null +++ b/test/test_data/playground/grid-domain-bng.covjson @@ -0,0 +1,15 @@ +{ + "type" : "Domain", + "domainType": "Grid", + "axes": { + "x" : { "start": 185106, "stop": 657784, "num": 100 }, + "y" : { "start": 15407, "stop": 619322, "num": 100 } + }, + "referencing": [{ + "coordinates": ["x", "y"], + "system": { + "type": "ProjectedCRS", + "id": "http://www.opengis.net/def/crs/EPSG/0/27700" + } + }] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-domain.covjson b/test/test_data/playground/grid-domain.covjson new file mode 100644 index 0000000..448e9de --- /dev/null +++ b/test/test_data/playground/grid-domain.covjson @@ -0,0 +1,15 @@ +{ + "type" : "Domain", + "domainType" : "Grid", + "axes": { + "x" : { "start": -10, "stop":0, "num": 10 }, + "y" : { "start": 40, "stop": 50, "num": 20 } + }, + "referencing": [{ + "coordinates": ["x","y"], + "system": { + "type": "GeographicCRS", + "id": "http://www.opengis.net/def/crs/OGC/1.3/CRS84" + } + }] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled.covjson b/test/test_data/playground/grid-tiled.covjson new file mode 100644 index 0000000..f7ee2d3 --- /dev/null +++ b/test/test_data/playground/grid-tiled.covjson @@ -0,0 +1,53 @@ +{ + "type" : "Coverage", + "domain" : { + "type" : "Domain", + "domainType" : "Grid", + "axes": { + "x" : { "start": -100, "stop": 100, "num": 10 }, + "y" : { "start": -50, "stop": 50, "num": 5 }, + "t" : { "values": ["2010", "2011"] } + }, + "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" : { + "FOO": { + "type" : "Parameter", + "observedProperty" : { + "label" : { + "en": "Bar" + } + } + } + }, + "ranges" : { + "FOO" : { + "type" : "TiledNdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [2, 5, 10], + "tileSets": [{ + "tileShape": [null, 2, 3], + "urlTemplate": "https://covjson.org/playground/coverages/grid-tiled/a/{y}-{x}.covjson" + }, { + "tileShape": [1, null, null], + "urlTemplate": "https://covjson.org/playground/coverages/grid-tiled/b/{t}.covjson" + }, { + "tileShape": [null, null, null], + "urlTemplate": "https://covjson.org/playground/coverages/grid-tiled/c/all.covjson" + }] + } + } +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/a/0-0.covjson b/test/test_data/playground/grid-tiled/a/0-0.covjson new file mode 100644 index 0000000..2bcd3db --- /dev/null +++ b/test/test_data/playground/grid-tiled/a/0-0.covjson @@ -0,0 +1,16 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [2, 2, 3], + "values": [ + 1, 2, 3, + 11, 12, 13, + + + + + 51, 52, 53, + 61, 62, 63 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/a/0-1.covjson b/test/test_data/playground/grid-tiled/a/0-1.covjson new file mode 100644 index 0000000..ac42576 --- /dev/null +++ b/test/test_data/playground/grid-tiled/a/0-1.covjson @@ -0,0 +1,16 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [2, 2, 3], + "values": [ + 4, 5, 6, + 14, 15, 16, + + + + + 54, 55, 56, + 64, 65, 66 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/a/0-2.covjson b/test/test_data/playground/grid-tiled/a/0-2.covjson new file mode 100644 index 0000000..276f5fe --- /dev/null +++ b/test/test_data/playground/grid-tiled/a/0-2.covjson @@ -0,0 +1,16 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [2, 2, 3], + "values": [ + 7, 8, 9, + 17, 18, 19, + + + + + 57, 58, 59, + 67, 68, 69 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/a/0-3.covjson b/test/test_data/playground/grid-tiled/a/0-3.covjson new file mode 100644 index 0000000..9565bef --- /dev/null +++ b/test/test_data/playground/grid-tiled/a/0-3.covjson @@ -0,0 +1,16 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [2, 2, 1], + "values": [ + 10, + 20, + + + + + 60, + 70 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/a/1-0.covjson b/test/test_data/playground/grid-tiled/a/1-0.covjson new file mode 100644 index 0000000..98a5956 --- /dev/null +++ b/test/test_data/playground/grid-tiled/a/1-0.covjson @@ -0,0 +1,18 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [2, 2, 3], + "values": [ + + + 21, 22, 23, + 31, 32, 33, + + + + + 71, 72, 73, + 81, 82, 83 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/a/1-1.covjson b/test/test_data/playground/grid-tiled/a/1-1.covjson new file mode 100644 index 0000000..229ba6e --- /dev/null +++ b/test/test_data/playground/grid-tiled/a/1-1.covjson @@ -0,0 +1,18 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [2, 2, 3], + "values": [ + + + 24, 25, 26, + 34, 35, 36, + + + + + 74, 75, 76, + 84, 85, 86 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/a/1-2.covjson b/test/test_data/playground/grid-tiled/a/1-2.covjson new file mode 100644 index 0000000..f598dbc --- /dev/null +++ b/test/test_data/playground/grid-tiled/a/1-2.covjson @@ -0,0 +1,18 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [2, 2, 3], + "values": [ + + + 27, 28, 29, + 37, 38, 39, + + + + + 77, 78, 79, + 87, 88, 89 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/a/1-3.covjson b/test/test_data/playground/grid-tiled/a/1-3.covjson new file mode 100644 index 0000000..da35714 --- /dev/null +++ b/test/test_data/playground/grid-tiled/a/1-3.covjson @@ -0,0 +1,18 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [2, 2, 1], + "values": [ + + + 30, + 40, + + + + + 80, + 90 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/a/2-0.covjson b/test/test_data/playground/grid-tiled/a/2-0.covjson new file mode 100644 index 0000000..591de18 --- /dev/null +++ b/test/test_data/playground/grid-tiled/a/2-0.covjson @@ -0,0 +1,19 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [2, 1, 3], + "values": [ + + + + + 41, 42, 43, + + + + + + 91, 92, 93 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/a/2-1.covjson b/test/test_data/playground/grid-tiled/a/2-1.covjson new file mode 100644 index 0000000..45d10a5 --- /dev/null +++ b/test/test_data/playground/grid-tiled/a/2-1.covjson @@ -0,0 +1,19 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [2, 1, 3], + "values": [ + + + + + 44, 45, 46, + + + + + + 94, 95, 96 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/a/2-2.covjson b/test/test_data/playground/grid-tiled/a/2-2.covjson new file mode 100644 index 0000000..4df3a25 --- /dev/null +++ b/test/test_data/playground/grid-tiled/a/2-2.covjson @@ -0,0 +1,19 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [2, 1, 3], + "values": [ + + + + + 47, 48, 49, + + + + + + 97, 98, 99 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/a/2-3.covjson b/test/test_data/playground/grid-tiled/a/2-3.covjson new file mode 100644 index 0000000..45360cf --- /dev/null +++ b/test/test_data/playground/grid-tiled/a/2-3.covjson @@ -0,0 +1,19 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [2, 1, 1], + "values": [ + + + + + 50, + + + + + + 100 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/b/0.covjson b/test/test_data/playground/grid-tiled/b/0.covjson new file mode 100644 index 0000000..035ef99 --- /dev/null +++ b/test/test_data/playground/grid-tiled/b/0.covjson @@ -0,0 +1,13 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [1, 5, 10], + "values": [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/b/1.covjson b/test/test_data/playground/grid-tiled/b/1.covjson new file mode 100644 index 0000000..84a8172 --- /dev/null +++ b/test/test_data/playground/grid-tiled/b/1.covjson @@ -0,0 +1,13 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [1, 5, 10], + "values": [ + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid-tiled/c/all.covjson b/test/test_data/playground/grid-tiled/c/all.covjson new file mode 100644 index 0000000..cdcb308 --- /dev/null +++ b/test/test_data/playground/grid-tiled/c/all.covjson @@ -0,0 +1,19 @@ +{ + "type": "NdArray", + "dataType": "integer", + "axisNames": ["t", "y", "x"], + "shape": [2, 5, 10], + "values": [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 + ] +} \ No newline at end of file diff --git a/test/test_data/playground/grid.covjson b/test/test_data/playground/grid.covjson new file mode 100644 index 0000000..b0b9392 --- /dev/null +++ b/test/test_data/playground/grid.covjson @@ -0,0 +1,58 @@ +{ + "type" : "Coverage", + "domain" : { + "type" : "Domain", + "domainType" : "Grid", + "axes": { + "x" : { "values": [-10,-5,0] }, + "y" : { "values": [40,50] }, + "z" : { "values": [ 5] }, + "t" : { "values": ["2010-01-01T00:12:20Z"] } + }, + "referencing": [{ + "coordinates": ["y","x","z"], + "system": { + "type": "GeographicCRS", + "id": "http://www.opengis.net/def/crs/EPSG/0/4979" + } + }, { + "coordinates": ["t"], + "system": { + "type": "TemporalRS", + "calendar": "Gregorian" + } + }] + }, + "parameters" : { + "ICEC": { + "type" : "Parameter", + "description": { + "en": "Sea Ice concentration (ice=1;no ice=0)" + }, + "unit" : { + "label": { + "en": "Ratio" + }, + "symbol": { + "value": "1", + "type": "http://www.opengis.net/def/uom/UCUM/" + } + }, + "observedProperty" : { + "id" : "http://vocab.nerc.ac.uk/standard_name/sea_ice_area_fraction/", + "label" : { + "en": "Sea Ice Concentration" + } + } + } + }, + "ranges" : { + "ICEC" : { + "type" : "NdArray", + "dataType": "float", + "axisNames": ["t","z","y","x"], + "shape": [1, 1, 2, 3], + "values" : [ 0.5, 0.6, 0.4, 0.6, 0.2, null ] + } + } +} \ No newline at end of file diff --git a/test/test_data/playground/multipolygon.covjson b/test/test_data/playground/multipolygon.covjson new file mode 100644 index 0000000..b8addff --- /dev/null +++ b/test/test_data/playground/multipolygon.covjson @@ -0,0 +1,64 @@ +{ + "type" : "Coverage", + "domain": { + "type": "Domain", + "domainType": "MultiPolygon", + "axes": { + "composite": { + "dataType": "polygon", + "coordinates": ["x","y"], + "values": [ + [[[9.92,54.98],[9.93,54.59],[13.64,54.07],[15.01,51.10],[12.24,50.26], + [12.52,49.54],[13.59,48.87],[12.88,48.28],[13.02,47.63],[9.59,47.52], + [8.52,47.83],[7.46,47.62],[8.09,49.01],[6.18,49.46],[5.98,51.85], + [6.84,52.22],[7.10,53.69],[8.80,54.02],[8.52,54.96],[9.92,54.98]]], + [[[-3.00,58.63],[-1.95,57.68],[-2.08,55.90],[0.46,52.92],[1.68,52.73], + [0.55,50.76],[-3.61,50.22],[-5.26,51.99],[-3.63,54.61],[-5.58,55.31], + [-6.14,56.78],[-5.00,58.63],[-3.00,58.63]]] + ] + }, + "t" : { "values": ["2015"] } + }, + "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" : { + "TEMP": { + "type" : "Parameter", + "unit" : { + "label": { + "en": "Degree Celsius" + }, + "symbol": { + "value": "Cel", + "type": "http://www.opengis.net/def/uom/UCUM/" + } + }, + "observedProperty" : { + "label" : { + "en": "Average air temperature" + } + } + } + }, + "ranges" : { + "TEMP": { + "type" : "NdArray", + "dataType": "float", + "axisNames": ["composite"], + "shape": [2], + "values" : [ 22.8, 15.1 ] + } + } +} diff --git a/test/test_data/playground/point-collection.covjson b/test/test_data/playground/point-collection.covjson new file mode 100644 index 0000000..762311c --- /dev/null +++ b/test/test_data/playground/point-collection.covjson @@ -0,0 +1,115 @@ +{ + "type" : "CoverageCollection", + "domainType" : "Point", + "parameters" : { + "POTM": { + "type" : "Parameter", + "description" : { + "en": "The potential temperature, in degrees celsius, of the sea water" + }, + "unit" : { + "label": { + "en": "Degree Celsius" + }, + "symbol": { + "value": "Cel", + "type": "http://www.opengis.net/def/uom/UCUM/" + } + }, + "observedProperty" : { + "id" : "http://vocab.nerc.ac.uk/standard_name/sea_water_potential_temperature/", + "label" : { + "en": "Sea Water Potential Temperature" + } + } + }, + "QC": { + "type" : "Parameter", + "observedProperty" : { + "id": "http://mmisw.org/ont/argo/qualityFlag", + "label" : { + "en": "Argo Quality Control Flag" + }, + "categories": [{ + "id": "http://mmisw.org/ont/argo/qualityFlag/_0", + "label": { + "en": "No QC was performed" + } + }, { + "id": "http://mmisw.org/ont/argo/qualityFlag/_1", + "label": { + "en": "Good data" + } + }, { + "id": "http://mmisw.org/ont/argo/qualityFlag/_4", + "label": { + "en": "Bad data" + } + }] + }, + "categoryEncoding": { + "http://mmisw.org/ont/argo/qualityFlag/_0": 0, + "http://mmisw.org/ont/argo/qualityFlag/_1": 1, + "http://mmisw.org/ont/argo/qualityFlag/_4": 4 + } + } + }, + "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" + } + }], + "coverages": [{ + "type" : "Coverage", + "domain" : { + "type" : "Domain", + "axes": { + "x" : { "values": [-5.1] }, + "y" : { "values": [ -40.2] }, + "t" : { "values": ["2013-01-01"] } + } + }, + "ranges" : { + "POTM" : { + "type" : "NdArray", + "dataType": "float", + "values" : [ 23.8 ] + }, + "QC" : { + "type" : "NdArray", + "dataType": "integer", + "values" : [ 1 ] + } + } + }, { + "type" : "Coverage", + "domain" : { + "type" : "Domain", + "axes": { + "x" : { "values": [-5.1] }, + "y" : { "values": [ -39.2] }, + "t" : { "values": ["2013-01-01"] } + } + }, + "ranges" : { + "POTM" : { + "type" : "NdArray", + "dataType": "float", + "values" : [ 21.8 ] + }, + "QC" : { + "type" : "NdArray", + "dataType": "integer", + "values" : [ 0 ] + } + } + }] +} diff --git a/test/test_data/playground/point.covjson b/test/test_data/playground/point.covjson new file mode 100644 index 0000000..c05e3a2 --- /dev/null +++ b/test/test_data/playground/point.covjson @@ -0,0 +1,90 @@ +{ + "type" : "Coverage", + "domain" : { + "type" : "Domain", + "domainType" : "Point", + "axes": { + "x" : { "values": [-5.1] }, + "y" : { "values": [ -40.2] }, + "t" : { "values": ["2013-01-01"] } + }, + "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" : { + "POTM": { + "type" : "Parameter", + "description" : { + "en": "The potential temperature, in degrees celcius, of the sea water" + }, + "unit" : { + "label": { + "en": "Degree Celsius" + }, + "symbol": { + "value": "Cel", + "type": "http://www.opengis.net/def/uom/UCUM/" + } + }, + "observedProperty" : { + "id" : "http://vocab.nerc.ac.uk/standard_name/sea_water_potential_temperature/", + "label" : { + "en": "Sea Water Potential Temperature" + } + } + }, + "QC": { + "type" : "Parameter", + "observedProperty" : { + "id": "http://mmisw.org/ont/argo/qualityFlag", + "label" : { + "en": "Argo Quality Control Flag" + }, + "categories": [{ + "id": "http://mmisw.org/ont/argo/qualityFlag/_0", + "label": { + "en": "No QC was performed" + } + }, { + "id": "http://mmisw.org/ont/argo/qualityFlag/_1", + "label": { + "en": "Good data" + } + }, { + "id": "http://mmisw.org/ont/argo/qualityFlag/_4", + "label": { + "en": "Bad data" + } + }] + }, + "categoryEncoding": { + "http://mmisw.org/ont/argo/qualityFlag/_0": 0, + "http://mmisw.org/ont/argo/qualityFlag/_1": 1, + "http://mmisw.org/ont/argo/qualityFlag/_4": 4 + } + } + }, + "ranges" : { + "POTM" : { + "type" : "NdArray", + "dataType": "float", + "values" : [ 23.8 ] + }, + "QC" : { + "type" : "NdArray", + "dataType": "integer", + "values" : [ 1 ] + } + } +} \ No newline at end of file diff --git a/test/test_data/playground/pointseries.covjson b/test/test_data/playground/pointseries.covjson new file mode 100644 index 0000000..a224316 --- /dev/null +++ b/test/test_data/playground/pointseries.covjson @@ -0,0 +1,80 @@ +{ + "type" : "Coverage", + "domain" : { + "type" : "Domain", + "domainType" : "PointSeries", + "axes": { + "x" : { "values": [-10.1] }, + "y" : { "values": [ -40.2] }, + "t" : { "values": ["2013-01-01","2013-01-02","2013-01-03", + "2013-01-04","2013-01-05","2013-01-06"] } + }, + "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" : { + "PSAL": { + "type" : "Parameter", + "description" : { + "en": "The measured salinity, in practical salinity units (psu) of the sea water " + }, + "unit" : { + "symbol" : "psu" + }, + "observedProperty" : { + "id" : "http://vocab.nerc.ac.uk/standard_name/sea_water_salinity/", + "label" : { + "en": "Sea Water Salinity" + } + } + }, + "POTM": { + "type" : "Parameter", + "description" : { + "en": "The potential temperature, in degrees celcius, of the sea water" + }, + "unit" : { + "label": { + "en": "Degree Celsius" + }, + "symbol": { + "value": "Cel", + "type": "http://www.opengis.net/def/uom/UCUM/" + } + }, + "observedProperty" : { + "id" : "http://vocab.nerc.ac.uk/standard_name/sea_water_potential_temperature/", + "label" : { + "en": "Sea Water Potential Temperature" + } + } + } + }, + "ranges" : { + "PSAL" : { + "type" : "NdArray", + "dataType": "float", + "axisNames": ["t"], + "shape": [6], + "values" : [ 43.9599, 43.9599, 43.9640, 43.9640, 43.9679, 43.9879 ] + }, + "POTM" : { + "type" : "NdArray", + "dataType": "float", + "axisNames": ["t"], + "shape": [6], + "values" : [ 23.8, 23.7, 23.9, 23.4, 23.2, 22.4 ] + } + } +} \ No newline at end of file diff --git a/test/test_data/playground/polygonseries.covjson b/test/test_data/playground/polygonseries.covjson new file mode 100644 index 0000000..dc8bb07 --- /dev/null +++ b/test/test_data/playground/polygonseries.covjson @@ -0,0 +1,61 @@ +{ + "type" : "Coverage", + "domain": { + "type": "Domain", + "domainType": "PolygonSeries", + "axes": { + "composite": { + "dataType": "polygon", + "coordinates": ["x","y"], + "values": [ + [[[9.92,54.98],[9.93,54.59],[13.64,54.07],[15.01,51.10],[12.24,50.26], + [12.52,49.54],[13.59,48.87],[12.88,48.28],[13.02,47.63],[9.59,47.52], + [8.52,47.83],[7.46,47.62],[8.09,49.01],[6.18,49.46],[5.98,51.85], + [6.84,52.22],[7.10,53.69],[8.80,54.02],[8.52,54.96],[9.92,54.98]]] + ] + }, + "t" : { "values": ["2013","2014","2015"] } + }, + "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" : { + "TEMP": { + "type" : "Parameter", + "unit" : { + "label": { + "en": "Degree Celsius" + }, + "symbol": { + "value": "Cel", + "type": "http://www.opengis.net/def/uom/UCUM/" + } + }, + "observedProperty" : { + "label" : { + "en": "Average air temperature" + } + } + } + }, + "ranges" : { + "TEMP": { + "type" : "NdArray", + "dataType": "float", + "axisNames": ["t"], + "shape": [3], + "values" : [ 17.3, 18.8, 20.8] + } + } +} diff --git a/test/test_data/playground/profile-collection.covjson b/test/test_data/playground/profile-collection.covjson new file mode 100644 index 0000000..6fabd43 --- /dev/null +++ b/test/test_data/playground/profile-collection.covjson @@ -0,0 +1,92 @@ +{ + "type" : "CoverageCollection", + "parameters" : { + "PSAL": { + "type" : "Parameter", + "description" : { + "en": "The measured salinity, in practical salinity units (psu) of the sea water" + }, + "unit" : { + "symbol" : "psu" + }, + "observedProperty" : { + "id": "http://vocab.nerc.ac.uk/standard_name/sea_water_salinity/", + "label" : { + "en": "Sea Water Salinity" + } + } + } + }, + "referencing": [{ + "coordinates": ["x","y"], + "system": { + "type": "GeographicCRS", + "id": "http://www.opengis.net/def/crs/OGC/1.3/CRS84" + } + }, { + "coordinates": ["z"], + "system": { + "type": "VerticalCRS", + "cs": { + "csAxes": [{ + "name": { + "en": "Pressure" + }, + "direction": "down", + "unit": { + "symbol": "Pa" + } + }] + } + } + }, { + "coordinates": ["t"], + "system": { + "type": "TemporalRS", + "calendar": "Gregorian" + } + }], + "domainType" : "VerticalProfile", + "coverages": [ + { + "type" : "Coverage", + "domain" : { + "type": "Domain", + "axes": { + "x": { "values": [-10.1] }, + "y": { "values": [-40.2] }, + "z": { "values": [ 5, 8, 14 ] }, + "t": { "values": ["2013-01-13T11:12:20Z"] } + } + }, + "ranges" : { + "PSAL" : { + "type" : "NdArray", + "dataType": "float", + "axisNames": ["z"], + "shape": [3], + "values" : [ 43.7, 43.8, 43.9 ] + } + } + }, { + "type" : "Coverage", + "domain" : { + "type": "Domain", + "axes": { + "x": { "values": [-11.1] }, + "y": { "values": [-45.2] }, + "z": { "values": [ 4, 7, 9 ] }, + "t": { "values": ["2013-01-13T12:12:20Z"] } + } + }, + "ranges" : { + "PSAL" : { + "type" : "NdArray", + "dataType": "float", + "axisNames": ["z"], + "shape": [3], + "values" : [ 42.7, 41.8, 40.9 ] + } + } + }] +} \ No newline at end of file diff --git a/test/test_data/playground/profile.covjson b/test/test_data/playground/profile.covjson new file mode 100644 index 0000000..40fdf90 --- /dev/null +++ b/test/test_data/playground/profile.covjson @@ -0,0 +1,104 @@ +{ + "type" : "Coverage", + "domain" : { + "type" : "Domain", + "domainType" : "VerticalProfile", + "axes": { + "x" : { "values": [-10.1] }, + "y" : { "values": [ -40.2] }, + "z" : { "values": [ + 5.4562, 8.9282, 14.8802, 20.8320, 26.7836, 32.7350, + 38.6863, 44.6374, 50.5883, 56.5391, 62.4897, 68.4401, + 74.3903, 80.3404, 86.2902, 92.2400, 98.1895, 104.1389, + 110.0881, 116.0371, 121.9859 ] }, + "t" : { "values": ["2013-01-13T11:12:20Z"] } + }, + "referencing": [{ + "coordinates": ["x","y"], + "system": { + "type": "GeographicCRS", + "id": "http://www.opengis.net/def/crs/OGC/1.3/CRS84" + } + }, { + "coordinates": ["z"], + "system": { + "type": "VerticalCRS", + "cs": { + "csAxes": [{ + "name": { + "en": "Pressure" + }, + "direction": "down", + "unit": { + "symbol": "Pa" + } + }] + } + } + }, { + "coordinates": ["t"], + "system": { + "type": "TemporalRS", + "calendar": "Gregorian" + } + }] + }, + "parameters" : { + "PSAL": { + "type" : "Parameter", + "description" : { + "en": "The measured salinity, in practical salinity units (psu) of the sea water " + }, + "unit" : { + "symbol" : "psu" + }, + "observedProperty" : { + "id" : "http://vocab.nerc.ac.uk/standard_name/sea_water_salinity/", + "label" : { + "en": "Sea Water Salinity" + } + } + }, + "POTM": { + "type" : "Parameter", + "description" : { + "en": "The potential temperature, in degrees celsius, of the sea water" + }, + "unit" : { + "label": { + "en": "Degree Celsius" + }, + "symbol": { + "value": "Cel", + "type": "http://www.opengis.net/def/uom/UCUM/" + } + }, + "observedProperty" : { + "id" : "http://vocab.nerc.ac.uk/standard_name/sea_water_potential_temperature/", + "label" : { + "en": "Sea Water Potential Temperature" + } + } + } + }, + "ranges" : { + "PSAL" : { + "type" : "NdArray", + "dataType": "float", + "axisNames": ["z"], + "shape": [21], + "values" : [ 43.9599, 43.9599, 43.9640, 43.9640, 43.9679, 43.9879, 44.0040, + 44.0120, 44.0120, 44.0159, 44.0320, 44.0320, 44.0480, 44.0559, + 44.0559, 44.0579, 44.0680, 44.0740, 44.0779, 44.0880, 44.0940 ] + }, + "POTM" : { + "type" : "NdArray", + "dataType": "float", + "axisNames": ["z"], + "shape": [21], + "values" : [ 23.8, 23.7, 23.5, 23.4, 23.2, 22.4, 21.8, + 21.7, 21.5, 21.3, 21.0, 20.6, 20.1, 19.7, + 19.4, 19.1, 18.9, 18.8, 18.7, 18.6, 18.5 ] + } + } +} diff --git a/test/test_data/playground/trajectory.covjson b/test/test_data/playground/trajectory.covjson new file mode 100644 index 0000000..8768c93 --- /dev/null +++ b/test/test_data/playground/trajectory.covjson @@ -0,0 +1,63 @@ +{ + "type" : "Coverage", + "domain" : { + "type" : "Domain", + "domainType" : "Trajectory", + "axes": { + "composite": { + "dataType": "tuple", + "coordinates": ["t","x","y","z"], + "values": [ + ["2010-01-01T00:12:20Z", -10, 40, 5], + ["2010-01-01T00:14:20Z", -5, 50, 4], + ["2010-01-01T00:16:20Z", -6, 50, 5] + ] + } + }, + "referencing": [{ + "coordinates": ["t"], + "system": { + "type": "TemporalRS", + "calendar": "Gregorian" + } + }, { + "coordinates": ["y","x","z"], + "system": { + "type": "GeographicCRS", + "id": "http://www.opengis.net/def/crs/EPSG/0/4979" + } + }] + }, + "parameters" : { + "ICEC": { + "type" : "Parameter", + "description" : { + "en": "Sea Ice concentration (ice=1;no ice=0)" + }, + "unit" : { + "label": { + "en": "Ratio" + }, + "symbol": { + "value": "1", + "type": "http://www.opengis.net/def/uom/UCUM/" + } + }, + "observedProperty" : { + "id" : "http://vocab.nerc.ac.uk/standard_name/sea_ice_area_fraction/", + "label" : { + "en": "Sea Ice Concentration" + } + } + } + }, + "ranges" : { + "ICEC" : { + "type" : "NdArray", + "dataType": "float", + "axisNames": ["composite"], + "shape": [3], + "values" : [ 0.1, 0.2, 0.1 ] + } + } +} \ No newline at end of file diff --git a/test/test_playground_coverages.py b/test/test_playground_coverages.py new file mode 100644 index 0000000..a5e4345 --- /dev/null +++ b/test/test_playground_coverages.py @@ -0,0 +1,27 @@ +# Tests the Coverage objects that are used in the playground, as a sanity check + +import os +from jsonschema import ValidationError +import pytest +import json + +pytestmark = pytest.mark.schema("/schemas/coveragejson") + +def test_all_playground_coverages(validator): + + # Recursively traverse the test_data/playground directory + rootpath = os.path.join(os.path.dirname(__file__), "test_data", "playground") + for subdir, dirs, files in os.walk(rootpath): + + # Look only at .covjson files + for file in (file for file in files if file.endswith(".covjson")): + + # Construct the full file path + fullpath = os.path.join(subdir, file) + + # Load the JSON + with open(fullpath) as f: + j = json.load(f) + + # Validate the JSON + validator.validate(j)