0

I have the following xarray dataset:

Dimensions:    (latitude: 17664, longitude: 22656, time: 1)
Coordinates:
  * longitude  (longitude) float32 -46.0 -46.0 -45.99 -45.99 ... 12.99 13.0 13.0
  * latitude   (latitude) float32 66.0 66.0 65.99 65.99 ... 20.01 20.0 20.0
  * time       (time) float64 8.373e+08
Data variables:
    mean       (latitude, longitude) float32 nan nan nan nan ... nan nan nan nan
    count      (latitude, longitude) int64 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0
    stdev      (latitude, longitude) float32 nan nan nan nan ... nan nan nan nan
    sum        (latitude, longitude) float32 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
    sumsq      (latitude, longitude) float32 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0

If I write this out to netcdf like so output.to_netcdf('test_file.nc',group=var,encoding=tot_encode,mode='w') and ncview the file - the latitude appears to be upside-down. However if I write out like so output.to_netcdf('test_file.nc',encoding=tot_encode,mode='w') (i.e not in a group) the latitude is the correct way around? Not sure what is going on? Thanks

Ben Howey
  • 33
  • 3
  • Are you writing this into a group with other data already present or is this a new file? And any chance we could get a [mre]? This seems like it could be a bug so we’ll want to fully test it. Thanks! – Michael Delgado Dec 13 '22 at 16:21
  • Also, do you know that ncview can correctly display variables with inverted coordinates in groups like this? Does the data read correctly back into xarray? – Michael Delgado Dec 13 '22 at 16:24

0 Answers0