xarray
xarray copied to clipboard
`.fillna()` slower than expected for sparse data arrays with `fill_value=nan`
What is your issue?
Expected behavior
.fillna(0)
should be near instantaneous when applied to a sparse DataArray with fill_value=nan
Why
.fillna(0)
only needs to update the fill_value
to 0
.
Current behaviour
The normal .where()
operation is applied on the DataArray instead of using the shortcut described above.
Question
What would be required to improve the performance of fillna()
? I'm happy to try taking a stab at it if pointed in the right direction.
Thanks for opening your first issue here at xarray! Be sure to follow the issue template! If you have an idea for a solution, we would really welcome a Pull Request with proposed changes. See the Contributing Guide for more. It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better. Thank you!