wgrib changing order of variables and levels !!!

Henrique Barbosa hmjbarbosa at GMAIL.COM
Thu Apr 28 18:23:42 EDT 2005


Dear All,

I want to convert some grib files into plain binary files, so that I
can easily split them into several parts. I am going like:

grib2ctl.pl -verf input.grib > input.ctl
gribmap -e -i input.ctl
wgrib -verf -d all -bin -nh -o output.bin input.grib
cat input.ctl | grep -v index | grep -v dtype | sed "s/grib/bin/"

So that, starting only with a single grib file, I end up with 5 files:
 - the grib with its proper ctl and index files
 - the binary version and the corresponding ctl

The problem is that when I open the output file, the variables
and levels are messed up. I tried to convert a very simple file,
which has only 2 variables, 2 levels and a single time step
and I found that:

  displaying variable 1, for level 1, show variable 1 level 1
  displaying variable 1, for level 2, show variable 2 level 1
  displaying variable 2, for level 1, show variable 1 level 2
  displaying variable 2, for level 2, show variable 2 level 2

This means that wgrib is writing to the binary file in the wrong order:

 x, y, Variable, Z, time    (variables change faster than levels)

While the correct order should be:

x, y, Z, Variable, time (levels change faster than variables)

Maybe I am missing something here, but it seems to me this
is a big bug.... Am I correct? I have placed these sample
files in my webpage, so that someone else can try to
reproduce the error:

http://www.ifi.unicamp.br/~hbarbosa/wgrib_problem.tar.gz

Thanks in advance,

Henrique Barbosa



More information about the gradsusr mailing list