Skip to content

Commit

Permalink
DAS-2214: Adds Prod configuration to nsidc-icesat2 tests. (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
flamingbear authored Oct 7, 2024
1 parent b26523d commit e2fc10c
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 25 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ A short description of the changes in this PR...
* [ ] Acceptance criteria met
* [ ] Tests added/updated (if needed) and passing
* [ ] Documentation updated (if needed)
* [ ] CHANGELOG updated with the changes for this PR
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ 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-02 ([#99](https://github.com/nasa/harmony-regression-tests/pull/99))

- Adds NSIDC ICESat2 Production Regression configuration.
- Updates the `shared_utils` function `compare_results_to_reference_file_new`
to take a new optional argument `identical` which defaults to `True` but if
set to `False` the Datatree comparison falls back to an `equals` test
ignoring metadata in its reference file comparions.


## 2024-09-24 ([#92](https://github.com/nasa/harmony-regression-tests/pull/92))

- Adds NSIDC ICESat2 Regression test suite.
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ locally in the browser against a single service regression test.

## Install Prerequisites

* [Docker](https://www.docker.com/get-started) (to run locally in docker)
* [git-lfs](https://git-lfs.com/) (to handle large files)
* [Docker](https://www.docker.com/get-started) - to run locally in docker
* [git-lfs](https://git-lfs.com/) - to handle large files
* [pre-commit](https://pre-commit.com/) - to ensure code formatting. [See below](#pre-commit-hooks).


### Cloning the repostiory.
Expand Down
130 changes: 114 additions & 16 deletions test/nsidc-icesat2/NSIDC-ICESAT2_Regression.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "cc20331c-0f04-4d38-8a38-96431fde6088",
"id": "6b57af2f-0eef-4f4b-8699-4c0159c3fece",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -168,7 +168,7 @@
" },\n",
" 'ATL12': {\n",
" 'collection_concept_id': Collection(id='C1256476536-NSIDC_CUAT'),\n",
" 'granule_id': 'G1263137424-NSIDC_CUAT',\n",
" 'granule_id': 'G1263992202-NSIDC_CUAT',\n",
" 'spatial': BBox(-79.0, 27.0, -77.0, 34.0),\n",
" },\n",
" 'ATL13': {\n",
Expand Down Expand Up @@ -220,10 +220,109 @@
" 'shape': 'ancillary/Ross_Sea_positive_lon_only.geojson',\n",
" },\n",
" },\n",
"}\n",
"\n",
"\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7977dccf-9568-43ea-97c1-f8dc1bb93e6b",
"metadata": {},
"outputs": [],
"source": [
"production_configuration = {\n",
" 'subset_bounding_box': {\n",
" 'ATL03': {\n",
" 'collection_concept_id': Collection(id='C2596864127-NSIDC_CPRD'),\n",
" 'granule_id': 'G2632805836-NSIDC_CPRD',\n",
" 'spatial': BBox(-105.5, 40.0, -105.0, 40.005),\n",
" },\n",
" 'ATL07': {\n",
" 'collection_concept_id': Collection(id='C2713030505-NSIDC_CPRD'),\n",
" 'granule_id': 'G2738665484-NSIDC_CPRD',\n",
" 'spatial': BBox(-112.0, 80.0, -93.0, 80.3),\n",
" },\n",
" 'ATL08': {\n",
" 'collection_concept_id': Collection(id='C2613553260-NSIDC_CPRD'),\n",
" 'granule_id': 'G2645102344-NSIDC_CPRD',\n",
" 'spatial': BBox(-105.5, 40.0, -105.0, 40.25),\n",
" },\n",
" # Blocked by DAS-2244: and PROD need UMM-S configuration\n",
" # 'ATL10': {\n",
" # 'collection_concept_id': Collection(id='C2613553243-NSIDC_CPRD'),\n",
" # 'granule_id': 'G2738637140-NSIDC_CPRD',\n",
" # 'spatial': BBox(161.0, -75.0, 171.0, -74.0),\n",
" # },\n",
" 'ATL12': {\n",
" 'collection_concept_id': Collection(id='C2613553216-NSIDC_CPRD'),\n",
" 'granule_id': 'G2952685768-NSIDC_CPRD',\n",
" 'spatial': BBox(-79.0, 27.0, -77.0, 34.0),\n",
" },\n",
" 'ATL13': {\n",
" 'collection_concept_id': Collection(id='C2684928243-NSIDC_CPRD'),\n",
" 'granule_id': 'G2720556827-NSIDC_CPRD',\n",
" 'spatial': BBox(-89.0, 43.0, -75.0, 45.0),\n",
" },\n",
" },\n",
" 'subset_by_temporal_range': {\n",
" 'ATL04': {\n",
" 'collection_concept_id': Collection(id='C2613553327-NSIDC_CPRD'),\n",
" 'granule_id': 'G2634053936-NSIDC_CPRD',\n",
" 'temporal': {\n",
" 'start': datetime.fromisoformat(\"2020-04-08T08:00:00.000Z\"),\n",
" 'stop': datetime.fromisoformat(\"2020-04-08T08:05:00.000Z\"),\n",
" },\n",
" 'coords_to_rename': ['delta_time'],\n",
" },\n",
" # BLOCKED by https://bugs.earthdata.nasa.gov/browse/DAS-2233\n",
" # 'ATL08': {\n",
" # 'collection_concept_id': Collection(id='C2613553260-NSIDC_CPRD'),\n",
" # 'granule_id': 'G1261385533-NSIDC_CUAT-TBD',\n",
" # 'temporal': {\n",
" # 'start': datetime.fromisoformat(\"2022-07-31T23:01:00.000Z\"),\n",
" # 'stop': datetime.fromisoformat(\"2022-07-31T23:01:10.000Z\"),\n",
" # },\n",
" # 'coords_to_rename': [],\n",
" # },\n",
" },\n",
" 'subset_by_shapefile': {\n",
" 'ATL06': {\n",
" 'collection_concept_id': Collection(id='C2670138092-NSIDC_CPRD'),\n",
" 'granule_id': 'G2674250298-NSIDC_CPRD',\n",
" 'shape': 'ancillary/Iceland_sliver.zip',\n",
" },\n",
" 'ATL08': {\n",
" 'collection_concept_id': Collection(id='C2613553260-NSIDC_CPRD'),\n",
" 'granule_id': 'G2640057431-NSIDC_CPRD',\n",
" 'shape': 'ancillary/SriLanka_simple.kml',\n",
" },\n",
" 'ATL09': {\n",
" 'collection_concept_id': Collection(id='C2649212495-NSIDC_CPRD'),\n",
" 'granule_id': 'G2666419430-NSIDC_CPRD',\n",
" 'shape': 'ancillary/Tasmania_sliver.geojson',\n",
" },\n",
" # Blocked by DAS-2244: and PROD need UMM-S configuration\n",
" # 'ATL10': {\n",
" # 'collection_concept_id': Collection(id='C2613553243-NSIDC_CPRD'),\n",
" # 'granule_id': 'G2738637140-NSIDC_CPRD',\n",
" # 'shape': 'ancillary/Ross_Sea_positive_lon_only.geojson',\n",
" # },\n",
" },\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1bcb56c0-f6f6-411a-9bfd-3f867bfe235a",
"metadata": {},
"outputs": [],
"source": [
"environment_configuration = {\n",
" 'https://harmony.earthdata.nasa.gov': {\n",
" **production_configuration,\n",
" 'env': Environment.PROD,\n",
" },\n",
" 'https://harmony.uat.earthdata.nasa.gov': {\n",
" **non_production_configuration,\n",
" 'env': Environment.UAT,\n",
Expand Down Expand Up @@ -286,7 +385,9 @@
" assert exists(\n",
" test_output\n",
" ), 'Unsuccessful Harmony Request: {shortname}: {test_name}'\n",
" compare_results_to_reference_file_new(test_output, test_reference)\n",
" compare_results_to_reference_file_new(\n",
" test_output, test_reference, identical=False\n",
" )\n",
" print_success(f'{shortname} {test_name} test request.')\n",
"\n",
" print_success(f'{test_name} test suite.')\n",
Expand Down Expand Up @@ -339,7 +440,10 @@
" test_output\n",
" ), 'Unsuccessful Harmony Request: {shortname}: {test_name}'\n",
" compare_results_to_reference_file_new(\n",
" test_output, test_reference, test_config['coords_to_rename']\n",
" test_output,\n",
" test_reference,\n",
" identical=False,\n",
" coordinates_to_fix=test_config['coords_to_rename'],\n",
" )\n",
" print_success(f'{shortname} {test_name} test request.')\n",
"\n",
Expand Down Expand Up @@ -392,7 +496,9 @@
" assert exists(\n",
" test_output\n",
" ), 'Unsuccessful Harmony Request: {shortname}: {test_name}'\n",
" compare_results_to_reference_file_new(test_output, test_reference, [])\n",
" compare_results_to_reference_file_new(\n",
" test_output, test_reference, identical=False, coordinates_to_fix=[]\n",
" )\n",
" print_success(f'{shortname} {test_name} test request.')\n",
"\n",
" print_success(f'{test_name} test suite.')\n",
Expand All @@ -401,14 +507,6 @@
" f'Bounding box tests not configured for environment: {harmony_environment} - skipping tests'\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cf49d848-f90e-46e5-b13f-5f7d1eaf9e1c",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Git LFS file not shown
2 changes: 1 addition & 1 deletion test/nsidc-icesat2/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.1
0.0.2
17 changes: 13 additions & 4 deletions test/shared_utils/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,17 @@ def compare_results_to_reference_file(
def compare_results_to_reference_file_new(
results_file_name: str,
reference_file_name: str,
coordinates_to_fix: list[str | None] = [],
identical: bool = True,
coordinates_to_fix: list[str] | None = None,
) -> None:
"""Use `DataTree` functionality to compare data values, variables,
coordinates, metadata, and all their corresponding attributes of
downloaded results to a reference file.
"""
if coordinates_to_fix is None:
coordinates_to_fix = []

reference_groups = open_groups(reference_file_name)
results_groups = open_groups(results_file_name)

Expand All @@ -100,9 +104,14 @@ def compare_results_to_reference_file_new(
reference_data = DataTree.from_dict(reference_groups)
results_data = DataTree.from_dict(results_groups)

assert results_data.identical(reference_data), (
'Output and reference files ' 'do not match.'
)
if identical:
assert results_data.identical(
reference_data
), 'Output and reference files do not match.'
else:
assert results_data.equals(
reference_data
), 'Output and reference files do not match.'

reference_data = None
results_data = None
Expand Down

0 comments on commit e2fc10c

Please sign in to comment.