salem
salem copied to clipboard
Add automated roll() function to DataArray and Dataset
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
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.
Thanks for the tip @darothen !