Re: about calculating standard deviations for different timesteps

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed Jun 13 2012 - 11:47:38 MDT

Change
do t=0,95
to
do t=0,94

Since indexing in NCL starts at 0, the last index along any dimension is dimension size - 1.
 -dave
On Jun 13, 2012, at 11:39 AM, Rashed Mahmood wrote:

> Dear All
>
> I am trying to calculate standard deviation for 9 different models. Each model has 95 time steps. I want to calculate standard deviation among nine models for each time step. I wrote the code but I am sure my loop is incorrect. So I would appreciate of someone could help me in correcting this. Part of the code related to the problem is below:
>
> ;________________________
> x= new((/9,95/),float) ; for 9 models and 95 time steps each
>
> x(0,:)=wgt_areaave_Wrap(fbc1(time|:,{lat|latS:latN},{lon|lonL:lonR}),1.0, 1.0, 0)
> x(1,:)=wgt_areaave_Wrap(fbc2(time|:,{lat|latS:latN},{lon|lonL:lonR}),1.0, 1.0, 0)
> x(2,:)=wgt_areaave_Wrap(fbc3(time|:,{lat|latS:latN},{lon|lonL:lonR}),1.0, 1.0, 0)
> x(3,:)=wgt_areaave_Wrap(fbc4(time|:,{lat|latS:latN},{lon|lonL:lonR}),1.0, 1.0, 0)
> x(4,:)=wgt_areaave_Wrap(fbc5(time|:,{lat|latS:latN},{lon|lonL:lonR}),1.0, 1.0, 0)
> x(5,:)=wgt_areaave_Wrap(fbc6(time|:,{lat|latS:latN},{lon|lonL:lonR}),1.0, 1.0, 0)
> x(6,:)=wgt_areaave_Wrap(fbc7(time|:,{lat|latS:latN},{lon|lonL:lonR}),1.0, 1.0, 0)
> x(7,:)=wgt_areaave_Wrap(fbc8(time|:,{lat|latS:latN},{lon|lonL:lonR}),1.0, 1.0, 0)
> x(8,:)=wgt_areaave_Wrap(fbc9(time|:,{lat|latS:latN},{lon|lonL:lonR}),1.0, 1.0, 0)
>
>
> xave=dim_avg_n_Wrap(x,0) ;multi-model average
> copy_VarCoords(tmp,xave)
> ;printVarSummary(xave)
>
> ;;;;;;;;;;for standard deviation
>
> xsd=new((/95/),float)
> printVarSummary(x)
>
> do t=0,95
>
> xsd(t)=dim_stddev_n_Wrap(x(:,t),0)
>
> end do
>
>
>
> The error I get is:
>
> fatal:Subscript out of range, error in subscript #1
> fatal:An error occurred reading x
>
> The error is at line inside the do loop. the dimensions of x are: [9] x [time | 95]
>
> Thanks alot
>
> Rashed
>
>
>
> _______________________________________________
> 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 Wed Jun 13 11:47:49 2012

This archive was generated by hypermail 2.1.8 : Fri Jun 15 2012 - 14:51:31 MDT