-
Notifications
You must be signed in to change notification settings - Fork 81
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
Return S3 data links by default when in region #318
Changes from 2 commits
509e42c
eee3f3d
4db15a7
3bcb243
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import earthaccess | ||
|
||
|
||
def test_data_links(): | ||
granules = earthaccess.search_data( | ||
short_name="SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205", | ||
temporal=("2020", "2022"), | ||
count=1, | ||
) | ||
g = granules[0] | ||
# `access` specified | ||
assert g.data_links(access="direct")[0].startswith("s3://") | ||
assert g.data_links(access="external")[0].startswith("https://") | ||
# `in_region` specified | ||
assert g.data_links(in_region=True)[0].startswith("s3://") | ||
assert g.data_links(in_region=False)[0].startswith("https://") | ||
# When `access` and `in_region` are both specified, `access` takes priority | ||
assert g.data_links(access="direct", in_region=True)[0].startswith("s3://") | ||
assert g.data_links(access="direct", in_region=False)[0].startswith("s3://") | ||
assert g.data_links(access="external", in_region=True)[0].startswith("https://") | ||
assert g.data_links(access="external", in_region=False)[0].startswith("https://") | ||
Comment on lines
+12
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is the intended behavior we want, but let me know if I'm missing something. As a side note, I'm not sure why we have separate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I can't answer the question directly, but these keywords also feel unintuitive to me. What about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that two kwargs is clunky and direct/external aren't the most descriptive names, and we could likely handle it with a single kwarg. that said, since they are the current interface, we should probably open an issue for possibly refactoring it and not block this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just cosmetic (this line would never be called, so I decided to remove it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I tend to go the other way and drop the
else
statement, but six-of-one...