oocgcm
oocgcm copied to clipboard
Problem while reading a self-made netcdf file with io.return_xarray_mfdataset
Hello,
My problem is as follows: I want to read a self-made netcdf file with io.return_xarray_mfdataset. The netcdf header gives:
group: netcdf4 { dimensions: y = 3454 ; x = 5422 ; t = 1 ; variables: float nav_lat(y, x) ; nav_lat:axis = "Y" ; nav_lat:standard_name = "latitude" ; nav_lat:long_name = "Latitude" ; nav_lat:units = "degrees_north" ; nav_lat:nav_model = "grid_T" ; float nav_lon(y, x) ; nav_lon:axis = "X" ; nav_lon:standard_name = "longitude" ; nav_lon:long_name = "Longitude" ; nav_lon:units = "degrees_east" ; nav_lon:nav_model = "grid_T" ; double time_centered(t) ; time_centered:standard_name = "time" ; time_centered:long_name = "Time axis" ; time_centered:title = "Time" ; time_centered:time_origin = "1958-01-01 00:00:00" ; time_centered:bounds = "time_centered_bounds" ; time_centered:units = "seconds since 1958-01-01" ; time_centered:calendar = "gregorian" ; double t(t) ; t:axis = "T" ; t:standard_name = "time" ; t:long_name = "Time axis" ; t:title = "Time" ; t:time_origin = "1958-01-01 00:00:00" ; t:bounds = "time_counter_bounds" ; t:units = "seconds since 1958-01-01" ; t:calendar = "gregorian" ; float sossheig(t, y, x) ; sossheig:_FillValue = 0.f ; sossheig:long_name = "sea surface height" ; sossheig:units = "m" ; sossheig:online_operation = "average" ; sossheig:interval_operation = "40s" ; sossheig:interval_write = "5d" ; sossheig:coordinates = "nav_lon nav_lat time_centered" ; } // group netcdf4
My code is:
from oocgcm.core import io
chunks = (1727, 2711)
xr_chunks_tmean = {'y': chunks[-2], 'x': chunks[-1], 't':1}
vmean_xrt =io.return_xarray_mfdataset(filemean, chunks=xr_chunks_tmean)[vdict[vkey]['vname']][:]
I get the error output
ValueError: some chunks keys are not dimensions on this object: ['y', 'x', 't']