From aa6dd4ac07b395e28b165c32d6151226e254b6cd Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Tue, 12 Sep 2023 16:31:32 -0400 Subject: [PATCH] add atl23 to product lists and tests (#445) --- icepyx/core/is2ref.py | 1 + icepyx/core/read.py | 10 ++++++++-- icepyx/tests/test_is2ref.py | 12 ++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/icepyx/core/is2ref.py b/icepyx/core/is2ref.py index 883772a9e..52cf0e3a1 100644 --- a/icepyx/core/is2ref.py +++ b/icepyx/core/is2ref.py @@ -39,6 +39,7 @@ def _validate_product(product): "ATL19", "ATL20", "ATL21", + "ATL23", ], "Please enter a valid product" else: raise TypeError("Please enter a product string") diff --git a/icepyx/core/read.py b/icepyx/core/read.py index 2ffe32cb7..c276c5e53 100644 --- a/icepyx/core/read.py +++ b/icepyx/core/read.py @@ -205,6 +205,7 @@ def _run_fast_scandir(dir, fn_glob): return subfolders, files + # Need to post on intake's page to see if this would be a useful contribution... # https://github.com/intake/intake/blob/0.6.4/intake/source/utils.py#L216 def _pattern_to_glob(pattern): @@ -697,8 +698,12 @@ def _read_single_grp(self, file, grp_path): """ - return xr.open_dataset(file, group=grp_path, engine='h5netcdf', - backend_kwargs={'phony_dims': 'access'}) + return xr.open_dataset( + file, + group=grp_path, + engine="h5netcdf", + backend_kwargs={"phony_dims": "access"}, + ) def _build_single_file_dataset(self, file, groups_list): """ @@ -740,6 +745,7 @@ def _build_single_file_dataset(self, file, groups_list): "ATL19", "ATL20", "ATL21", + "ATL23", ]: is2ds = xr.open_dataset(file) diff --git a/icepyx/tests/test_is2ref.py b/icepyx/tests/test_is2ref.py index c2ddf6e5e..8d50568fe 100644 --- a/icepyx/tests/test_is2ref.py +++ b/icepyx/tests/test_is2ref.py @@ -273,6 +273,18 @@ def test_atl21_product(): assert obs == expected +def test_atl23_product(): + lcds = "atl23" + obs = is2ref._validate_product(lcds) + expected = "ATL23" + assert obs == expected + + ucds = "ATL23" + obs = is2ref._validate_product(ucds) + expected = "ATL23" + assert obs == expected + + ########## about_product ########## # Note: requires internet connection # could the github flat data option be used here? https://octo.github.com/projects/flat-data