From e69de78eae202f57d24c9e03e24216bc03794bb4 Mon Sep 17 00:00:00 2001 From: Yonggang Liu Date: Fri, 31 May 2024 14:54:53 -0400 Subject: [PATCH] HARMONY-1746: As a Harmony developer I want a regression test for the Harmony OGC EDR API. --- .../HarmonyRegression.ipynb | 90 +++++++++++++++---- 1 file changed, 72 insertions(+), 18 deletions(-) diff --git a/test/harmony-regression/HarmonyRegression.ipynb b/test/harmony-regression/HarmonyRegression.ipynb index 9d693f3..e3a9573 100644 --- a/test/harmony-regression/HarmonyRegression.ipynb +++ b/test/harmony-regression/HarmonyRegression.ipynb @@ -60,6 +60,7 @@ "outputs": [], "source": [ "coverages_root = '{root}/{collection}/ogc-api-coverages/1.0.0/collections/{variable}/coverage/rangeset'\n", + "edr_root = '{root}/ogc-api-edr/1.1.0/collections/{collection}/cube'\n", "\n", "if harmony_host_url == 'https://harmony.earthdata.nasa.gov':\n", " is_not_prod = False\n", @@ -119,7 +120,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Sample Sync Request - Bounding Box and Temporal Subsetting with Reformatting\n", + "### Sample OGC Coverages Sync Request - Bounding Box and Temporal Subsetting with Reformatting\n", "\n", "harmony/service-example only working in UAT due to Harmony-600." ] @@ -136,8 +137,8 @@ " #By default, this reformats to tiff\n", " params = {\n", " 'subset': [\n", - " 'lon(-20:90)', \n", - " 'lat(0:60)', \n", + " 'lon(-20:90)',\n", + " 'lat(0:60)',\n", " 'time(\"2020-01-15T00:00:00Z\":\"2020-01-15T01:00:00Z\")'\n", " ]\n", " }\n", @@ -157,9 +158,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "if is_not_prod:\n", @@ -175,6 +174,61 @@ " show(response, color_index=1)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Sample OGC EDR Sync Request - Bounding Box and Temporal Subsetting with Reformatting\n", + "\n", + "harmony/service-example only working in UAT due to Harmony-600." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "if is_not_prod:\n", + " #By default, this reformats to tiff\n", + " response = get(\n", + " edr_root.format(\n", + " root=harmony_host_url,\n", + " collection=l3_collection\n", + " ),\n", + " params={\n", + " 'bbox': '-20,0,90,60',\n", + " 'datetime': '2020-01-15T00:00:00Z/2020-01-15T01:00:00Z'\n", + " }\n", + " )\n", + "\n", + " show(response, example_vars)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "if is_not_prod:\n", + " response = get(\n", + " edr_root.format(\n", + " root=harmony_host_url,\n", + " collection=l3_collection\n", + " ),\n", + " params={\n", + " 'bbox': '-20,0,90,60',\n", + " 'datetime': '2020-01-15T00:00:00Z/2020-01-15T01:00:00Z',\n", + " 'parameter-name': 'green_var'\n", + " }\n", + " )\n", + "\n", + " show(response, color_index=1)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -196,13 +250,13 @@ " response = get(\n", " coverages_root.format(\n", " root=harmony_host_url,\n", - " collection=l3_collection, \n", + " collection=l3_collection,\n", " variable='all'\n", - " ), \n", + " ),\n", " params={\n", " 'subset': [\n", - " 'lon(-20:90)', \n", - " 'lat(0:60)', \n", + " 'lon(-20:90)',\n", + " 'lat(0:60)',\n", " 'time(\"2020-01-01T00:00:00Z\":\"2020-01-05T01:00:00Z\")'\n", " ]\n", " }\n", @@ -289,9 +343,9 @@ "zarr_response = get(\n", " coverages_root.format(\n", " root=harmony_host_url,\n", - " collection=l3_zarr_collection, \n", + " collection=l3_zarr_collection,\n", " variable='all'\n", - " ), \n", + " ),\n", " params={\n", " 'subset': 'time(\"2020-01-15T00:00:00Z\":\"2020-01-16T01:00:00Z\")',\n", " 'maxResults': '3'\n", @@ -407,13 +461,13 @@ "response = get(\n", " coverages_root.format(\n", " root=harmony_host_url,\n", - " collection=l2ss_collection, \n", + " collection=l2ss_collection,\n", " variable='all'\n", - " ), \n", + " ),\n", " params={\n", " 'maxResults': '1',\n", " 'subset': [\n", - " 'lon(-160:160)', \n", + " 'lon(-160:160)',\n", " 'lat(-80:80)',\n", " 'time(\"2012-03-03T12:17:00\":\"2012-03-03T12:18:00\")'\n", " ]\n", @@ -444,14 +498,14 @@ "response = get(\n", " coverages_root.format(\n", " root=harmony_host_url,\n", - " collection=l2ss_collection, \n", + " collection=l2ss_collection,\n", " variable='all'\n", - " ), \n", + " ),\n", " params={\n", " 'maxResults': '3',\n", " 'format': 'application/x-netcdf4',\n", " 'subset': [\n", - " 'lon(-160:160)', \n", + " 'lon(-160:160)',\n", " 'lat(-80:80)',\n", " 'time(\"2012-03-03T00:00:00Z\":\"2012-03-03T02:59:59Z\")'\n", " ]\n",