-
Notifications
You must be signed in to change notification settings - Fork 33
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
pin xgcm < 0.7 #243
Comments
Will keep this open, as pining |
The new version of More on xarray changes released last week are here https://docs.xarray.dev/en/stable/whats-new.html#v2022-06-0-july-21-2022 Using the new release of xarray (version 2022.6) did cause an error in Sciserver in dmaskT = maskT.where(maskT, drop=True) before the cutout. I need some time to fully understand and fix these incompatibility issues (should be small, but subtle). This all is related to Ryan's refactoring proposals in #224. Thus, a fix to this current issue should also fix #224. |
Explore this issue when #224 is addressed.... |
The survey station is also broken by changes in xgcm, with a similar message. |
Makes sense, as there is some interpolation happening there. |
I don't think we should change anything here, although it apparently breaks a lot of things. Oceanspy is only trying to do the most basic things xgcm promises, interpolate velocity to the center point. If the velocity dataset is chunked, then you would have this issue. This is a known bug they have mentioned many many times. xgcm/xgcm#522 I have adapted their tutorial just a little bit to reproduce this bug.
|
Thanks for looking into this. It is re assuring that we don't need to make changes regarding So it seems that keep pinning dmaskT = maskT.where(maskT, drop=True) I don't remember the actual example where this happened, but I am guessing in one of the example notebooks (not LLC specific). |
I am having a bit of a hard time finding this issue. I am using newer version of xarray to cutout LLC datasets now. It seems fine to me |
So, can we unpin |
PR #270 unpins xarray and all tests pass |
It looks like they have mostly solve this issue in the latest xgcm version. I ran the example above by @MaceKuailv from xgcm import Grid
ds = xr.Dataset(
coords={
"x_c": (
["x_c"],
np.arange(1, 10),
),
"x_g": (
["x_g"],
np.arange(1.5, 9),
),
}
)
grid = Grid(ds, coords={"X": {"center": "x_c", "inner": "x_g"}})
da = np.sin(ds.x_c * 2 * np.pi / 9)
da = da.chunk((9)) # if it is not chunked, then no error
da_interp = grid.diff(da, axis="X") and runs fine. This issue xgcm/xgcm#522 explains their approach, which is basically that single chunking along a core dimension works (it had stopped working). Multiple or arbitrary chunks along a core dimension yields the same error. They have updated the error to suggest rechunking to a single chunk along the dimension if possible. I will again update the binder shortly. |
Description
There have been major updates to
xgcm
, regardinggeneralized ufuncs
, resulting in some changes to the way grid interpolates and calculates derivatives. These shouldn't affectoceanspy
at the fundamental level, but have been causing some trouble.For a better description on the changes to
xgcm
see:xgcm/xgcm#344
These new changes involve refactoring, and are somewhat related to #224.
Changes to
xgcm
have been implemented in versions >= 0.7. You can see the description of new features here: https://xgcm.readthedocs.io/en/latest/whats-new.htmlAs a result of the changes, the following code does not work after performing the cutout (the cutout works well, as you can make plots which trigger the calculation):
which yields the error
Also, beginning with version 0.7 the
grid.interp
argumentno longer appears as an option on the description/documentation and there was some discussion to remove
extrapolate
as an option completely, although for now (as of version0.8
), it is still possible to continue using it.Quick fix
Pin
xgcm
to version0.6
while I work on figuring out the best fix to this. There is strong possibility that the error only affects the grid post-cutout, and so the fix will be local to the code where I update the grid object with the new (subsampled) dataset. I just need to some to figure it out.The text was updated successfully, but these errors were encountered: