Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Das 2192 #14

Merged
merged 5 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion docker/service_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.4
1.0.5
2 changes: 1 addition & 1 deletion hoss/dimension_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def is_index_subset(message: Message) -> bool:

"""
return any(
rgetattr(message, subset_parameter, None) is not None
rgetattr(message, subset_parameter, None) not in (None, [])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a new unit test (or more likely a sub test) here to make sure the empty list is correctly identified in this check. Probably also a sub test with a non-empty list, too, just to be sure.

Here's the test for this function. I think the easiest thing is to just add two new subtests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are several subtests with non empty list. But I added 2 subtests for the empty and non empty list cases

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looking in more detail, I think you are right about the non-empty list. But thanks for adding a couple of unit tests.

for subset_parameter in [
'subset.bbox',
'subset.shape',
Expand Down
32 changes: 32 additions & 0 deletions tests/unit/test_dimension_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,38 @@ def test_is_index_subset(self):
)
)

with self.subTest('No index Subset'):
Copy link
Member

@owenlittlejohns owenlittlejohns Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: I think it's probably worth explicitly stating this subtest is for an empty dimensions list rather than "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({})))

Expand Down
Loading