Skip to content

cdms2 generating wrong longitude axis topology when reading grads dat/ctl data ? #433

@jypeter

Description

@jypeter

@jasonb5 I don't have time to upload a test file (before next week), but maybe you can test this anyway

I have converted a grads dat/ctl file using cdms2

The ctl file has the following content

dset   ^topography-read.dat
options big_endian
undef  -1.0000E+20
title ECBILT orography
xdef  64 linear    0.00   5.62
ydef  32 levels
 -85.7606 -80.2688 -74.7445 -69.2130 -63.6786
 -58.1430 -52.6065 -47.0696 -41.5325 -35.9951
 -30.4576 -24.9199 -19.3822 -13.8445 -8.30670
 -2.76890 2.76890 8.30670 13.8445 19.3822
  24.9199 30.4576 35.9951 41.5325 47.0696
  52.6065 58.1430 63.6786 69.2130 74.7445
  80.2688 85.7606
zdef   1 linear    0.00   1.00
tdef    1 linear 1jan0001  1YR
vars 1
orog 1  99 orography ECBILT
endvars

Things worked fine, except that the generated lon axis in the generated file has conflicting topology/realtopology information that ends up with my lon axis losing its periodicity. That is, the generated file has longitudes from 0 to 360, but when I request longitudes from -180 to 180, I end up with a longitude axis that only goes from 0 to 180

>>> v = f('orog')
>>> v.shape
(32, 64)
>>> v2 = f('orog', longitude=(-180,180,'co'))
>>> v2.shape
(32, 33)
>>> v.getLongitude()
   id: longitude
   Designated a longitude axis.
   units:  degrees_east
   Length: 64
   First:  0.0
   Last:   354.06
   Other axis attributes:
      axis: X
      modulo: 360.0
      topology: circular
      realtopology: linear
   Python id:  0x2b10141ff2e0

>>> v2.getLongitude()
   id: longitude
   Designated a longitude axis.
   units:  degrees_east
   Length: 33
   First:  0.0
   Last:   179.84
   Other axis attributes:
      axis: X
      modulo: 360.0
      topology: circular
      realtopology: linear
   Python id:  0x2b1014251f70

Any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions