xarray-contrib/cf-xarray

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?

"X": re.compile("x|i|nlon|ni"),

and maybe also add grid_longitude and grid_latitude to the X, Y criteria here?

"standard_name": ("projection_x_coordinate",),

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.

See these discussions:
#23
#87

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 pole
  • projection_x_angular_coordinate / projection_y_angular_coordinate for geostationary
  • projection_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.