metocean / wavespectra

MIT License
1 stars 1 forks source link

update of 'xarray.ufuncs' syntax #49

Closed phellipecouto closed 5 months ago

phellipecouto commented 5 months ago

Recent xarray versions (not sure from which version exactly) no longer has numpy methods embedded in xarray.ufuncs, instead, numpy methods must be provided as argument to xarray_apply_ufunc - see example below:

old syntax:

B = xr.ufuncs.maximum(lam, 0.01) + 0.25

new syntax:

B = xr.apply_ufunc(np.maximum, lam, 0.01) + 0.25

If the proposed changes are accepted, then limiting xarray to <2022.06.0 (as in de576eb) shall no longer be necessary (?)

jorgeperezg commented 5 months ago

xarray.ufuncs was first deprecated in xarray v0.10.2 (13 March 2018) and was fully removed in v2022.06.0rc0 (9 June 2022).

I think that it's a safe change.

phellipecouto commented 5 months ago

Thanks for the additional info, @jorgeperezg. Will tag a new version reflecting this change.