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

[BUG] Time coordinate being dropped by apply_as_grid_ufunc #575

Open
TomNicholas opened this issue Jan 26, 2023 · 3 comments · May be fixed by #583
Open

[BUG] Time coordinate being dropped by apply_as_grid_ufunc #575

TomNicholas opened this issue Jan 26, 2023 · 3 comments · May be fixed by #583
Labels

Comments

@TomNicholas
Copy link
Contributor

In this notebook the time index gets silently dropped when the grid ufunc is applied. This behavior should be checked by xgcm in keep_coords and so on.

@TomNicholas
Copy link
Contributor Author

@jbusecke pretty sure this is being caused by the _strip_all_coords function you added in the padding code. I think I understand why you want to strip coords along dimensions along which you are padding, but why also strip them along all other dimensions too?

It was a confusing bug to find because all grid-related coordinates are re-attached at the end of apply_as_grid_ufunc but in this case time is not in the grid, but it is stripped by _strip_all_coords, so it gets lost.

@jbusecke
Copy link
Contributor

It was a confusing bug to find because all grid-related coordinates are re-attached at the end of apply_as_grid_ufunc but in this case time is not in the grid, but it is stripped by _strip_all_coords, so it gets lost.

I see. That is not desirable. Can you come up with a synthetic test case that reproduces this failure as a PR?

From what I can remember the issue here is that padding with nans caused a bunch of issues, and thus stripping the coordinates helped.

Maybe we can relax the stripping by doing something along these lines?

axis_dims = _axis_names_from_boundary_width(boundary_width)
data = _strip_coords(data, axis_dims) # only stripping the dimension coords along the axes that are actually padded.

@TomNicholas
Copy link
Contributor Author

TomNicholas commented Feb 14, 2023 via email

@TomNicholas TomNicholas linked a pull request Feb 14, 2023 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants