-
Say I have data measured on a regularly spaced grid, e.g. array = DataArray(np.zeros((10, 10)), {"x": np.arange(10) * .1, "y": np.arange(10) * .1}) One issue with this representation is that it is slightly awkward to retrieve back the grid spacings dx and dy. Of course one can just do # take a subarray
sub = da[:-2, 2:]
print((sub.x[1] - sub.x[0]) - (sub.y[1] - sub.y[0])) returns Is there some way to represent the regularly spaced grid simply as a (start, stop, step) triplet (similarly to how stdlib python's range objects are represented?) (An alternative approach could be to just use x=0...(nx-1), y=0...(ny-1), and put dx, dy into array.attrs, but that doesn't play well with slicing e.g. Looking forward to your suggestions. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
see #8473 for a recent discussion on this topic |
Beta Was this translation helpful? Give feedback.
see #8473 for a recent discussion on this topic