concatenating grib (era40) files

Henrique Barbosa hmjbarbosa at GMAIL.COM
Thu Apr 28 17:56:06 EDT 2005


Hi Mark and Philippe,

After some testing, I found out how to join grib files
with different number of time steps in them. Here's
the recipie:

1) cat all files together:

   ex.:  cat file1 file2 ... fileN > my_big_file

2) use grib2ctl.pl to generate the proper ctl
   the -verf option garantees the script will find the
   right time step

   ex.:  grib2ctl.pl -verf my_big_file > my_big_file.ctl

3) use gribmap to generate the a new map for the new file
   My original files are from ECMWF, so there are some
   junk bytes in the end of each of them... The upper case
   option '-E' tells gribmap to ignore these junk bytes both
   in the end and in the middle of a grib file!!
   (that's the trick)

   ex.:  gribmap -E -i my_big_file.ctl

Now it is possible to open the concatenated file.

Henrique Barbosa


On 4/27/05, Henrique Barbosa <hmjbarbosa at gmail.com> wrote:
> Dear all,
>
> Is it possible to combine different grib data files?
> I mean, do something like:
>
> cat file1 file2 file... > very_big_file
>
> I have a set of "non-templatable" files which I would like to
> access with a single ctl. Here's the situation:
>
> binary file #1,  4 years of montly data
> binary file #2,  6 years of montly data
> ....
> binary file #n-1, 6 years of montly data
> binary file #n, 2 years of montly data
>
> Since I have different years in the same file, I can't use
> templates. So either I split everything into yearly files,
> or I join all of them into a single file.
>
> To complicate even further, the grib files are from
> ecmwf, so there are some junk bytes at the end of the
> file.
>
> Does anyone has a clever solution for this mess?
>
> Thanks,
> Henrique Barbosa
>



More information about the gradsusr mailing list