Skip to content

Commit 485672b

Browse files
GITC-7375: Added new HyBIG regression tests (#229)
* GITC-7375: Added new regression tests, modified reference data for PREFIRE test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * GITC-7375: Updated changelog and service version * GITC-7375: Updated parameters for colormap test, added note about RGBA collection from ASF * GITC-7375: Removed trailing cell from HyBIG regression notebook --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent a6d62ea commit 485672b

File tree

57 files changed

+327
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+327
-102
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ versioning. Rather than a static releases, this repository contains of a number
55
of regression tests that are each semi-independent. This CHANGELOG file should be used
66
to document pull requests to this repository.
77

8+
## 2025-11-10 [229](https://github.com/nasa/harmony-regression-tests/pull/229)
9+
10+
### Changed
11+
12+
- Updates the HyBIG regression tests to add several new tests, as well as associated reference data.
13+
- Modified the PREFIRE regression test reference data to account for new nodata index behavior implemented in
14+
[GITC-8020](https://bugs.earthdata.nasa.gov/browse/GITC-8020), part of [HyBIG 2.4.2](https://github.com/nasa/harmony-browse-image-generator/releases/tag/2.4.2)
15+
16+
817
## 2025-10-15 [224](https://github.com/nasa/harmony-regression-tests/pull/224)
918

1019
### Changed

test/hybig/HyBIG_Regression.ipynb

Lines changed: 209 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,20 @@
115115
" 'aster_collection': Collection(id='C1256584478-EEDTEST'),\n",
116116
" 'measures_collection': Collection(id='C1258119317-EEDTEST'),\n",
117117
" 'prefire_collection': Collection(id='C1263096190-EEDTEST'),\n",
118+
" 'antimeridian_collection': Collection(id='C1264760805-POCLOUD'),\n",
119+
" 'rgba_collection': Collection(id='C1259974840-ASF'),\n",
118120
"}\n",
119121
"\n",
120122
"non_prod_granule_data = {\n",
121123
" 'aster_granules': ['G1256584570-EEDTEST'],\n",
122124
" 'measures_granules': ['G1258119387-EEDTEST'],\n",
123125
" 'prefire_granules': ['G1263096192-EEDTEST'],\n",
126+
" 'antimeridian_granules': ['G1273054128-POCLOUD'],\n",
127+
" 'rgba_granules': ['G1269604594-ASF'],\n",
124128
"}\n",
125129
"\n",
126130
"non_prod_variable_data = {\n",
127-
" 'prefire_variable': 'Flx/olr',\n",
131+
" 'prefire_variable': 'flx',\n",
128132
"}\n",
129133
"\n",
130134
"collection_data = {\n",
@@ -766,11 +770,11 @@
766770
"id": "c567bc0e",
767771
"metadata": {},
768772
"source": [
769-
"### Test that demonstrates variable selection for custom colour maps:\n",
773+
"### Test that demonstrates variable selection for custom colour maps and ±80° granule:\n",
770774
"\n",
771775
"This test will run a request that specifies a variable for HyBIG to use. It is a bit of a quirky way to ensure HyBIG has access to the related URL for a custom colour map. The output should be in colour rather than greyscale.\n",
772776
"\n",
773-
"PREFIRE granules also cover the whole Earth at sufficient resolution such that HyBIG will create tiled output, so there will be 15 tiles generated (3 rows, 5 columns).\n",
777+
"PREFIRE granules also cover the whole Earth at sufficient resolution such that HyBIG will create tiled output, so there will be 15 tiles generated (3 rows, 5 columns), with data covering an area above ±80° latitude.\n",
774778
"\n",
775779
"This test primarily seeks to ensure the values in the output images use the colour map specified in the related URLs of the specified [UMM-Var record](https://cmr.uat.earthdata.nasa.gov/search/variables.umm_json?concept_id=V1270130943-LARC_CLOUD)."
776780
]
@@ -782,38 +786,27 @@
782786
"metadata": {},
783787
"outputs": [],
784788
"source": [
785-
"'''This test appears to have been broken prior to 2.4.0, so disabling it.\n",
786789
"if environment_information is not None:\n",
787790
" prefire_basename = 'PREFIRE_SAT2_2B-FLX_S07_R00_20210721013413_03040.nc.G00'\n",
788791
"\n",
789-
" prefire_tiles = [\n",
790-
" f'{prefire_basename}.r00c00',\n",
791-
" f'{prefire_basename}.r00c01',\n",
792-
" f'{prefire_basename}.r00c02',\n",
793-
" f'{prefire_basename}.r00c03',\n",
794-
" f'{prefire_basename}.r00c04',\n",
795-
" f'{prefire_basename}.r01c00',\n",
796-
" f'{prefire_basename}.r01c01',\n",
797-
" f'{prefire_basename}.r01c02',\n",
798-
" f'{prefire_basename}.r01c03',\n",
799-
" f'{prefire_basename}.r01c04',\n",
800-
" f'{prefire_basename}.r02c00',\n",
801-
" f'{prefire_basename}.r02c01',\n",
802-
" f'{prefire_basename}.r02c02',\n",
803-
" f'{prefire_basename}.r02c03',\n",
804-
" f'{prefire_basename}.r02c04',\n",
805-
" ]\n",
792+
" prefire_tiles = []\n",
793+
" for r in range(3):\n",
794+
" for c in range(5):\n",
795+
" prefire_tiles.append(f'{prefire_basename}.r{r:02d}c{c:02d}')\n",
806796
"\n",
807797
" colour_map_reference_dir = reference_dir / 'colour_map'\n",
808798
"\n",
809799
" colour_map_request = Request(\n",
810800
" collection=environment_information['prefire_collection'],\n",
811801
" granule_id=environment_information['prefire_granules'][0],\n",
812802
" variables=[environment_information['prefire_variable']],\n",
803+
" height=9000,\n",
804+
" width=18000,\n",
805+
" crs='EPSG:4326',\n",
813806
" format='image/png',\n",
814807
" )\n",
815808
"\n",
816-
" colour_map_job_id = harmony_client.submit(colour_map_request)\n",
809+
" colour_map_job_id = str(harmony_client.submit(colour_map_request))\n",
817810
" harmony_client.wait_for_processing(colour_map_job_id, show_progress=True)\n",
818811
"\n",
819812
" with TemporaryDirectory() as temp_dir:\n",
@@ -843,15 +836,205 @@
843836
" 'Conversion of PREFIRE GeoTIFF to PNG using custom colour map. Success'\n",
844837
" )\n",
845838
"else:\n",
846-
" print('Skipping test: HyBIG regression tests not configured for this environment.')\n",
847-
"'''"
839+
" print('Skipping test: HyBIG regression tests not configured for this environment.')"
840+
]
841+
},
842+
{
843+
"cell_type": "markdown",
844+
"id": "a4e5822b",
845+
"metadata": {},
846+
"source": [
847+
"### Test Polar Projection for browse image\n",
848+
"\n",
849+
"This test will run the same PREFIRE granule as the previous test, but using the North Polar Stereographic Projection at the output coordinate reference system (CRS). This also requires using the scaleExtent keyword, which is required for polar projections."
850+
]
851+
},
852+
{
853+
"cell_type": "code",
854+
"execution_count": null,
855+
"id": "593b216f",
856+
"metadata": {},
857+
"outputs": [],
858+
"source": [
859+
"if environment_information is not None:\n",
860+
" prefire_basename = 'PREFIRE_SAT2_2B-FLX_S07_R00_20210721013413_03040.nc.G00'\n",
861+
" polar_extent = [-4194304.0, -4194304.0, 4194304.0, 4194304.0]\n",
862+
"\n",
863+
" # Polar projections have square output dimensions, while geographic projection has rectangular dimensions (2x wider than height)\n",
864+
" # We expect to receive a single tile.\n",
865+
" prefire_tiles = [prefire_basename]\n",
866+
"\n",
867+
" polar_reference_dir = reference_dir / 'polar'\n",
868+
"\n",
869+
" polar_request = Request(\n",
870+
" collection=environment_information['prefire_collection'],\n",
871+
" granule_id=environment_information['prefire_granules'][0],\n",
872+
" variables=[environment_information['prefire_variable']],\n",
873+
" scale_extent=polar_extent,\n",
874+
" crs='EPSG:3413',\n",
875+
" format='image/png',\n",
876+
" )\n",
877+
"\n",
878+
" polar_job_id = str(harmony_client.submit(polar_request))\n",
879+
" harmony_client.wait_for_processing(polar_job_id, show_progress=True)\n",
880+
"\n",
881+
" with TemporaryDirectory() as temp_dir:\n",
882+
" downloaded_colour_map_outputs = [\n",
883+
" file_future.result()\n",
884+
" for file_future in harmony_client.download_all(\n",
885+
" polar_job_id, overwrite=True, directory=temp_dir\n",
886+
" )\n",
887+
" ]\n",
888+
"\n",
889+
" for tile_basename in prefire_tiles:\n",
890+
" tile_reference_files = build_file_list(\n",
891+
" tile_basename, polar_reference_dir, 'PNG'\n",
892+
" )\n",
893+
" tile_result_files = build_file_list(tile_basename, Path(temp_dir), 'PNG')\n",
894+
"\n",
895+
" for file_name in tile_result_files:\n",
896+
" assert file_name.exists(), f'File does not exist {file_name.resolve()}'\n",
897+
"\n",
898+
" print_success(f'All {tile_basename} test files generated')\n",
899+
"\n",
900+
" assert_dataset_produced_correct_results(\n",
901+
" tile_result_files[0], tile_reference_files[0], 'PNG'\n",
902+
" )\n",
903+
"\n",
904+
" print_success(\n",
905+
" 'Conversion of PREFIRE GeoTIFF to PNG using polar projection. Success'\n",
906+
" )\n",
907+
"else:\n",
908+
" print('Skipping test: HyBIG regression tests not configured for this environment.')"
909+
]
910+
},
911+
{
912+
"cell_type": "markdown",
913+
"id": "4ec2cc84",
914+
"metadata": {},
915+
"source": [
916+
"### Test OPERA DSWx-S1 anti-meridian granule:\n",
917+
"\n",
918+
"This test will run a request using an OPERA DSWx-S1 granule from PODAAC, to demonstrate performance in anti-meridian crossings. The output will be saved to a separate antimeridian directory."
919+
]
920+
},
921+
{
922+
"cell_type": "code",
923+
"execution_count": null,
924+
"id": "fedfef39",
925+
"metadata": {},
926+
"outputs": [],
927+
"source": [
928+
"antimeridian_basename = (\n",
929+
" 'OPERA_L3_DSWx-S1_T01LAC_20250212T174046Z_20250214T045358Z_S1A_30_v1.0_B01_WTR'\n",
930+
")\n",
931+
"antimeridian_reference_dir = reference_dir / 'antimeridian'\n",
932+
"\n",
933+
"if environment_information is not None:\n",
934+
" antimeridian_request = Request(\n",
935+
" collection=environment_information['antimeridian_collection'],\n",
936+
" granule_id=environment_information['antimeridian_granules'][0],\n",
937+
" crs='EPSG:4326',\n",
938+
" format='image/png',\n",
939+
" )\n",
940+
"\n",
941+
" antimeridian_job_id = str(harmony_client.submit(antimeridian_request))\n",
942+
" harmony_client.wait_for_processing(antimeridian_job_id, show_progress=True)\n",
943+
"\n",
944+
" reference_files = build_file_list(\n",
945+
" antimeridian_basename, antimeridian_reference_dir, 'PNG'\n",
946+
" )\n",
947+
"\n",
948+
" with TemporaryDirectory() as temp_dir:\n",
949+
" downloaded_grid_outputs = [\n",
950+
" file_future.result()\n",
951+
" for file_future in harmony_client.download_all(\n",
952+
" antimeridian_job_id, overwrite=True, directory=temp_dir\n",
953+
" )\n",
954+
" ]\n",
955+
"\n",
956+
" test_result_files = build_file_list(\n",
957+
" antimeridian_basename, Path(temp_dir), 'PNG'\n",
958+
" )\n",
959+
" for file_name in test_result_files:\n",
960+
" assert file_name.exists(), f'File does not exist {file_name.resolve()}'\n",
961+
"\n",
962+
" print_success('all test files generated')\n",
963+
"\n",
964+
" assert_dataset_produced_correct_results(\n",
965+
" test_result_files[0], reference_files[0], 'PNG'\n",
966+
" )\n",
967+
"\n",
968+
" print_success('Conversion of OPERA antimeridian data to PNG Success')\n",
969+
"else:\n",
970+
" print('Skipping test: HyBIG regression tests not configured for this environment.')"
971+
]
972+
},
973+
{
974+
"cell_type": "markdown",
975+
"id": "1eaad451",
976+
"metadata": {},
977+
"source": [
978+
"### Test OPERA RTC RGBA:\n",
979+
"\n",
980+
"This test will run a request using an OPERA RTC granule, to demonstrate performance with RGBA. Alternatively, MODIS corrected reflectance granules can be used. This collection gets converted to RGBA within the Harmony service chain prior to reaching HyBIG. The output will be saved to a separate rgba directory.\n",
981+
"\n",
982+
"**Note**: This collection requires you to accept a EULA before you can download granules. Please try downloading a granule manually [here](https://search.uat.earthdata.nasa.gov/search/granules?p=C1259974840-ASF&pg[0][v]=f&pg[0][qt]=2024-09-11T00%3A00%3A00.000Z%2C&pg[0][id]=OPERA_L2_RTC-S1_T063-133291-IW3_20240911T000822Z_20240911T114658Z*&pg[0][gsk]=start_date&g=G1269604594-ASF&q=C1259974840-ASF&lat=21.077285&long=-89.23667086956522&zoom=9.937662345674783) and accepting the click-through agreement. "
983+
]
984+
},
985+
{
986+
"cell_type": "code",
987+
"execution_count": null,
988+
"id": "1a8ad2a1",
989+
"metadata": {},
990+
"outputs": [],
991+
"source": [
992+
"# Corresponds to OPERA_L2_RTC-S1_T063-133291-IW3_20240911T000822Z_20240911T114658Z_S1A_30_v1.0\n",
993+
"# Area is over Merida, Mexico\n",
994+
"rgba_basename = '1c1aad567673d6612e25799705600f9262dfc81a171a8a9a586858ee4bfeb_rgb'\n",
995+
"rgba_reference_dir = reference_dir / 'rgba'\n",
996+
"\n",
997+
"if environment_information is not None:\n",
998+
" rgba_request = Request(\n",
999+
" collection=environment_information['rgba_collection'],\n",
1000+
" granule_id=environment_information['rgba_granules'][0],\n",
1001+
" crs='EPSG:4326',\n",
1002+
" format='image/png',\n",
1003+
" )\n",
1004+
"\n",
1005+
" rgba_job_id = str(harmony_client.submit(rgba_request))\n",
1006+
" harmony_client.wait_for_processing(rgba_job_id, show_progress=True)\n",
1007+
"\n",
1008+
" reference_files = build_file_list(rgba_basename, rgba_reference_dir, 'PNG')\n",
1009+
"\n",
1010+
" with TemporaryDirectory() as temp_dir:\n",
1011+
" downloaded_grid_outputs = [\n",
1012+
" file_future.result()\n",
1013+
" for file_future in harmony_client.download_all(\n",
1014+
" rgba_job_id, overwrite=True, directory=temp_dir\n",
1015+
" )\n",
1016+
" ]\n",
1017+
"\n",
1018+
" test_result_files = build_file_list(rgba_basename, Path(temp_dir), 'PNG')\n",
1019+
" for file_name in test_result_files:\n",
1020+
" assert file_name.exists(), f'File does not exist {file_name.resolve()}'\n",
1021+
"\n",
1022+
" print_success('all test files generated')\n",
1023+
"\n",
1024+
" assert_dataset_produced_correct_results(\n",
1025+
" test_result_files[0], reference_files[0], 'PNG'\n",
1026+
" )\n",
1027+
"\n",
1028+
" print_success('Conversion of OPERA RTC RGBA data to PNG Success')\n",
1029+
"else:\n",
1030+
" print('Skipping test: HyBIG regression tests not configured for this environment.')"
8481031
]
8491032
}
8501033
],
8511034
"metadata": {
8521035
"celltoolbar": "Tags",
8531036
"kernelspec": {
854-
"display_name": "venv",
1037+
"display_name": "papermill-hybig",
8551038
"language": "python",
8561039
"name": "python3"
8571040
},
@@ -865,7 +1048,7 @@
8651048
"name": "python",
8661049
"nbconvert_exporter": "python",
8671050
"pygments_lexer": "ipython3",
868-
"version": "3.13.2"
1051+
"version": "3.10.19"
8691052
}
8701053
},
8711054
"nbformat": 4,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
0.0002746684194920958
2+
0.0
3+
0.0
4+
-0.000274637085706822
5+
179.2570865236809
6+
-15.34559102423964
23 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<PAMDataset>
2+
<SRS dataAxisToSRSAxisMapping="2,1">GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]</SRS>
3+
<GeoTransform> 1.7925694918947116e+02, 2.7466841949209578e-04, 0.0000000000000000e+00, -1.5345453705696787e+01, 0.0000000000000000e+00, -2.7463708570682200e-04</GeoTransform>
4+
</PAMDataset>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
0.01956840788987115
1+
0.01999999999721997
22
0.0
33
0.0
4-
-0.01956734427383191
5-
-179.9902157710348
6-
89.99021631535295
4+
-0.01999999999721997
5+
-179.98999997498115
6+
89.98999998749126
-8.79 KB
Loading
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<PAMDataset>
22
<SRS dataAxisToSRSAxisMapping="2,1">GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]</SRS>
3-
<GeoTransform> -1.7999999997497974e+02, 1.9568407889871148e-02, 0.0000000000000000e+00, 8.9999999987489872e+01, 0.0000000000000000e+00, -1.9567344273831909e-02</GeoTransform>
3+
<GeoTransform> -1.7999999997497974e+02, 1.9999999997219971e-02, 0.0000000000000000e+00, 8.9999999987489872e+01, 0.0000000000000000e+00, -1.9999999997219971e-02</GeoTransform>
44
</PAMDataset>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
0.01956840788987115
1+
0.01999999999721997
22
0.0
33
0.0
4-
-0.01956734427383191
5-
-99.83801705412259
6-
89.99021631535295
4+
-0.01999999999721997
5+
-98.06999998636813
6+
89.98999998749126
-11.7 KB
Loading

0 commit comments

Comments
 (0)