xgcm icon indicating copy to clipboard operation
xgcm copied to clipboard

Propagated unpadded coords in pad

Open TomNicholas opened this issue 2 years ago • 3 comments

  • [ ] Closes #575
  • [x] Tests added
  • [x] Passes pre-commit run --all-files
  • [ ] User visible changes (including notable bug fixes) are documented in whats-new.rst
  • [ ] ~~New functions/methods are listed in api.rst~~

TomNicholas avatar Feb 14 '23 23:02 TomNicholas

@jbusecke to fix #575 we need to change _strip_all_coords to instead strip only the coords which are a function of the padded dimensions. Therefore we need a function like

def _strip_axis_coords(da, padding_axes):
   ...

For _pad_basic this is fine, but for face-connected grids its the implementation is a bit more complicated because pad_axes is not known until after you know you have a face-connected grid.

Instead how about we move the coordinate stripping inside of _pad_basic?

TomNicholas avatar Feb 14 '23 23:02 TomNicholas

For _pad_basic this is fine, but for face-connected grids its the implementation is a bit more complicated because pad_axes is not known until after you know you have a face-connected grid.

I am not sure I follow this entirely. But could we do something like this:

def _strip_all_axis_coords(da, grid):
    # get rid of any dim that is associated with a grid axis
   ...

If I understand this correctly, the problem was not with dims associated with an axis that is not being padded, but instead with dims that are not associated with any axis? This approach would strip more than is needed, but would still probably work?

jbusecke avatar Feb 16 '23 20:02 jbusecke

@TomNicholas I am starting to get back into hopefully more regular maintainer duties. Do you have any time soon to check in on this? Happy to meet up and figure this out too.

jbusecke avatar Oct 17 '24 15:10 jbusecke