Skip to content

Add DataArray.pad, Dataset.pad, Variable.pad - #3596

Merged
dcherian merged 25 commits into
pydata:masterfrom
mark-boer:feature/dataarray_pad
Mar 19, 2020
Merged

dcherian merged 25 commits into
pydata:masterfrom
mark-boer:feature/dataarray_pad

Conversation

@mark-boer

@mark-boer mark-boer commented Dec 4, 2019 •

Copy link
Copy Markdown
Contributor

Hello all,

This is my first PR to a pydata project. This pull request is still very much a work in progress and I could really use your input on a couple of things.

  • Closes Pad method #2605
  • Tests added
  • Passes black . && mypy . && flake8
  • Fully documented, including whats-new.rst for all changes and api.rst for new API
  1. I moved the custom dask pad method into dask_array_compat to ensure backwards compatability to Dask versions that do not have dask.pad yet. We could chose to drop this support if we wanted to.
  2. I'm still in doubt about the function signature, numpy as dask use optional kwargs, but that kinda interferes with the **pad_width_kwargs. I chose the signature that I thought looked least awkward.
  3. The default behaviour of pad with mode=constant pads with NaN's converting the array to float in the process. This goes against the default behaviour of numpy as dask.
  4. How should the coordinates of a DataArray be padded? I chose default padding except for modes "edge", "reflect", "symmetric", "wrap".
  5. How should we handle inconsistencies between numpy.pad and Dask.pad, it turns out there are a couple 5303

Dataset.pad is coming up.

Loading
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.

Pad method

6 participants