Skip to content

Conversation

@taobrienlbl
Copy link
Contributor

Adds a **kwargs option to xarray.save_mfdataset that passes through to to_netcdf, which allows the encoding and unlimited_dims arguments to be passed through.

* adds a `**kwargs` option to `xarray.save_mfdataset` that passes through to
  `to_netcdf`


@pytest.mark.parametrize("test_type", ["baseline", "encoding_and_unlimited_dims"])
def test_save_mfdataset_pass_kwargs(test_type):
Copy link
Member

Choose a reason for hiding this comment

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

Could we move this test in the same test file as the rest of save_mfdataset tests?

def test_save_mfdataset_roundtrip(self) -> None:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure thing. I'm not sure what the protocol for squashing commits is here: should I push a separate commit, or should I squash it with the original?

Copy link
Member

Choose a reason for hiding this comment

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

we squash commits when merging into main. So, i wouldn't worry about squashing commits in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, got it, thanks!

* Move test_save_mfdataset_pass_kwargs to test_backends.py
* Simplify the test
@taobrienlbl
Copy link
Contributor Author

In looking at the failing tests, I see that a test associated with dask is failing. I didn't have dask installed in my local test environment, so I missed that. I've installed it and can now see the failed test locally too. I'm looking in to this now.

Co-authored-by: Anderson Banihirwe <[email protected]>
@max-sixty max-sixty merged commit 89b1fac into pydata:main Jun 11, 2022
@max-sixty
Copy link
Collaborator

Thanks @taobrienlbl !

dcherian added a commit to dcherian/xarray that referenced this pull request Jun 12, 2022
* main:
  pass kwargs through from save_mfdataset to to_netcdf (pydata#6686)
  Docs: indexing.rst finetuning (pydata#6685)
  use micromamba instead of mamba (pydata#6674)
  install the development version of `matplotlib` into the upstream-dev CI (pydata#6675)
  Add whatsnew section for v2022.06.0
  release notes for 2022.06.0rc0
  release notes for the pre-release (pydata#6676)
  more testpypi workflow fixes (pydata#6673)
  thin: add examples (pydata#6663)
  Update multidimensional-coords.ipynb (pydata#6672)
  try to finally fix the TestPyPI workflow (pydata#6671)
  pin setuptools in the modify script (pydata#6669)
  fix the python version for the TestPyPI workflow (pydata#6668)
  upload wheels from `main` to TestPyPI (pydata#6660)
  Set keep_attrs for flox (pydata#6667)
@cvelascof
Copy link

thanks @taobrienlbl

dcherian added a commit to bzah/xarray that referenced this pull request Jun 24, 2022
* main: (129 commits)
  docs on specifying chunks in to_zarr encoding arg (pydata#6542)
  [skip-ci] List count under Aggregation (pydata#6711)
  Add `Dataset.dtypes` property (pydata#6706)
  try to import `UndefinedVariableError` from the new location (pydata#6701)
  DOC: note of how `chunks` can be defined (pydata#6696)
  pdyap version dependent client.open_url call (pydata#6656)
  use `pytest-reportlog` to generate upstream-dev CI failure reports (pydata#6699)
  [pre-commit.ci] pre-commit autoupdate (pydata#6694)
  Bump actions/setup-python from 3 to 4 (pydata#6692)
  Fix Dataset.where with drop=True and mixed dims (pydata#6690)
  pass kwargs through from save_mfdataset to to_netcdf (pydata#6686)
  Docs: indexing.rst finetuning (pydata#6685)
  use micromamba instead of mamba (pydata#6674)
  install the development version of `matplotlib` into the upstream-dev CI (pydata#6675)
  Add whatsnew section for v2022.06.0
  release notes for 2022.06.0rc0
  release notes for the pre-release (pydata#6676)
  more testpypi workflow fixes (pydata#6673)
  thin: add examples (pydata#6663)
  Update multidimensional-coords.ipynb (pydata#6672)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pass **kwargs through from save_mfdataset to to_netcdf

4 participants