identify `rlon`/`rlat` as `X`/`Y`
Closed this issue · 6 comments
It would be useful if we could have rlon
, rlat
also be identified as the X
, Y
axis from the variable name, e.g., adding them to the regex here?
cf-xarray/cf_xarray/criteria.py
Line 139 in ce9cd5a
and maybe also add grid_longitude
and grid_latitude
to the X
, Y
criteria here?
cf-xarray/cf_xarray/criteria.py
Line 97 in ce9cd5a
Are any of these always 1D? Maybe the projection coordinates are?
Basically we think that axis
varibales should be 1D coordinate variables. This provides an easy way to refer to dimensions, as opposed to nD coordinate variables, and that is useful for array analysis.
So we don't usually set axis="X"
on longitude
variables because they are frequently 2D.
If these are sometimes 2D, perhaps we only set them when they are 1D? See #368 for that request
Are any of these always 1D? Maybe the projection coordinates are?
Yes, the projection coordinates should always be 1D coordinates according to Appendix F. There are basically 3 standard names:
grid_latitude
/grid_longitude
for rotated poleprojection_x_angular_coordinate
/projection_y_angular_coordinate
for geostationaryprojection_x_coordinate
/projection_y_coordinate
for all others.
Actually the conventions explictily say, that they should be rectangular coordinates so they should be 1D. In the case of rotated pole, that's not explictily stated, but i have never encountered a dataset where rlon
, rlat
would be projection coordinates and not 1D.
So we don't usually set axis="X" on longitude variables because they are frequently 2D.
Yes, i agree! The coordinates i would like to identifiy with axis="X" would be those of the native rectangular grid coordinates.
If these are sometimes 2D, perhaps we only set them when they are 1D? See #368 for that request
Yes, i agree, for lon
/lat
a test for 2D would make sense, it can really be ambiguous if no attributes are provided.
Just saw, that iris uses the similar standard names to identify X
/Y
:
https://github.com/SciTools/iris/blob/9192442a8cfa0b30da07e4a9613d1dccb6c7a20d/lib/iris/util.py#L249-L260
Metpy uses the projection coordinates for X
. Y
: https://github.com/Unidata/MetPy/blob/db8588f46eeccaf1a177df13230485960fe1135e/src/metpy/xarray.py#L48-L51