Skip to content

Commit

Permalink
DAS-1935 - Enable RSSMIF16D production HOSS regression tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
owenlittlejohns committed Nov 11, 2023
1 parent 59fa336 commit 89efcb4
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 26 deletions.
53 changes: 29 additions & 24 deletions test/hoss/HOSS_Regression.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"from harmony import BBox, Client, Collection, Dimension, Environment, Request\n",
"\n",
"from utilities import (compare_results_to_reference_file, print_success,\n",
" remove_results_files, submit_and_download)"
" remove_results_files, submit_and_download,\n",
" test_is_configured)"
]
},
{
Expand Down Expand Up @@ -146,9 +147,13 @@
" 'bounds_collection': Collection(id='C1245618475-EEDTEST'),\n",
" 'bounds_granule_id': 'G1255863984-EEDTEST'}\n",
"\n",
"hoss_prod_information = {'collection': Collection(id='C1996546500-GHRC_DAAC'),\n",
" 'granule_id': 'G2040739631-GHRC_DAAC'}\n",
"\n",
"hoss_env = {Environment.LOCAL: hoss_non_prod_information,\n",
" Environment.SIT: hoss_non_prod_information,\n",
" Environment.UAT: hoss_non_prod_information}\n",
" Environment.UAT: hoss_non_prod_information,\n",
" Environment.PROD: hoss_prod_information}\n",
"\n",
"if harmony_environment in hoss_env:\n",
" hoss_info = hoss_env[harmony_environment]\n",
Expand Down Expand Up @@ -183,7 +188,7 @@
"metadata": {},
"outputs": [],
"source": [
"if hoss_info is not None:\n",
"if test_is_configured(hoss_info, 'collection'):\n",
" hoss_var_bbox_file_name = 'hoss_var_bbox.nc4'\n",
" hoss_var_bbox_bbox = BBox(w=-150, s=0, e=-105, n=15)\n",
" hoss_var_bbox_request = Request(collection=hoss_info['collection'],\n",
Expand All @@ -200,7 +205,7 @@
"\n",
" print_success('HOSS variable and bounding box request.')\n",
"else:\n",
" print(f'HOSS is not configured for environment: \"{harmony_environment}\" - skipping test.')"
" print(f'Skipping - HOSS is not configured for this test in {harmony_environment}.')"
]
},
{
Expand Down Expand Up @@ -232,7 +237,7 @@
"metadata": {},
"outputs": [],
"source": [
"if hoss_info is not None:\n",
"if test_is_configured(hoss_info, 'collection'):\n",
" grid_edge_file_name = 'hoss_grid_edge.nc4'\n",
" grid_edge_bbox = BBox(w=-15, s=-60, e=15, n=-30)\n",
" grid_edge_request = Request(collection=hoss_info['collection'],\n",
Expand All @@ -249,7 +254,7 @@
"\n",
" print_success('HOSS request crossing longitudinal edge.')\n",
"else:\n",
" print(f'HOSS is not configured for environment: \"{harmony_environment}\" - skipping test.')"
" print(f'Skipping - HOSS is not configured for this test in {harmony_environment}.')"
]
},
{
Expand All @@ -269,7 +274,7 @@
"metadata": {},
"outputs": [],
"source": [
"if hoss_info is not None:\n",
"if test_is_configured(hoss_info, 'collection'):\n",
" no_bbox_file_name = 'hoss_no_bbox.nc4'\n",
" no_bbox_request = Request(collection=hoss_info['collection'],\n",
" granule_id=[hoss_info['granule_id']],\n",
Expand All @@ -284,7 +289,7 @@
"\n",
" print_success('HOSS request without bounding box.')\n",
"else:\n",
" print(f'HOSS is not configured for environment: \"{harmony_environment}\" - skipping test.')"
" print(f'Skipping - HOSS is not configured for this test in {harmony_environment}.')"
]
},
{
Expand All @@ -304,7 +309,7 @@
"metadata": {},
"outputs": [],
"source": [
"if hoss_info is not None:\n",
"if test_is_configured(hoss_info, 'collection'):\n",
" hoss_all_vars_file_name = 'hoss_all_vars.nc4'\n",
" hoss_all_vars_bbox = BBox(w=-150, s=0, e=-105, n=15)\n",
" hoss_all_vars_request = Request(collection=hoss_info['collection'],\n",
Expand All @@ -320,7 +325,7 @@
"\n",
" print_success('HOSS all-variable request.')\n",
"else:\n",
" print(f'HOSS is not configured for environment: \"{harmony_environment}\" - skipping test.')"
" print(f'Skipping - HOSS is not configured for this test in {harmony_environment}.')"
]
},
{
Expand All @@ -342,7 +347,7 @@
"metadata": {},
"outputs": [],
"source": [
"if hoss_info is not None:\n",
"if test_is_configured(hoss_info, 'collection'):\n",
" all_no_bbox_file_name = 'hoss_all_no_bbox.nc4'\n",
" all_no_bbox_request = Request(collection=hoss_info['collection'],\n",
" granule_id=hoss_info['granule_id'])\n",
Expand All @@ -357,7 +362,7 @@
"\n",
" print_success('HOSS all-variable, no bounding box request.')\n",
"else:\n",
" print(f'HOSS is not configured for environment: \"{harmony_environment}\" - skipping test.')"
" print(f'Skipping - HOSS is not configured for this test in {harmony_environment}.')"
]
},
{
Expand Down Expand Up @@ -389,7 +394,7 @@
"metadata": {},
"outputs": [],
"source": [
"if hoss_info is not None:\n",
"if test_is_configured(hoss_info, 'temporal_collection'):\n",
" hoss_temporal_file_name = 'hoss_temporal.nc4'\n",
" hoss_temporal_request = Request(collection=hoss_info['temporal_collection'],\n",
" granule_id=hoss_info['temporal_granule_id'],\n",
Expand All @@ -407,7 +412,7 @@
"\n",
" print_success('HOSS temporal request.')\n",
"else:\n",
" print(f'HOSS is not configured for environment: \"{harmony_environment}\" - skipping test.')"
" print(f'Skipping - HOSS is not configured for this test in {harmony_environment}.')"
]
},
{
Expand All @@ -429,7 +434,7 @@
"metadata": {},
"outputs": [],
"source": [
"if hoss_info is not None:\n",
"if test_is_configured(hoss_info, 'collection'):\n",
" hoss_named_dims_file_name = 'hoss_named_dimensions.nc4'\n",
" hoss_named_dims_request = Request(collection=hoss_info['collection'],\n",
" granule_id=[hoss_info['granule_id']],\n",
Expand All @@ -446,7 +451,7 @@
"\n",
" print_success('HOSS named dimensions request.')\n",
"else:\n",
" print(f'HOSS is not configured for environment: \"{harmony_environment}\" - skipping test.')"
" print(f'Skipping - HOSS is not configured for this test in {harmony_environment}.')"
]
},
{
Expand Down Expand Up @@ -487,7 +492,7 @@
"metadata": {},
"outputs": [],
"source": [
"if hoss_shape_info is not None:\n",
"if test_is_configured(hoss_shape_info, 'collection'):\n",
" hoss_shape_file_name = 'hoss_shape_file.nc4'\n",
" hoss_shape_request = Request(collection=hoss_shape_info['collection'],\n",
" granule_id=hoss_shape_info['granule_id'],\n",
Expand All @@ -502,7 +507,7 @@
"\n",
" print_success('HOSS-Geographic polygon spatial subset request.')\n",
"else:\n",
" print(f'HOSS-Geographic is not configured for environment: \"{harmony_environment}\" - skipping test.')"
" print(f'Skipping - HOSS-Geographic is not configured for this test in {harmony_environment}.')"
]
},
{
Expand All @@ -522,7 +527,7 @@
"metadata": {},
"outputs": [],
"source": [
"if hoss_info is not None:\n",
"if test_is_configured(hoss_info, 'bounds_collection'):\n",
" hoss_bounds_file_name = 'hoss_bounds.nc4'\n",
" hoss_bounds_bbox = BBox(w=60, s=-15, e=75, n=0)\n",
" hoss_bounds_request = Request(collection=hoss_info['bounds_collection'],\n",
Expand All @@ -541,7 +546,7 @@
"\n",
" print_success('HOSS bounds request.')\n",
"else:\n",
" print(f'HOSS is not configured for environment: \"{harmony_environment}\" - skipping test.')"
" print(f'Skipping - HOSS is not configured for this test in {harmony_environment}.')"
]
},
{
Expand Down Expand Up @@ -603,7 +608,7 @@
"metadata": {},
"outputs": [],
"source": [
"if hoss_projected_info is not None:\n",
"if test_is_configured(hoss_projected_info, 'collection'):\n",
" hoss_projected_filename = 'hoss_projected_north_slope.nc4'\n",
" hoss_projected_request = Request(collection=hoss_projected_info['collection'],\n",
" granule_id=hoss_projected_info['granule_id'],\n",
Expand All @@ -619,7 +624,7 @@
"\n",
" print_success('HOSS-projection-gridded with bounding box.')\n",
"else:\n",
" print(f'HOSS-projection-gridded is not configured for environment: \"{harmony_environment}\" - skipping test.')"
" print(f'Skipping - HOSS Projection-Gridded is not configured for this test in {harmony_environment}.')"
]
},
{
Expand All @@ -643,7 +648,7 @@
"metadata": {},
"outputs": [],
"source": [
"if hoss_projected_info is not None:\n",
"if test_is_configured(hoss_projected_info, 'collection'):\n",
" hoss_projected_shape_filename = 'hoss_projected_north_slope_shape.nc4'\n",
" hoss_projected_request = Request(collection=hoss_projected_info['collection'],\n",
" granule_id=hoss_projected_info['granule_id'],\n",
Expand All @@ -659,7 +664,7 @@
"\n",
" print_success('Subsetting projected grid with shapefile.')\n",
"else:\n",
" print(f'HOSS is not configured for environment: \"{harmony_environment}\" - skipping test.')"
" print(f'Skipping - HOSS is not configured for this test in {harmony_environment}.')"
]
},
{
Expand Down
18 changes: 17 additions & 1 deletion test/hoss/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""
from os import listdir, remove, replace
from typing import Optional
from typing import Dict, Optional

from harmony import Client, Request
from harmony.harmony import ProcessingFailedException
Expand Down Expand Up @@ -82,3 +82,19 @@ def print_error(error_string: str) -> str:
def print_success(success_string: str) -> str:
""" Print a success message, with formatting for green text. """
print(f'\033[92mSuccess: {success_string}\033[0m')


def test_is_configured(configuration_settings: Dict,
collection_key: str) -> bool:
""" A helper function to determine if a test should be run given the
environment information available.
The specific check is whether the configuration object exists and, if
so, if the collection that will be used in the test has been saved in
that configuration object.
"""
return (
configuration_settings is not None
and configuration_settings.get(collection_key) is not None
)
2 changes: 1 addition & 1 deletion test/hoss/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.4
0.1.5

0 comments on commit 89efcb4

Please sign in to comment.