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

NASA Earthdata credentials block #5

Merged
merged 2 commits into from
Jun 29, 2023
Merged

Conversation

giorgiobasile
Copy link
Owner

Adds an EarthdataCredentials block that allows creating a session to NASA Earthdata through the earthaccess library.

The EarthdataCredentials.login() method sets up the necessary environment variables for the earthaccess.login() and calls it to return an earthaccess.Auth object.

The user can then use all utilities provided by earthaccess. Further work will be done to provide Prefect flows/tasks based on those.

Closes #4

Example

from prefect_eo import EarthdataCredentials
from earthaccess import search_data

ed_credentials_block = EarthdataCredentials.load("BLOCK_NAME")
ed_credentials_block.login()

# at this point, all earthaccess methods to query and download can be used
results = search_data(
    short_name='MCD12Q1',
    version="061",
    cloud_hosted=True,
    bounding_box=(-10, 20, 10, 50), 
    temporal=("2000-02", "2023-03"),
    count=100
)

Screenshots

Checklist

  • References any related issue by including "Closes #" or "Closes ".
    • If no issue exists and your change is not a small fix, please create an issue first.
  • Includes tests or only affects documentation.
  • Passes pre-commit checks.
    • Run pre-commit install && pre-commit run --all locally for formatting and linting.
  • Includes screenshots of documentation updates.
    • Run mkdocs serve view documentation locally.
  • Summarizes PR's changes in CHANGELOG.md

@giorgiobasile giorgiobasile added the enhancement New feature or request label Jun 29, 2023
@giorgiobasile giorgiobasile self-assigned this Jun 29, 2023
@giorgiobasile
Copy link
Owner Author

Failed Windows test unrelated to prefect-eo, see PrefectHQ/prefect#10059

@giorgiobasile giorgiobasile merged commit f7551c3 into main Jun 29, 2023
@giorgiobasile giorgiobasile deleted the earthdata-credentials branch June 29, 2023 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add credential block for NASA Earthdata
1 participant