ttest warning message and code efficiency

From: Gina Henderson <ginah_at_nyahnyahspammersnyahnyah>
Date: Wed, 23 Sep 2009 09:39:06 -0400

Hi there,

I am using the ttest function on a global data. My arrays are of shape (12,
64, 128, 40) and correspond to month, lat, lon, time. I am currently running
this in a nested do loop which is not very efficient as I have cases where a
warning is written to the screen:

warning:ttest: encountered 1 cases where var1 and/or var2 were less than or
equal to 0. Output set to missing values in these cases

Would someone have a suggestion of how to do this outside of a do loop that
would improve the runtime of the script? My code looks as follows:

do mon=0,11
 do i=0,63
  do j=0,127
  aveX = dim_avg(FSNS_hi_new2(mon,i,j,:))
  aveY = dim_avg(FSNS_lo_new2(mon,i,j,:))
  varX = dim_variance(FSNS_hi_new2(mon,i,j,:))
  varY = dim_variance(FSNS_lo_new2(mon,i,j,:))
  sX = dimsizes(FSNS_hi_new2(mon,i,j,:))
  sY = dimsizes(FSNS_lo_new2(mon,i,j,:))
  iflag = True
  prob = 100.*(1. - ttest(aveX,varX,sX,aveY,varY,sY,iflag,False))
; printVarSummary(prob)
; print(prob)
  FSNSprob(mon,i,j) = prob
  end do
 end do
end do

Any suggestions would be greatly appreciated.
Thanks, Gina.

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 23 2009 - 07:39:06 MDT

This archive was generated by hypermail 2.2.0 : Thu Sep 24 2009 - 13:55:09 MDT