Re: GRIB to .nc conversion

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon, 30 Mar 2009 13:03:24 -0600


I see Adam replied ... I had already started this ... so

ncl_filedump will produce one netCDF for on Grib file.

The most commonly used tool for concatenating files would be the
'ncrcat' command operator which is part of the netCDF Operators [NCO].
I would speculate that the NCO are on your systems as they are commonly

Assuming you have NCL 5.1.0 [latest release], you could also perfor the
Let's say your grib files begin with "FOO....."

     diri = "./" ; whatever the input directory is
     filg = systemfunc("cd "+diri+" ; ls FOO")
     nfil = dimsizes(filg)
    f = addfiles (filg, "r")
    ListSetType (f, "cat") ; concatenate (=default)
    slp = f[:]->slp_grib
    printVarSummary (slp)

    diro = "./" ; whatever
    filo = "
    system("/bin/rm -f "+diro+filo)

    fnc = addfile (diro+filo, "c")
    fnc-> SLP = slp

  f = *addfiles* (fils, "r")

   *ListSetType* <> (f, "cat") ; concatenate (=default)
   T = f[:]->T ; read T from all files
   *printVarSummary* <> (T)

Owen Doherty wrote:
> Dear NCL Talk Community,
> I am new to the community, and was unable to find an answer to this
> question in the archives. I have a series of GRIB annual files, each of
> which contains monthly mean SLP fields for each month. It is my
> intention to build a single .nc file from this series GRIB files. It
> appears that "ncl_convert2nc" will produce a series of .nc files, but is
> there an option to produce a single .nc file? Or would I need to first
> convert the files to nc and find another function to concatenate the .nc
> files (suggestions for such a function would be very welcome)?
> Thanks in advance for your help in this. Apologies if this question has
> already been addresses and I cannot find the resolution to it.
> Warm Regards,
> Owen Doherty

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Mon Mar 30 2009 - 13:03:24 MDT

This archive was generated by hypermail 2.2.0 : Mon Apr 06 2009 - 14:56:31 MDT