Re: getting a Time variable from NCEP NAM grib2's

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue, 12 Feb 2008 12:07:08 -0700

Gerry Creager wrote:
> I'm a little stumped. We need to subset NAM awip32 data to provide
> surface winds (u,v) and pressure. I'm thinking I also need an
> unlimited time variable in there. How should I be getting time from
> the files? We're using addfiles to read in the entire forecast set,
> and then identifying the few parameters we need. I just can't seem to
> find a "Time" variable to snag.
>
> Thanks, Gerry
Hi Gerry,

You can force a time [record] dimension via

   http://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml

NCL's default mode is to not create 'degenerate' dimensions [size 1].
I speculate that you would prefer dimensions of the type

To start ... for pedantic purposes
   http://www.ncl.ucar.edu/Document/Tools/ncl_filedump.shtml

[1] Try the following and note how the single element dimensions are
presented
     %> ncl_filedump -h

     %> ncl_filedump nam.t06z.awip3200.tm00.grb2 | less
     %> ncl_filedump -itime nam.t06z.awip3200.tm00.grb2 | less
     %> ncl_filedump -ftime nam.t06z.awip3200.tm00.grb2 | less

     %> ncl_filedump -itime -ftime -v
forecast_time0,initial_time0,initial_time0_hours
nam.t06z.awip3203.tm00.grb2 | less

[2] Try

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

begin
   diri = "./" ; input data directory

   setfileoption("grb","SingleElementDimensions","Forecast_time" )
   fils = systemfunc("cd "+diri +" ; ls nam.t06z.awip*grb2")

   foo = addfile(diri+fils(0) , "r")
   print(foo) ; dump of the 1st file
   print("==============================================")

   f = addfiles (diri+fils, "r")

   ftime= addfiles_GetVar(f, fils, "forecast_time0") ; integer
   print(ftime)

   T = addfiles_GetVar(f, fils, "TMP_P0_L104_GLC0") ; 4D
   printVarSummary(T)
   print("=====")
   print("T_at_initial_time="+T_at_initial_time)

end

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Feb 12 2008 - 12:07:08 MST

This archive was generated by hypermail 2.2.0 : Fri Feb 15 2008 - 17:17:57 MST