Unlike (say) Matlab, NCL does not allow an existing array to be
dynamically replaced by an array of a different size. Depending
upon a person's point of view this is a 'good (safe)' feature or
a 'bad (nuisance)' feature. Currently, NCL requires the user to
explicitly delete a variable.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
diri = "/media/Iomega_Ext_Drive-1/data_regCM/TAS"
fili = systemfunc("cd "+diri+" ; ls tas*02.nc")
print(fili)
nfil = dimsizes( fili )
do n=0,nfil-1
PP = addfile( fili(n) ,"r")
a = PP->tas
a = a - 273.15 ; change values
a@units = "degC" ; update to reflect change
printVarSummary(a)
Mean = dim_avg_n_Wrap(a,(/0,1/))
printVarSummary(Mean)
b = avg(Mean)
print("b="+b)
delete( [/a, Mean/] ) ; may change size next iteration
end do
On 8/25/12 3:06 AM, michel lionel Tchilibou wrote:
> iam trying to calcultes the means average value of temperature using
> ICPT data ,after using the cdo command to select years and month files i
> wrote the scripts following
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
>
>
> diri = "/media/Iomega_Ext_Drive-1/data_regCM/TAS"
>
> fili = systemfunc("cd "+diri+" ; ls tas*02.nc")
> print(fili) ; these may not be in chronological oerder
> nfil = dimsizes( fili )
> ;print (nfil)
> do n=0,nfil-1
> PP = addfile( fili(n) ,"r")
> a = PP->tas
> aa= a - 273.15
> Mean = dim_avg_n_Wrap(aa,(/0,1/))
> b= avg(Mean)
> print(b)
>
> end do
> but i receive the message
> fatal:Dimension sizes of left hand side and right hand side of
> assignment do not match
> what is wrong
>
>
>
> _______________________________________________
> 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 Sat Aug 25 07:32:28 2012
This archive was generated by hypermail 2.1.8 : Tue Aug 28 2012 - 08:53:45 MDT