-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
This set of lines prevents users from writing files with a handcrafted coordinates attribute. This is useful when not all non-dimensional coordinates in a Dataset are appropriate for every data variable in a dataset.
Lines 667 to 675 in 16fdac9
| # These coordinates are saved according to CF conventions | |
| for var_name, coord_names in variable_coordinates.items(): | |
| attrs = variables[var_name].attrs | |
| if "coordinates" in attrs: | |
| raise ValueError( | |
| "cannot serialize coordinates because variable " | |
| "%s already has an attribute 'coordinates'" % var_name | |
| ) | |
| attrs["coordinates"] = " ".join(map(str, coord_names)) |
It seems to me like we should only automatically set "coordinates" when "coordinates" not in attrs. We could raise a warning saying that setting attrs["coordinates"] prevents full roundtripping of Datasets.
What do you think?
lacstorm