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

Enable to parse more backend_kwargs when opening via PydapDataStore (e.g. output_grid) #6274

Closed
jgliss opened this issue Feb 14, 2022 · 2 comments · Fixed by #6276
Closed

Comments

@jgliss
Copy link
Contributor

jgliss commented Feb 14, 2022

Is your feature request related to a problem?

I am planning to use xarray to access netcdf data from a thredds server. For my particular application, I need to be able to set pydap client option output_grid=False, to avoid some issues that I have experienced with a particular dataset on the server I am downloading from.

I use xarray.open_dataset to access the data via pydap backend, which currently only allows to specify "session" as a keyword in backend_kwargs.

def open(cls, url, session=None):

It would be helpful to be able to provide additional backend_kwargs accepted by the pydap client (such as output_grid).

https://github.com/pydap/pydap/blob/dbe9b8d15831f21c28b97ed5661b2708faec45f2/src/pydap/client.py#L58

Describe the solution you'd like

It could be perhaps as simple as extending the signature of PydapDataStore.open from:

@classmethod
def open(cls, url, session=None):

    ds = pydap.client.open_url(url, session=session)
    return cls(ds)

to, e.g.:

@classmethod
def open(cls, url, **kwargs):

    ds = pydap.client.open_url(url, **kwargs)
    return cls(ds)

Describe alternatives you've considered

No response

Additional context

No response

@mathause
Copy link
Collaborator

That sounds reasonable - are you up to create a PR?

@jgliss
Copy link
Contributor Author

jgliss commented Feb 14, 2022

That sounds reasonable - are you up to create a PR?

Yes, I can create a PR. Thanks for your fast reply.

jgliss pushed a commit to jgliss/xarray that referenced this issue Feb 15, 2022
aurghs pushed a commit that referenced this issue Feb 17, 2022
* propose implementation of #6274

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* minor fix

* Add tests for new method PydapDataStore._update_default_params

* minor fix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add entry in whats-new.rst

* Minor change

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Define open_dataset_params for cleaner solution

* remove import of inspect lib

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update xarray/backends/pydap_.py

Co-authored-by: Mathias Hauser <mathause@users.noreply.github.com>

* update whats-new

* Set pydap backend arguments explicitly

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* set defaults in PydapDataStore.open rather than entry point

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: Jonas Gliss <jonas.gliss@statkraft.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Mathias Hauser <mathause@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants