Ensemble mean or variance???
[1] You have not initialized "eke_av". After eke_av = new(...)
eke_av = 0.0
======
[2] b1 is an array. You should not use a loop like
do i =0,127
do j =0,255
eke_av = eke_av + b1
end do
end do
Use array syntax like Matlab, fortran90, etc
eke_av = eke_av + b1
===
[3] You did not divide by 60.
+++++++++++++++++++++++
One alternative approach:
nens = 60
in = addfile("./ctrl.cam2.h0.1997-11-01-00000.nc","r")
z500 =in->Z500(1,:,:)
dimz = dimsizes(z500)
nlat = dimz(0)
mlon = dimz(1)
eke_av = new((/nens,nlat,mlon/),typeof(z500),z500@_FillValue)
do i = 0,nens-1
eke(i,:,:) = asciiread("winter_eke"+i,(/nlat,mlon/),"double")
end do
eke_var = dim_variance_n( eke, 0 )
copy_VarCoords(z500, eke_var)
eke_var@long_name = "..."
eke_var@units = "..."
printVarSummary(eke_var0)
On 12/2/10 3:25 PM, sbasu@iarc.uaf.edu wrote:
> Hi,
>
> I am trying to do an ensemble mean of 60 members each having 128 x 256
> values. Is there any function in NCL that can do ensemble mean or any
> sample script?
> I am reading the values from ascii file.
> I am attaching the script I am trying to use but the Ensemble mean part
> of my script is giving me error:
>
> fatal:Assignment type mismatch, right hand side can't be coerced to type
> of left hand side
> fatal:Execute: Error occurred at or near line 29 in file eke_av.ncl
>
>
> Thanks,
>
>
>
>
>
>
> _______________________________________________
> 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 Dec 2 15:47:28 2010
This archive was generated by hypermail 2.1.8 : Mon Dec 06 2010 - 09:18:09 MST