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

add readable_granule_name option to GranuleQuery #27

Merged
merged 5 commits into from
Apr 10, 2024

Conversation

tyler-c2s
Copy link
Contributor

Description

Adds the option to use GranuleQuery and filter using readable_granule_name

This opens up options like query MODIS ids based on H/V coords or search by ID and other sub-string searches.

Additionally fix options formatting to force lowercase. This was required to get this filter working and lowercase appears to be the required format on cmr-search

Testing

Added new tests for readable_granule_name. Added a test for "True" vs "true" in options during url building.

Example Query

from datetime import datetime
from cmr import GranuleQuery

api = GranuleQuery()

granules = (
    api.short_name("MOD09GA")
    .version("061")
    .temporal(datetime(2023,2,20),datetime(2023,2,20,23,59,59))
    .readable_granule_name(["*h32v08*","*h30v13*"])
    .get_all()
)

for granule in granules:
    print(granule["title"])

Results

MOD09GA.A2023051.h30v13.061.2023055133223
MOD09GA.A2023051.h32v08.061.2023055135421

@frankinspace frankinspace merged commit 22b8d01 into nasa:develop Apr 10, 2024
1 check passed
@frankinspace frankinspace mentioned this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants