3D variable from multiple addfile reads of 2D data?

From: Chris Herbster <herbstec_at_nyahnyahspammersnyahnyah>
Date: Tue Jan 10 2012 - 14:41:06 MST

Hi folks,

I know that I could use "addfiles" to get what I want, but my next step
will be to do some correlation calculations and I think it might be more
efficient to build the 3D array with time as the rightmost index rather
than use the internal reordering technique (there are going to be many
time steps eventually).

Here is the code that fills my array "x"

---------

; Create list of input files from a file
list1 = systemfunc ("cat list1")
nlist1 = dimsizes(list1)

print ("list1 has " +nlist1)

; Open each file and read the data

do i = 0, nlist1 - 1

    grib_in1= addfile(list1(i),"r")
    names1 = getfilevarnames(grib_in1) ; extract ALL variable names

    x = grib_in1->AIA_P0_L10_GLC0

end do

    printVarSummary(x)
    xsize = dimsizes(x)
    print ("dimsizes = " + xsize)

---------
The print statements yield:

Variable: x
Type: float
Total Size: 270900 bytes
             67725 values
Number of Dimensions: 2
Dimensions and sizes: [ygrid_0 | 225] x [xgrid_0 | 301]
Coordinates:
Number Of Attributes: 13
   initial_time : 12/01/2009 (05:00)
   forecast_time_units : hours
   forecast_time : 0
   level_type : Entire Atmosphere
   parameter_template_discipline_category_number : ( 0, 0, 20, 50 )
   parameter_discipline_and_category : Meteorological products,
Atmospheric chemical constituents
   grid_type : Lambert Conformal can be secant or tangent, conical or
bipolar
   coordinates : gridlat_0 gridlon_0
   units : mol
   long_name : Amount in atmosphere
   production_status : Operational products
   center : US National Weather Service - NCEP (WMC)
   _FillValue : 1e+20
(0) dimsizes = 225
(1) dimsizes = 301

Each reading of the data from the next file will yield a new hour, so
that 24 files would result in reading a whole day of data.

What I would like is a new variable, say "Rx" with 3 dimensions like:

Rx [ygrid_0|225 x xgrid_0|301 x time|nlist1] where "nlist1" is know from
above.

Do I need to create this array with "new" or can I just use the do loop
on "i" to build the array as I go? Sorry for being dense here, I'm a
relative newbie with NCL.

Thanks, in advance, for the help!

Chris Herbster

-- 
  Dr. Christopher G. Herbster
  Associate Professor
  Director of Science and Technology
  for the ERAU Weather Center
  Applied Aviation Sciences
  Embry-Riddle Aeronautical Univ.
  600 S. Clyde Morris Blvd.
  Daytona Beach, FL 32114-3900
  386.226.6444 Office
  386.226.6446 Weather Center
  http://wx.erau.edu/
Schedule at:  http://wx.erau.edu/faculty/herbster/Schedules/
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jan 10 14:41:15 2012

This archive was generated by hypermail 2.1.8 : Wed Jan 18 2012 - 09:21:55 MST