-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Is your feature request related to a problem?
I am experiencing some issues with the way coordinates are padded. Currently the coordinates are padded according to the mode
parameter passed to pad()
here. For my particular issue I want to be able to have different modes for the data, but effectively pin the mode that is used to pad the coordinate values.
A simple example:
import xarray as xr
import numpy as np
da = xr.DataArray([1,2,3], dims=['x'], coords={'x':[4,5,6]})
da
If I pad with constant
da.pad(x=(0,1), mode='constant')
I get this:
which is the coordinate padding I need.
But if I pad with wrap
:
da.pad(x=(0,1), mode='wrap')
which gives me repeated coordinate values
Describe the solution you'd like
I would like to be able to do something like this:
da.pad(x=(0,1), mode='wrap', coord_pad_mode='constant')
Since #3596 internally already defines coord_pad_mode
it should be easy enough to expose this to the user?
Possibly related (but I think not incompatible with the changes propsed here?): #3868
Happy to work with @TomNicholas on a PR, but wanted to get some feedback/comments first.
cc @dcherian @mark-boer who worked on this code.
Describe alternatives you've considered
No response
Additional context
No response