-
Notifications
You must be signed in to change notification settings - Fork 91
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
Handle lowercase daac
and provider
inputs
#355
Conversation
👈 Launch a binder notebook on this branch for commit 3b48f40 I will automatically update this comment whenever this PR is modified 👈 Launch a binder notebook on this branch for commit f186096 👈 Launch a binder notebook on this branch for commit 46814f7 👈 Launch a binder notebook on this branch for commit 880f45e |
I found confirmation, thanks to John Teague in Slack, that provider IDs cannot have lowercase letters.
|
I've never heard of the EDIT: It's a field in a constant lookup internal to earthaccess: earthaccess/earthaccess/daac.py Line 6 in 7db2e59
|
Sure, and our internal handling of provider and daac IDs should definitely be all uppercase, I'm just saying that users may not know that they need to be all uppercase. I'm just proposing here that we handle any needed lowercase --> uppercase conversion for users. EDIT: So users don't need to think about upper vs. lowercase |
I understood all that :) I'm totally on board with the proposal! I should have been more clear in my first post. I was just validating the underlying assumption that provider IDs are 100% guaranteed to be uppercase, because while I'd never seen a lowercase character, I hadn't seen it guaranteed in writing before. Maybe we should link to the doc above in a docstring for |
@@ -12,6 +12,12 @@ | |||
from .utils import _validation as validate | |||
|
|||
|
|||
def _normalize_location(location: Union[str, None]) -> Union[str, None]: |
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.
Total nit that shouldn't be taken seriously: does Optional[str]
seem like a readability improvement at all?
I'm writing Typescript lately where you can do location?: string
and that's pretty slick.
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.
(Preface: I'm not very steeped in type annotations) To me Union
seems more appropriate here because this is a required positional argument, not a keyword with a default of None
. But I don't care strongly either way as long as linting checks pass.
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.
Union
seems more appropriate here because this is a required positional argument, not a keyword with a default ofNone
Do you mean you think Union
is more clear for that reason? Functionally they are the same thing, the argument would still be required: https://docs.python.org/3/library/typing.html#typing.Optional
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.
Do you mean you think Union is more clear for that reason?
Yes. Though I don't feel very strongly either way (or in general about type annotations). Happy to update if you'd prefer.
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 see the unclearness of Optional
in that regard, good point! I also don't feel strongly, so let's leave it? :)
Ah, I see -- thank you for confirming!
Sounds good to me. However, https://wiki.earthdata.nasa.gov/display/CMR/CMR+Data+Partner+User+Guide#CMRDataPartnerUserGuide-CMRProviderIdentification gives "Forbidden" for me Do you happen to have a different link handy? |
That link works for me after logging in through EarthData Login. Were you not even prompted to log in? Or maybe you're already logged in and don't have access. Let me see if I can find a place this is publicly documented. |
Both of those links give me
I'll update the docstring to include some explanation. We can always add a link after the fact if needed |
Jeez. Why are these docs behind a login wall at all? 🤯 Thanks for trying! |
@jrbourbeau can you try those links again? I'm told there was maintenance this morning. |
Now getting "Forbidden" like in #355 (comment) instead of the 500 error |
Waiting for response from CMR folks about a public copy of this documentation. If we want to get this merged, we could write a docstring linking to this private documentation, so those of us with access can find the source of truth when we need to validate our assumptions. Better to have a private reference than no reference, I think. Eventually we can replace it with a public link! |
I went ahead and added a link in the docstring I'm planning to merge this in a few hours if no further comments. This seems like a low-risk, relatively small change that will make users lives a bit nicer. Happy to handle any follow-up work if there is any. |
I was just working with someone who got an error because they provider
provider="pocloud"
(lowercase) instead ofprovider="POCLOUD"
. All our internal machinery expectsprovider
anddaac
to be all uppercase, however it's pretty natural (especially for new users) to use lowercase instead. We should just handle this case by normalizing these inputs to be all uppercase.earthaccess. get_s3_credentials
already had logic for this, but other methods didn't. This PR adds similar logic to other top-levelearthaccess
APIs.