Re: do_loop

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 22 May 2009 10:20:16 -0600

You are using subscript indices not coordinate values.
The latter require {...} the former do not

a_new(:,:,:,i) = dim_avg_Wrap(xx(:,:,:,time_start:time_end))

====
Why not
   
         a_new = VQ_bandi(::2,:,:,:) ; create a variable with
correct size
                                                           ; and meta
information
         a_new_at_info = "two 6-hrly time steps averaged" ; not needed
         a_new = 0.0 ; *not* needed but
some people like to do this

         do nt=0,123,2
              a_new(nt/2,:,:,:) = ( VQ_bandi(nt,:,:,:) +
VQ_bandi(nt+1,:,:,:) )*0.5
         end do

         printVarSummary( a_new )
         printMinMax( a_new , True) ; contributed.ncl
====
Good Luck

Aaron Goldner wrote:
> Hi,
>
> Below I have copied my code. I have 4X daily data with 124 time steps
> and I am trying to use a do loop to average the first two time steps
> in order to make it 2X daily. My error from the loop is
>
> fatal:Dimension (time) of (xx) does not have an associated coordinate
> variable
> fatal:Execute: Error occurred at or near line 118 in file
> daily_bandpass.ncl
>
>
> my code:
>
> xx = VQ_bandi(lev_p|:,lat|:,lon|:,time|:)
> time = c->time
>
> a_new =
> new((/dimsizes(xx&lev_p),dimsizes(xx&lat),dimsizes(xx&lon),62/),float)
>
> copy_VarMeta(xx,a_new)
> printVarSummary(a_new)
> printVarSummary(xx)
>
> do i = 0,61
> time_start = i*2
> time_end = time_start+1
> a_new(:,:,:,i) = dim_avg_Wrap(xx(:,:,:,{time_start:time_end}))
>
> end do
>
>
> any advice is appreciated,
>
> Sincerely,
> Aaron Goldner
>
> ------------------------------------------------------------------------
> Insert movie times and more without leaving HotmailŪ. See how.
> <http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

-- 
======================================================
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
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri May 22 2009 - 10:20:16 MDT

This archive was generated by hypermail 2.2.0 : Tue May 26 2009 - 10:17:15 MDT