pangeo-data / xESMF

Universal Regridder for Geospatial Data
http://xesmf.readthedocs.io/
MIT License
182 stars 32 forks source link

"Input array is not C_CONTIGUOUS" warning despite c-contiguous input #329

Open tyfolino opened 5 months ago

tyfolino commented 5 months ago

Hi!

I'm using xESMF in my Python package to take care of regridding. A certain input dataset constantly raises UserWarning: Input array is not C_CONTIGUOUS. Will affect performance.. The dataset in question can be found in this Zenodo repository under kernels/HadGEM3-GA7.1/TOA_HadGEM-GA7.1_Kerns.nc. A word of caution: they are quite large files.

What is confusing me, however, is that when I check the C_CONTIGUOUS flag of each variable, I get back True:

> False in [np.array(v).flags['C_CONTIGUOUS'] for v in ds_in_question.variables]

False

> False in [np.array(v).flags['C_CONTIGUOUS'] for v in ds_in_question.coords]

False

I have even tried casting to C-order using Xarray's .astype() function without success.

I'd love to get some insight into this issue so I don't have to arbitrarily suppress these warnings when using my package.

Thank you!