coecms / xmhw

Xarray version of Marine Heatwaves code by Eric Olivier
https://xmhw.readthedocs.io/en/latest/
Apache License 2.0
22 stars 10 forks source link

Fix issue 49 #53

Closed paolap closed 1 year ago

paolap commented 1 year ago

To solve issue #49 caused by changes to the latest xarray:

In both threshold() and detect() was necessary to re-assign the coordinates, reset the "stacked" array using set_xindex to be able to unstack again, for example:

   dims = list(ts.cell.coords)
   mhw_results = [r[0].assign_coords({d: r[0][d][0].values for d in dims}) for r in results[0]]
    mhw = xr.concat(mhw_results, dim='cell')
    mhw = mhw.set_xindex(dims)
    mhw = mhw.unstack(dim='cell')
paolap commented 1 year ago

I also made some changes around data frames (in features.py) to avoid pandas warnings