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

Allow concat_dim_kwargs in THREDDSMergedSource #34

Merged
merged 10 commits into from Jun 1, 2021
Merged

Conversation

aaronspring
Copy link
Collaborator

@aaronspring aaronspring commented May 6, 2021

Closes #33

tests/test_source.py Outdated Show resolved Hide resolved
@aaronspring aaronspring marked this pull request as ready for review May 7, 2021 09:18
@@ -89,14 +89,21 @@ def _open_dataset(self):
else:
break
path = self.path[i:]
if 'concat_dim' in self.xarray_kwargs:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of doing dataset concatenation. I think it would be beneficial not to expose the concat_dim option as a standalone argument. 👍🏽 for expanding the api to support other concat options. How about exposing concatenation options as concat_kwargs in __init__? I am imagining having concat_kwargs=None to be the default (which means the user doesn't want us to do any concatenation). With concat_kwargs={....}, we then go ahead and run xr.concat(data, **concat_kwargs).

What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see two ways here:
1.) try to implement xr.open_mfdataset API: http://xarray.pydata.org/en/stable/generated/xarray.open_mfdataset.html
2.) implement xr.concat(list, args) API: http://xarray.pydata.org/en/stable/generated/xarray.concat.html
but as I compare all concat_kwargs appear in open_mfdataset.

I like your implementation suggestion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so concat_dim=... and xarray_kwargs for all other kwargs of open_mfdataset

CHANGELOG.md Outdated
@@ -5,6 +5,7 @@
### Features

- Allow `xarray_kwargs` for :py:class:`~intake_thredds.THREDDSMergedSource` [#32](https://github.com/NCAR/intake-thredds/pull/32) ([@aaronspring](https://github.com/aaronspring))
- Allow `concat_dim` for :py:class:`~intake_thredds.THREDDSMergedSource` [#34](https://github.com/NCAR/intake-thredds/pull/34) ([@aaronspring](https://github.com/aaronspring))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do I get the xr docs linked here?

@aaronspring aaronspring self-assigned this May 8, 2021
@aaronspring aaronspring added the enhancement New feature or request label May 8, 2021
@aaronspring
Copy link
Collaborator Author

Ok to merge @andersy005 ?

Copy link
Member

@andersy005 andersy005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, @aaronspring 👍

I'm merging this shortly (sorry I took too long to get back to you)

@@ -5,6 +5,7 @@
### Features

- Allow `xarray_kwargs` for :py:class:`~intake_thredds.THREDDSMergedSource` [#32](https://github.com/NCAR/intake-thredds/pull/32) ([@aaronspring](https://github.com/aaronspring))
- Allow `concat_kwargs` for :py:class:`~intake_thredds.THREDDSMergedSource` [#34](https://github.com/NCAR/intake-thredds/pull/34) ([@aaronspring](https://github.com/aaronspring))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually generate the changelog via https://github-activity.readthedocs.io/en/latest/. This is fine too. I just wanted to let you know that updating the changelog isn't required :) ...

@andersy005 andersy005 changed the title concat_dim Allow concat_dim_kwargs in THREDDSMergedSource Jun 1, 2021
@andersy005 andersy005 merged commit 54f1a8d into main Jun 1, 2021
@andersy005 andersy005 deleted the AS_concat_dim branch June 1, 2021 13:16
@aaronspring
Copy link
Collaborator Author

thanks for merging!

@andersy005
Copy link
Member

Should we cut a new release?

@aaronspring
Copy link
Collaborator Author

I think so.

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.

use open_mfdataset with concat_dim
2 participants