Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net2cog - Ensure test suite does not fail for unconfigured environments. #107

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-21 ([#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-16 ([#105](https://github.com/nasa/harmony-regression-tests/pull/105))

- Updates the HyBIG regression test suite to include a test specifying a variable
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