salem icon indicating copy to clipboard operation
salem copied to clipboard

Add automated roll() function to DataArray and Dataset

Open fmaussion opened this issue 7 years ago • 2 comments

Based on http://xarray.pydata.org/en/stable/generated/xarray.DataArray.roll.html, it should be quite easy to implement a function wich automatically converts [-180, 180] datasets to [0,360] and vice versa

fmaussion avatar May 01 '17 08:05 fmaussion

Yes, it's quite easy. Here's a function to convert longitudes in (180, 360], then you would just use xarray.DataArray.roll.() along the longitude dimension, by length(longitude) - 1 units.

darothen avatar May 01 '17 14:05 darothen

Thanks for the tip @darothen !

fmaussion avatar May 01 '17 14:05 fmaussion