loop problem

From: Torben Mueller <torbenmllr_at_nyahnyahspammersnyahnyah>
Date: Fri Mar 16 2012 - 21:39:08 MDT

Dear NCL community,

I have a problem with the loop sketched below.
All my input arrays (ts and x) have defined values at all times).
Basically, I run through a number of cases and create a temporary
lon*lat*time matrix, average over the time dimension and assign it to
a new array with a time-average lon*lat matrix for every case n.
However in my final array (sml), I only get correct values for the
first i loop (i=0), afterwards I only get fill values.
Is there maybe a problem running once over an inner dimension and once
over an outer dimension?

Thank you very much in advance!

sml = new(dimsizes(x),float) ; dim:n,x,y

i = 0
k = 0

 do while (i.le.n-1) ; loop for different cases

   sml_temp = new(dimsizes(y),float) ; dim: x,y,t

   do while (k.le.dimsizes(t)-1) ; time loop
      sml_temp(:,:,k) = ts(i,k)*x(:,:,k)
      k=k+1
   end do

   ; average over the time dimension
   sml(i,:,:) = dim_avg_n_Wrap(sml_temp,2)

  i=i+1
 end do
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Mar 16 21:39:17 2012

This archive was generated by hypermail 2.1.8 : Tue Mar 20 2012 - 15:27:15 MDT