home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1068869457

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/6310#issuecomment-1068869457 https://api.github.com/repos/pydata/xarray/issues/6310 1068869457 IC_kwDOAMm_X84_tadR 57705593 2022-03-16T08:39:02Z 2022-03-16T08:40:08Z CONTRIBUTOR

Hey @dcherian,

Thanks for your consideration! I just started to create a new branch with my suggested changes, but then I noticed that setting the coordinates attribute to include non-auxiliary dimensions by default will let a lot of unit tests fail. That made me think about this again: In fact, always setting the coordinates attribute is permissible according to the conventions. However, most users will probably be confused about the clutter and we might run into some discussions about this in the future.

In my original post, the example can easily be fixed to reflect the coordinate attributes in the conventions (https://cfconventions.org/cf-conventions/cf-conventions.html#_single_trajectory) by enforcing the attribute value in the encoding: python import xarray as xr ds = xr.Dataset( {"values": ('time', [0.0, 0.1])}, coords={ 'time': ('time', [0, 1]), 'lat': ('time', [5, 4]), 'lon': ('time', [10, 12]) }) ds['values'].encoding['coordinates'] = "time lon lat" ds.to_netcdf("test.nc") shell $ ncdump -h test.nc netcdf test { dimensions: time = 2 ; variables: double values(time) ; values:_FillValue = NaN ; values:coordinates = "time lon lat" ; int64 time(time) ; int64 lat(time) ; int64 lon(time) ; }

From here, there are several ways to proceed: 1. Stick to the current logic which might be non-conformal with the CF conventions in case of "Discrete Sampling Geometries". However, users can manually fix this by setting the coordinates in encoding. 2. Enforce to always list all non-auxiliary coordinates in the variable attribute, which is conformal with the conventions, but generates a lot of clutter. 3. Implement a logic to recognize cases where a dataset is a "Discrete Sampling Geometry" and only then list the non-auxiliary coordinates in the variable attribute. This is a bit tricky, and I don't have the time to implement this, I'm afraid.

I actually suggest to choose solution (1) and close this issue as "won't fix". What do you think?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1154014066
Powered by Datasette · Queries took 1.111ms · About: xarray-datasette