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

updated adding instance_format to variable query #83

Merged
merged 5 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Support multi-point searches ([#72](https://github.com/nasa/python_cmr/issues/72))
- Support `processing_level_id` in `CollectionQuery` ([#76](https://github.com/nasa/python_cmr/issues/76))
- Support `platform` in `CollectionQuery` ([#77](https://github.com/nasa/python_cmr/issues/77))
- Support `instance-format` to `VariableQuery` to allow for searching of variable zarr stores ([#59]https://github.com/nasa/python_cmr/issues/59)
briannapagan marked this conversation as resolved.
Show resolved Hide resolved

### Fixed
- Setup vcrpy for new `revision_date` unit tests ([#70](https://github.com/nasa/python_cmr/issues/70))
Expand Down
13 changes: 13 additions & 0 deletions cmr/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,19 @@ def __init__(self, mode: str = CMR_OPS):
"dif", "dif10", "opendata", "umm_json", "umm_json_v[0-9]_[0-9]"
])

def instance_format(self, instance_format: str) -> Self:
"""
Filter by instance format.

:param instance_format: format for variable instance
:returns: self
"""

if instance_format:
self.params['instance_format'] = instance_format

return self

briannapagan marked this conversation as resolved.
Show resolved Hide resolved
@override
def _valid_state(self) -> bool:
return True
7 changes: 7 additions & 0 deletions tests/test_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,10 @@ def bearer_test_token(self):

self.assertIn("Authorization", query.headers)
self.assertEqual(query.headers["Authorization"], "Bearer 123TOKEN")

def test_instance_format(self):
query = VariableQuery()
query.instance_format("zarr")

self.assertIn("instance_format", query.params)
self.assertEqual(query.params["instance_format"], "zarr")
frankinspace marked this conversation as resolved.
Show resolved Hide resolved