Re: Re: Grib to netCDF conversion

From: Dennis Shea (shea AT cgd.ucar.edu)
Date: Wed Feb 16 2005 - 16:18:27 MST

  • Next message: Dave Allured: "Re: goodby"

    >
    >David Brandon wrote:
    >> Does anyone have a good, GRIB to netcdf decoder. We now are getting
    >> Reanalyzed climate data in GRIB but want it in another format.
    >>
    >You can download NCEP/NCAR reanalysis data and NCEP/DOE reanalysis 2
    >data from CDC in netCDF format, if you would like.
    >
    >for reanalysis 1 see
    >http://www.cdc.noaa.gov/cdc/data.ncep.reanalysis.html
    >
    >for reanalysis 2 see
    >http://www.cdc.noaa.gov/cdc/data.ncep.reanalysis2.html
    >
    >Let me know if I can be of any more help,
    >
    >best wishes,
    >
    >gil compo
    >
    ====================

    generally at NCAR we look at the WWW sites listed
    by Gill Campo for NCEP Reanalysis data.

    These sites allow users to download netCDF files
    of selecetd variables from the NCEP Reanalysis archives.
    The selected variable are those most frequently requested
    from the NCEP Reanalysis.

    Note: some of the files are of type "short" (ie, 16 bits).

    If using NCL to read a variable of type "short", use the
    "short2flt" function located in the contributed.ncl
    library to unpack the data.

    load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
       :
       :
       f = addfile ("CDC.nc", "r"0
       
       temp = short2flt( f->air ) ; assume u have looked to see the type.
       printVarDummary(temp)
       
    You could get fancier ....

       f = ...
       if (getfilevartypes(f,"air").eq."short") then
           temp = short2flt( f->air )
       else
           temp = f->air
       end if

    ----
    If the variables are not available at the CDC WWW site, 
    I think you will have to access the GRIB formated files.
    ----
    

    The NCL script included in Ryan Sriver's response (THX to Ryan) was set up to retrieve only variables with three dimensions.

    There are other scripts that will handle the more general cases.

    If u have NCL locally available [it is free] u can readily look at a GRIB file's contents via the command line:

    ncl <return> % f = addfile (foo.grb", "r") % print(f) % quit

    The file need not have an explicit .grb extension. NCL will 1st look for a file "foo.grb". If it is not there it will look for the file "foo" but treat it as a grib file.

    Dennis Shea

    _______________________________________________ ncl-talk mailing list ncl-talk@ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Thu Feb 17 2005 - 09:16:52 MST