[gradsusr] pygrads: GrADS.imp problem with non latlon grids

Lorenzo Mentaschi lorenzo.mentaschi at unige.it
Wed Sep 26 06:33:29 EDT 2012


Hi all,
I have exactly the same problem: trying to export data from grads to python, from a grib file with a
non latlon grid, pygrads fails with the following error:


grads.gacore.GrADSError: 'invalid exchange metadata (idim,jdim)=(0,77724220109037511232075876794368)
- make sure <ugrd10m> is valid and that lon/lat is varying.'


Trying to debug the code I find exactly the same results as Davide.

To make things clearer, I submit a sample grib to verify the problem. To see it enter the folder where
you placed the file example.grb2.ctl and use the following commands:

>>> from grads import *
>>> g = GrADS()
>>> g.open("example.grb2.ctl")
>>> data = g.imp("ugrd10m")

You will see the error message. The example file contains a lambert conformal grid, but it seems to me that the problem
arises with every non latlon grid.

Thank you for the help!

Cheers,

Lorenzo




> Dears,
> We noticed some errors using pygrads with ctl files including pdef
> directives. Our grid is rotated, we used either pdef bilin or pdef
> rotllr, but errors on grid.meta in ganum._exp2d() are the same
> (exception raised on line 234 of ganum.py)

> It might be that there are some problems in parsing the first 20 values
> from ipc_save, or are we doing anything wrong?

> Using debug at line 224:
         (Pdb) grid.meta
         array([  1.84689701e+25,   1.57883589e-19,   7.77242201e+31,
                  7.14408185e+31,   4.10594102e+04,   1.93472401e-19,
                  7.21432390e+22,   1.15785712e+27,   7.22507008e+28,
                  2.44565409e+20,   1.12586784e+24,   2.72450326e+20,
                 -2.86196307e-23,   9.03173995e-39,   0.00000000e+00,
                  5.83155401e-39,   6.17844824e-39,   6.16194655e-39,
                  5.83155401e-39,  -1.19687500e+01], dtype=float32)
         

> configuration
> grads:   v2.0.1.oga.1
> python:  2.7.3
> pygrads: 1.1.b5
> numpy:   1.6.2

> thank you very much for your help
> Davide


-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.grb2.zip
Type: application/x-zip-compressed
Size: 185250 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20120926/878c8550/attachment-0003.bin 


More information about the gradsusr mailing list