Re: Get var multiple times

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 22 2010 - 19:57:47 MDT

For a WRF file

  f = addfile("wrfout_d01_000000.nc" , "r")
  TIMES = chartostring( f->Times )
  print(TIMES)

Variable: TIMES
Type: string
Total Size: 100 bytes
             25 values
Number of Dimensions: 1
Dimensions and sizes: [25]
Coordinates:
(0) 2001-06-11_12:00:00
(1) 2001-06-11_13:00:00
(2) 2001-06-11_14:00:00
(3) 2001-06-11_15:00:00
(4) 2001-06-11_16:00:00
(5) 2001-06-11_17:00:00
(6) 2001-06-11_18:00:00
(7) 2001-06-11_19:00:00
(8) 2001-06-11_20:00:00
(9) 2001-06-11_21:00:00
(10) 2001-06-11_22:00:00
(11) 2001-06-11_23:00:00
[snip]

So, if you wanted 2001-06-11_17:00:00 thru 2001-06-11_22:00:00
which correspond to subscripts 5 => 10

  ntStrt = 5
  ntLast = 10
  Times = chartostring( f->Times(ntStrt:ntLast,:) )
  print(Times)
  T = f->T(ntStrt:ntLast,:,:,:)
  printVarSummary(T)

On 4/22/10 7:23 PM, Brandon Fisel wrote:
> Paula,
>
> If your variable is dimensioned T(time,lat,lon) then:
> f->T(5:10,:,:)
>
> Then use dim_avg on f.
>
>
> -------------------------------------------------------------
> Brandon Fisel
>
>
> On Thu, Apr 22, 2010 at 20:11, Paula Doubrawa Moreira
> <pmoreira@alaska.edu <mailto:pmoreira@alaska.edu>> wrote:
>
> Hey all
>
> I'm having a hard time getting a variable from a file in some
> specific times to create a time average (let's say from time 5 to
> time 10).
> I can't use an array (e.g. it = ispan (5,10,1) ) in wrf_user_getvar
> nor while using f->T.
>
> Is there any way that I can extract out of a file a variable X from
> time Y1 to Y2 and store that to then use dim_avg_n(X,0) ?
>
> I hope I was clear enough.
> Thank you so much!
> -paula
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Apr 22 19:57:54 2010

This archive was generated by hypermail 2.1.8 : Fri Apr 23 2010 - 14:40:07 MDT