Skip to content

xgcm error

Did something change on the HLRN Berlin between Sep 10 and Sep 11? I had a script that worked perfectly fine and after changing nothing, xgcm has some problems:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-78-d3d23357ec67> in <module>()
----> 1 dgrid = xgcm.Grid(dbox, periodic=['X', 'Y'])

/gfs1/work/shkifmwr/_TM/software/miniconda3_20180131/envs/py3_std/lib/python3.6/site-packages/xgcm/grid.py in __init__(self, ds, check_dims, periodic, default_shifts)
    503                 axis_default_shifts = {}
    504             self.axes[axis_name] = Axis(ds, axis_name, is_periodic,
--> 505                                         default_shifts=axis_default_shifts)
    506 
    507 

/gfs1/work/shkifmwr/_TM/software/miniconda3_20180131/envs/py3_std/lib/python3.6/site-packages/xgcm/grid.py in __init__(self, ds, axis_name, periodic, default_shifts)
    109         if len(coords_without_axis_shift) == 0:
    110             raise ValueError("Couldn't find a center coordinate for axis %s"
--> 111                              % axis_name)
    112         elif len(coords_without_axis_shift) > 1:
    113             raise ValueError("Found two coordinates without "

ValueError: Couldn't find a center coordinate for axis Z

dbox, from which I want to construct the Grid instance looks like this:

<xarray.Dataset>
Dimensions:    (t: 6, x_c: 47, x_r: 47, y_c: 73, y_r: 73, z_c: 35, z_l: 36)
Coordinates:
  * y_c        (y_c) int64 147 148 149 150 151 152 153 154 155 156 157 158 ...
  * x_c        (x_c) int64 236 237 238 239 240 241 242 243 244 245 246 247 ...
    llat_cc    (y_c, x_c) float32 dask.array<shape=(73, 47), chunksize=(54, 47)>
    llon_cc    (y_c, x_c) float32 dask.array<shape=(73, 47), chunksize=(54, 47)>
  * t          (t) datetime64[ns] 1985-02-02T12:00:00 1985-02-07T12:00:00 ...
    e1t        (y_c, x_c) float64 dask.array<shape=(73, 47), chunksize=(54, 47)>
    e2t        (y_c, x_c) float64 dask.array<shape=(73, 47), chunksize=(54, 47)>
  * z_c        (z_c) int64 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...
    depth_c    (z_c) float64 dask.array<shape=(35,), chunksize=(23,)>
    e3t        (z_c, y_c, x_c) float64 dask.array<shape=(35, 73, 47), chunksize=(23, 54, 47)>
    tmask      (z_c, y_c, x_c) int8 dask.array<shape=(35, 73, 47), chunksize=(23, 54, 47)>
  * z_l        (z_l) float64 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5 10.5 ...
    depth_l    (z_l) float64 dask.array<shape=(36,), chunksize=(23,)>
    e3w        (z_l, y_c, x_c) float64 dask.array<shape=(36, 73, 47), chunksize=(23, 54, 47)>
    box_tmask  (z_c, y_c, x_c) float64 dask.array<shape=(35, 73, 47), chunksize=(23, 54, 47)>
  * x_r        (x_r) float64 236.5 237.5 238.5 239.5 240.5 241.5 242.5 243.5 ...
    llat_cr    (y_c, x_r) float32 dask.array<shape=(73, 47), chunksize=(54, 47)>
    llon_cr    (y_c, x_r) float32 dask.array<shape=(73, 47), chunksize=(54, 47)>
    e1u        (y_c, x_r) float64 dask.array<shape=(73, 47), chunksize=(54, 47)>
    e2u        (y_c, x_r) float64 dask.array<shape=(73, 47), chunksize=(54, 47)>
    e3u        (z_c, y_c, x_r) float64 dask.array<shape=(35, 73, 47), chunksize=(23, 54, 47)>
    umask      (z_c, y_c, x_r) int8 dask.array<shape=(35, 73, 47), chunksize=(23, 54, 47)>
    box_umask  (z_c, y_c, x_r) float64 dask.array<shape=(35, 73, 47), chunksize=(23, 54, 47)>
  * y_r        (y_r) float64 147.5 148.5 149.5 150.5 151.5 152.5 153.5 154.5 ...
    llat_rc    (y_r, x_c) float32 dask.array<shape=(73, 47), chunksize=(54, 47)>
    llon_rc    (y_r, x_c) float32 dask.array<shape=(73, 47), chunksize=(54, 47)>
    e1v        (y_r, x_c) float64 dask.array<shape=(73, 47), chunksize=(54, 47)>
    e2v        (y_r, x_c) float64 dask.array<shape=(73, 47), chunksize=(54, 47)>
    e3v        (z_c, y_r, x_c) float64 dask.array<shape=(35, 73, 47), chunksize=(23, 54, 47)>
    vmask      (z_c, y_r, x_c) int8 dask.array<shape=(35, 73, 47), chunksize=(23, 54, 47)>
    box_vmask  (z_c, y_r, x_c) float64 dask.array<shape=(35, 73, 47), chunksize=(23, 54, 47)>
    llat_rr    (y_r, x_r) float32 dask.array<shape=(73, 47), chunksize=(54, 47)>
    llon_rr    (y_r, x_r) float32 dask.array<shape=(73, 47), chunksize=(54, 47)>
    e1f        (y_r, x_r) float64 dask.array<shape=(73, 47), chunksize=(54, 47)>
    e2f        (y_r, x_r) float64 dask.array<shape=(73, 47), chunksize=(54, 47)>
    fmask      (z_c, y_r, x_r) int8 dask.array<shape=(35, 73, 47), chunksize=(23, 54, 47)>
    box_fmask  (z_c, y_r, x_r) float64 dask.array<shape=(35, 73, 47), chunksize=(23, 54, 47)>
    e3f        (z_c, y_r, x_r) float64 6.191 6.191 6.191 6.191 6.191 6.191 ...
Data variables:
    sobowlin   (t, y_c, x_c) float64 dask.array<shape=(6, 73, 47), chunksize=(1, 54, 47)>
    sohefldo   (t, y_c, x_c) float64 dask.array<shape=(6, 73, 47), chunksize=(1, 54, 47)>
    sohefldp   (t, y_c, x_c) float64 dask.array<shape=(6, 73, 47), chunksize=(1, 54, 47)>
    somixhgt   (t, y_c, x_c) float64 dask.array<shape=(6, 73, 47), chunksize=(1, 54, 47)>
    soshfldo   (t, y_c, x_c) float64 dask.array<shape=(6, 73, 47), chunksize=(1, 54, 47)>
    sowafldp   (t, y_c, x_c) float64 dask.array<shape=(6, 73, 47), chunksize=(1, 54, 47)>
    sowaflup   (t, y_c, x_c) float64 dask.array<shape=(6, 73, 47), chunksize=(1, 54, 47)>
    sowindsp   (t, y_c, x_c) float64 dask.array<shape=(6, 73, 47), chunksize=(1, 54, 47)>
    vosaline   (t, z_c, y_c, x_c) float64 dask.array<shape=(6, 35, 73, 47), chunksize=(1, 23, 54, 47)>
    votemper   (t, z_c, y_c, x_c) float64 dask.array<shape=(6, 35, 73, 47), chunksize=(1, 23, 54, 47)>
    vosigma0   (t, z_c, y_c, x_c) float64 dask.array<shape=(6, 35, 73, 47), chunksize=(1, 23, 54, 47)>
    vosigma1   (t, z_c, y_c, x_c) float64 dask.array<shape=(6, 35, 73, 47), chunksize=(1, 23, 54, 47)>
    vosigma2   (t, z_c, y_c, x_c) float64 dask.array<shape=(6, 35, 73, 47), chunksize=(1, 23, 54, 47)>
    vototvor   (t, z_l, y_c, x_c) float64 dask.array<shape=(6, 36, 73, 47), chunksize=(1, 23, 54, 47)>
    vorelvor   (t, z_l, y_c, x_c) float64 dask.array<shape=(6, 36, 73, 47), chunksize=(1, 23, 54, 47)>
    vostrvor   (t, z_l, y_c, x_c) float64 dask.array<shape=(6, 36, 73, 47), chunksize=(1, 23, 54, 47)>
    sozotaux   (t, y_c, x_r) float64 dask.array<shape=(6, 73, 47), chunksize=(1, 54, 47)>
    vozocrtx   (t, z_c, y_c, x_r) float64 dask.array<shape=(6, 35, 73, 47), chunksize=(1, 23, 54, 47)>
    sometauy   (t, y_r, x_c) float64 dask.array<shape=(6, 73, 47), chunksize=(1, 54, 47)>
    vomecrty   (t, z_c, y_r, x_c) float64 dask.array<shape=(6, 35, 73, 47), chunksize=(1, 23, 54, 47)>

Looks like everything required for a successful definition of a grid is there....