-
Notifications
You must be signed in to change notification settings - Fork 36
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
Allow for no authentication and NASA Earthdata (URS) authentication for OPeNDAP #57
Conversation
Besides the original "ESGF" authentication method, this commit adds a "URS" authentication and also no authentication. Also adding a no authentication test case to test_intake_xarray, which required adding 'pydap' to the conda environment.yml files and a new example dataset in catalog.yaml.
Personally I know nothing about these auth mechanisms, so please tag someone for a review when you are ready. |
Mock testing the ESGF and URS authentication methods for connecting to an OPeNDAP server. Also updated inline docs to mention that the DAP_USER and DAP_PASSWORD environment variables need to be set for authentication to work. As pydap is not available in the default conda channel, I've removed it from the environment-py36-default.yml file.
Ensure ValueError is raised properly when we pass in an invalid OPeNDAP authentication method that is not None, 'esgf' or 'urs'.
Ok, this should be ready for review! @mmccarty, I see you've worked on the original ESGF authentication method, do you mind taking a look? This Pull Request basically adds a few more authentication methods, and includes some unit tests to cover the intake OPeNDAP extension. |
Sorry that this dropped off my list. |
password = os.getenv('DAP_PASSWORD', None) | ||
session = setup_session(username, password, check_url=self.urlpath) | ||
|
||
return session |
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.
session
can be None
? I would have thought you still need to make a non-authenticated session of some sort (not that I'm certain what this session thing is, perhaps pydap makes its own for the None
case).
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.
Yes, that's the default. https://github.com/pydata/xarray/blob/master/xarray/backends/pydap_.py#L75
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.
Yes session can be None
, probably just an anonymous connection then? See https://github.com/pydap/pydap/blob/3f6aa190c59e3bbc6c834377a61579b20275ff69/src/pydap/client.py#L58
""" | ||
name = 'opendap' | ||
|
||
def __init__(self, urlpath, chunks, xarray_kwargs=None, metadata=None, | ||
def __init__(self, urlpath, chunks, auth="esgf", xarray_kwargs=None, metadata=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.
Are you sure you want the default auth to be esgf
?
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.
ESGF
was the 'default' authentication method in the original code. Personally I would prefer using URS
as the default, but might be good to preserve backward compatibility here. Edit: Or do you mean we should set the default to None
i.e. no authentication?
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.
Defaults are hard. Perhaps, @danielballan or @jsignell care to weigh in.
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'm good with @martindurant's comment in the main thread. 👍
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.
Yep. Same for me
Thanks @weiji14 ! Just a few questions but looks good otherwise. |
Cool, was just getting back to using |
Alright, lets keep the same default as before for the time being, so long as it's documented that passing I suppose there are other auths that would eventually be supported? Then, we may want to come up with something more generic. |
Thanks |
Apart from historic reasons, using ESGF as the default authentication method does not seem to be a straight forward choice. Changing the default to no authentication most likely is the more user friendly alternative. Apart from that and following intake#57, the default if no authentication method is given should be anonymous access, but currently this fall back does not work (see also intake#74).
Besides the default Earth System Grid Federation (ESGF) authentication method, this Pull Request also allows for NASA Earthdata Login (URS) authentication and no authentication.
TODO:
urs
andesgf
authentication methodsLinks: