From 52d977db39b9947531cbaff9fd3e0bfa4c3dbca3 Mon Sep 17 00:00:00 2001 From: sudhamurthy Date: Mon, 19 Aug 2024 17:30:27 -0400 Subject: [PATCH 1/5] updates to prevent prefetch from being called for variable subset for SMAP L3/L4 collections --- hoss/dimension_utilities.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hoss/dimension_utilities.py b/hoss/dimension_utilities.py index 59fe6b0..91908c4 100644 --- a/hoss/dimension_utilities.py +++ b/hoss/dimension_utilities.py @@ -45,7 +45,9 @@ def is_index_subset(message: Message) -> bool: """ return any( - rgetattr(message, subset_parameter, None) is not None + #rgetattr(message, subset_parameter, None) and + #rgetattr(message, subset_parameter, None) is not None + rgetattr(message, subset_parameter, None) not in (None, []) for subset_parameter in [ 'subset.bbox', 'subset.shape', From 2428ed6517724f4367119f562ac577d3708b5e06 Mon Sep 17 00:00:00 2001 From: sudhamurthy Date: Mon, 19 Aug 2024 17:43:25 -0400 Subject: [PATCH 2/5] updates to prevent prefetch from being called for variable subset for SMAP L3/L4 collections --- CHANGELOG.md | 8 ++++++++ docker/service_version.txt | 2 +- hoss/dimension_utilities.py | 2 -- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1845e4..24877b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ + +## v1.0.5 +### 2024-08-19 + +This version of HOSS updates the 'is_index_subset' method to check for empty list (in case of dimensions subset) +as well as None (for the spatial, bbox and temporal subsets. This prevents prefetch from being called for +variable subsetting which was occuring for SMAP L3/L4 collections. + ## v1.0.4 ### 2024-04-05 diff --git a/docker/service_version.txt b/docker/service_version.txt index ee90284..90a27f9 100644 --- a/docker/service_version.txt +++ b/docker/service_version.txt @@ -1 +1 @@ -1.0.4 +1.0.5 diff --git a/hoss/dimension_utilities.py b/hoss/dimension_utilities.py index 91908c4..9ee8d02 100644 --- a/hoss/dimension_utilities.py +++ b/hoss/dimension_utilities.py @@ -45,8 +45,6 @@ def is_index_subset(message: Message) -> bool: """ return any( - #rgetattr(message, subset_parameter, None) and - #rgetattr(message, subset_parameter, None) is not None rgetattr(message, subset_parameter, None) not in (None, []) for subset_parameter in [ 'subset.bbox', From 424bda32d7751c00db73718d8252d4dbb4b0c4d4 Mon Sep 17 00:00:00 2001 From: sudhamurthy Date: Tue, 20 Aug 2024 02:39:01 -0400 Subject: [PATCH 3/5] added couple of unit tests to is_index_subset function to test empty lists --- CHANGELOG.md | 6 ++--- tests/unit/test_dimension_utilities.py | 32 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24877b7..8ba4307 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,9 @@ ## v1.0.5 ### 2024-08-19 -This version of HOSS updates the 'is_index_subset' method to check for empty list (in case of dimensions subset) -as well as None (for the spatial, bbox and temporal subsets. This prevents prefetch from being called for -variable subsetting which was occuring for SMAP L3/L4 collections. +This version of HOSS updates the 'is_index_subset' method to check for empty list (in case of dimensions subset) +as well as None (for the spatial, bbox and temporal subsets. This prevents prefetch from being called for +variable subsetting which was occuring for SMAP L3/L4 collections. ## v1.0.4 ### 2024-04-05 diff --git a/tests/unit/test_dimension_utilities.py b/tests/unit/test_dimension_utilities.py index 4e8d789..bafc167 100644 --- a/tests/unit/test_dimension_utilities.py +++ b/tests/unit/test_dimension_utilities.py @@ -679,6 +679,38 @@ def test_is_index_subset(self): ) ) + with self.subTest('No index Subset'): + self.assertFalse( + is_index_subset( + Message( + { + 'subset': { + 'bbox': None, + 'shape_file': None, + 'dimensions': [], + }, + 'temporal': None, + } + ) + ) + ) + + with self.subTest('Dimensions Subset is not empty'): + self.assertTrue( + is_index_subset( + Message( + { + 'subset': { + 'bbox': None, + 'shape_file': None, + 'dimensions': dimensions, + }, + 'temporal': None, + } + ) + ) + ) + with self.subTest('Not an index range subset'): self.assertFalse(is_index_subset(Message({}))) From dc7c441a9549c409f75022c3ad9f6ed8736fb997 Mon Sep 17 00:00:00 2001 From: sudhamurthy Date: Thu, 22 Aug 2024 09:40:10 -0400 Subject: [PATCH 4/5] updates based on PR feedback --- CHANGELOG.md | 6 +++--- tests/unit/test_dimension_utilities.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ba4307..260b6ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,9 @@ ## v1.0.5 ### 2024-08-19 -This version of HOSS updates the 'is_index_subset' method to check for empty list (in case of dimensions subset) -as well as None (for the spatial, bbox and temporal subsets. This prevents prefetch from being called for -variable subsetting which was occuring for SMAP L3/L4 collections. +This version of HOSS updates the `is_index_subset` method to check for empty list (in case of dimensions subset) +as well as None (for the spatial, bbox and temporal subsets). This prevents 1-D dimension variables from being +unnecessarily requested from OPeNDAP for some variable subsets, in particular SMAP L3 and L4 collections.. ## v1.0.4 ### 2024-04-05 diff --git a/tests/unit/test_dimension_utilities.py b/tests/unit/test_dimension_utilities.py index bafc167..5ad7a21 100644 --- a/tests/unit/test_dimension_utilities.py +++ b/tests/unit/test_dimension_utilities.py @@ -679,7 +679,7 @@ def test_is_index_subset(self): ) ) - with self.subTest('No index Subset'): + with self.subTest('Empty dimensions List'): self.assertFalse( is_index_subset( Message( From e4b527091e65cf14bff253869ace94a43a56fce3 Mon Sep 17 00:00:00 2001 From: sudhamurthy Date: Thu, 22 Aug 2024 09:57:55 -0400 Subject: [PATCH 5/5] updated CHANGELOG.md again --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 260b6ad..2a18ed7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ This version of HOSS updates the `is_index_subset` method to check for empty list (in case of dimensions subset) as well as None (for the spatial, bbox and temporal subsets). This prevents 1-D dimension variables from being -unnecessarily requested from OPeNDAP for some variable subsets, in particular SMAP L3 and L4 collections.. +unnecessarily requested from OPeNDAP for variable subsets which needs to be done only for spatial and temporal +subsetting requests. This also prevents a whole granule request when 1-D dimension variables were not present +in the granule. ## v1.0.4 ### 2024-04-05