You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When converting from a GRIBReader object to an xarray object with to_xarray, squeeze() is called on the resulting xarray Dataset. If the variable in the Dataset is a function of a dimension of length 1, then this dimension is removed as both a dimension and a coordinate, leaving the variable as a function of only the remaining dimensions. This is removing useful metadata - for example, if you have a single timestep of a gridded field, this is removing the time coordinate completely, removing useful metadata.
To see an example of this in action, try the following:
When calling to_xarray() on a GRIBReader, if there is a dimension of length 1, it should be dropped as a dimension but not as a coordinate. For example, using the same example as above, the coordinates and dimensions of the resulting xarray Dataset should look something like this:
Is your feature request related to a problem? Please describe.
When converting from a
GRIBReader
object to an xarray object withto_xarray
,squeeze()
is called on the resulting xarray Dataset. If the variable in the Dataset is a function of a dimension of length 1, then this dimension is removed as both a dimension and a coordinate, leaving the variable as a function of only the remaining dimensions. This is removing useful metadata - for example, if you have a single timestep of a gridded field, this is removing the time coordinate completely, removing useful metadata.To see an example of this in action, try the following:
The resulting xarray Dataset has no time coordinate:
Describe the solution you'd like
When calling
to_xarray()
on aGRIBReader
, if there is a dimension of length 1, it should be dropped as a dimension but not as a coordinate. For example, using the same example as above, the coordinates and dimensions of the resulting xarray Dataset should look something like this:Notice that the
valid_time
coordinate remains even though it was dropped as a dimension.Describe alternatives you've considered
No response
Additional context
No response
Organisation
ECMWF
The text was updated successfully, but these errors were encountered: