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

Custom fill value for align, reindex and reindex_like #2876

Closed
shoyer opened this issue Apr 7, 2019 · 2 comments · Fixed by #2920
Closed

Custom fill value for align, reindex and reindex_like #2876

shoyer opened this issue Apr 7, 2019 · 2 comments · Fixed by #2920

Comments

@shoyer
Copy link
Member

shoyer commented Apr 7, 2019

It would be nice to be able to specify a custom fill value other than NaN for alignment/reindexing, e.g.,

>>> xr.DataArray([0, 0], [('x', [1, 2])]).reindex(x=[0, 1, 2, 3], fill_value=-1)
<xarray.DataArray (x: 4)>
array([-1, 0, 0, -1])
Coordinates:
  * x        (x) int64 1 2 3 4

This should be pretty straightforward, simplify a matter of adding a fill_value keyword argument to the various interfaces and passing it on to Variable.__getitem_with_mask inside xarray.core.alignment.reindex_variables().

@zdgriffith
Copy link
Contributor

Hi, I'm a recent convert to xarray looking to start contributing - this seems like a good issue to dip my toes in. If there's no one currently working on this I'm happy to take it up.

@rabernat
Copy link
Contributor

rabernat commented Apr 11, 2019

Fantastic, welcome @zdgriffith! Our documentation has a page on contributing which I encourage you to read through.

Once you have your local development environment set up and your fork cloned, the next step is to start exploring the source code and figuring out where changes need to be made. At that point, you can post any questions you have here and we will be happy to give you some guidance.

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.

3 participants