Closed tlvu closed 2 months ago
@aulemahal
Is it possible that the fix for that was introduced here: https://github.com/Ouranosinc/xclim/commit/56d6ef7a957f47c6757fef6dadf0fd893163f2c4 is not working properly?
We even test to ensure that warnings are being properly raised! (https://github.com/Ouranosinc/xclim/commit/60e9a70c5abeb0e9a26ece895c060e46baa06dc6)
This fix was introduced in the latest xclim
(v0.43.0) so the only explanation I can offer is xclim
is not at the newest version in this environment.
Potential cause found!
The changes in scipy
were completed here: https://github.com/scipy/scipy/pull/16835 and were implemented in scipy>=1.10.1
(not 1.9.0
).
@tlvu What version of scipy is running in the environment?
Potential cause found!
The changes in
scipy
were completed here: scipy/scipy#16835 and were implemented inscipy>=1.10.1
(not1.9.0
).@tlvu What version of scipy is running in the environment?
py310 not working : xclim=0.43.0=py310hff52083_1
+ scipy=1.10.1=py310ha4c1d20_3
py39 working: xclim=0.43.0=py39hf3d152e_1
+ scipy=1.9.1=py39h8ba3f38_0
I don't have a full understanding of whats going on, but the
popmean` error appears when the array is empty, which happens when the time series is entirely filled with NaNs that are compressed by the test algorithm. In short, the ocean domain will fail because the data are all nans.
Not sure why this didn't fail before.
One workaround is to compute the test only on land.
fut = ds_ens.sel(time=slice("2071", "2100")).chunk(dict(realization=-1))
ref = ds_ens.sel(time=slice("1981", "2010")).chunk(dict(realization=-1))
f = fut.sel(time=fut["time.season"] == "JJA").tx_days_above
r = ref.sel(time=ref["time.season"] == "JJA").tx_days_above
import xarray as xr
tmp = xr.Dataset(dict(ref=r, fut=f))
# Find coordinates that are all NaNs
mask = (f.isnull().all(dim="time") + f.isnull().all(dim="time")).isel(realization=0).compute()
# Compute significance only on valid coordinates
valid = tmp.groupby(mask)[False]
chng_f, pos_f = xens.change_significance(valid.fut, valid.ref, test="ttest")
# Unstack results
chng_f = chng_f.unstack()
pos_f = pos_f.unstack()
Now for a reason I don't understand, with the Alpha env on Jupyter the results are all NaNs or inf, so there might be something else going on.
PR for fix in xclim: https://github.com/Ouranosinc/xclim/pull/1380/
No changes will be needed to the NB if we merge the xclim PR and release a new xclim version before we update scipy to 1.10 in the jupyter env.
Just to confirm, we will not be releasing a new xclim at 17h20 on a Friday, right?
Should be fixed by https://github.com/Ouranosinc/PAVICS-e2e-workflow-tests/pull/121
Error below only happen with 3.10, not 3.9.