Guessing bounds on unindexed dimensions unsupported
aulemahal opened this issue · 0 comments
Code says:
cf-xarray/cf_xarray/accessor.py
Lines 497 to 500 in 3795af6
That makes sense if you are trying to get the bounds of a dimension which has no index. In that case, xarray will create a range-like index out of thin air and you'll get bounds that do not correspond to anything present in the dataset.
However, a coordinate could be given along unindexed dimensions. The unindexed dimension itself is never used in itself, it's only that the diff
is taken along it.
Of course, that doesn't come up often with 1D coordinates, but it is quite frequent with 2D ones! I encountered this issue while trying to enable the new 2D bounds in xESMF
. Sadly, I didn't detect it in my tests, as I was using rotated pole data, which almost always has rlat
and rlon
. This is not the case of other curvilinear grid types.
If I am right, then this error can't be detected in that function. We have to detect it before "extracting" the coordinate from the dataset, so within cf.add_bounds
.