cartopy icon indicating copy to clipboard operation
cartopy copied to clipboard

add_cyclic returns numpy arrays, not xarrays

Open oliviermarti opened this issue 1 year ago • 1 comments

Description

cartopy.util.add_cyclic returns numpy arrays, not xarrays.

This is uncomfortable in a lot a cases. For instance one can not use the plot facilities of xarray

In cartopy 0.22.0

Olivier

oliviermarti avatar Mar 08 '24 12:03 oliviermarti

Cartopy does not know about Xarray so would not have specific support for that. add_cyclic uses slicing and numpy.concatenate so it's possible that if Xarray were to support numpy.concatenate via NEP18 it might just work. I just tried add_cyclic with a dask array (dask supports NEP18) and that seemed to work fine. It would likely be a lot less work to write an Xarray version of add_cyclic outside of Cartopy though.

I'm not sure that there is anything we can do for this on the Cartopy side.

rcomer avatar Mar 08 '24 16:03 rcomer