Skip to content

Commit

Permalink
net2cog - Ensure test suite does not fail for unconfigured environments.
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Matt Savoie <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 31, 2024
1 parent 756aca7 commit 1910e65
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 38 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ versioning. Rather than a static releases, this repository contains of a number
of regression tests that are each semi-independent. This CHANGELOG file should be used
to document pull requests to this repository.

## 2024-10-31 ([#107](https://github.com/nasa/harmony-regression-tests/pull/107))

- Updates the net2cog regression test suite to ensure that failures do not
happen for environments against which the test suite is not configured. Prior
to this change an undefined variable was causing issues when running the test
suite against production.

## 2024-10-30 ([#111](https://github.com/nasa/harmony-regression-tests/pull/111))

- Updates the swath-projector epsg reference file
Expand Down
73 changes: 36 additions & 37 deletions test/net2cog/net2cog_Regression.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@
" print(harmony_client.request_as_curl(smap_request))\n",
"\n",
" smap_job_id = harmony_client.submit(smap_request)\n",
" harmony_client.wait_for_processing(smap_job_id, show_progress=True)"
" harmony_client.wait_for_processing(smap_job_id, show_progress=True)\n",
"else:\n",
" print('Skipping test: net2cog is not configured for environment')"
]
},
{
Expand All @@ -175,35 +177,38 @@
"metadata": {},
"outputs": [],
"source": [
"with TemporaryDirectory() as temp_dir:\n",
" downloaded_cog_outputs = [\n",
" file_future.result()\n",
" for file_future in harmony_client.download_all(\n",
" smap_job_id, overwrite=True, directory=temp_dir\n",
" )\n",
" ]\n",
"if environment_information is not None:\n",
" with TemporaryDirectory() as temp_dir:\n",
" downloaded_cog_outputs = [\n",
" file_future.result()\n",
" for file_future in harmony_client.download_all(\n",
" smap_job_id, overwrite=True, directory=temp_dir\n",
" )\n",
" ]\n",
"\n",
" for cog_file in downloaded_cog_outputs:\n",
" utility.validate_cog(cog_file)\n",
" for cog_file in downloaded_cog_outputs:\n",
" utility.validate_cog(cog_file)\n",
"\n",
" expected_metadata = {\n",
" 'driver': 'GTiff',\n",
" 'dtype': 'float32',\n",
" 'nodata': -9999.0,\n",
" 'width': 1440,\n",
" 'height': 720,\n",
" 'count': 1,\n",
" 'crs': CRS.from_epsg(4326),\n",
" 'transform': Affine(0.25, 0.0, 0.0, 0.0, 0.25, -90.0),\n",
" }\n",
" reference_file = Path(\n",
" './reference_data',\n",
" 'RSS_smap_SSS_L3_8day_running_2020_005_FNL_v04.0_converted_sss_smap.tiff',\n",
" )\n",
" expected_metadata = {\n",
" 'driver': 'GTiff',\n",
" 'dtype': 'float32',\n",
" 'nodata': -9999.0,\n",
" 'width': 1440,\n",
" 'height': 720,\n",
" 'count': 1,\n",
" 'crs': CRS.from_epsg(4326),\n",
" 'transform': Affine(0.25, 0.0, 0.0, 0.0, 0.25, -90.0),\n",
" }\n",
" reference_file = Path(\n",
" './reference_data',\n",
" 'RSS_smap_SSS_L3_8day_running_2020_005_FNL_v04.0_converted_sss_smap.tiff',\n",
" )\n",
"\n",
" utility.assert_dataset_produced_correct_results(\n",
" cog_file, expected_metadata, reference_file\n",
" )"
" utility.assert_dataset_produced_correct_results(\n",
" cog_file, expected_metadata, reference_file\n",
" )\n",
"else:\n",
" print('Skipping verification: net2cog is not configured for this environment')"
]
},
{
Expand Down Expand Up @@ -249,16 +254,10 @@
" assert (\n",
" raised_expected_error\n",
" ), 'Expected request to raise an exception but it did not.'\n",
" utility.print_success('All variables raised expected error')"
" utility.print_success('All variables raised expected error')\n",
"else:\n",
" print('Skipping test: net2cog is not configured for environment')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a0caf714",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -278,7 +277,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
"version": "3.10.15"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion test/net2cog/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.1
0.1.2

0 comments on commit 1910e65

Please sign in to comment.