Re: What's wrong with me when using month_to_season.

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 20 2011 - 13:50:00 MDT

Good catch. I think he meant to use dim_standardize on that line,
not month_to_season. Change that, and it should work.

--Dave

On 4/20/2011 11:30 AM, Debasish wrote:
> I guess the error comes from the line indicated below
>
> slp160 = dim_standardize(slp160,0)
> slp110 = month_to_season(xz,"JJA")
> -->slp110 = month_to_season(slp110,0)
> xsmi = new((/4,107/),"float")
> xsmi(0,:) = ispan(1899,2005,1)
>
>
>
>
> On 2011-04-20, at 13:03, leo.aries.g wrote:
>
>> Hello. all
>> I wrote some simple codes to calculate the seasonal mean from ncep
>> monthly slp. But I met some error just like following message:
>> (0) contributed: month_to_season: bad season: SEASON=0
>> Thanks a lot for help.
>> Hrere is my scripts
>>
>> 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"
>> begin
>> fi = addfile("/Ncep/surface/slp.mon.mean.nc","r")
>> time = fi->time
>> yyyymm = ut_calendar(time,-1)
>> nStrt = ind(yyyymm.eq.195101)
>> nLast = ind(yyyymm.eq.200812)
>> x = fi->slp(nStrt:nLast,{20.:50.},{110.:160.})
>> y = x*x@scale_factor + x@add_offset
>> copy_VarCoords(x,y)
>> printVarSummary(y)
>> z1 = y(:,:,{160.}) - y(:,:,{110.})
>> z2 = y(:,:,{160.})
>> z3 = y(:,:,{110.})
>> xx = dim_sum(z1)
>> xx!0 = "time"
>> xx&time = x&time
>> xy = dim_sum(z2)
>> xz = dim_sum(z3)
>> copy_VarCoords(xx,xy)
>> copy_VarCoords(xx,xz)
>> printVarSummary(xz)
>> smi = month_to_season(xx,"JJA") ; In fact, the smi can be
>> calculated by itself alone
>> smi = dim_standardize(smi,0)
>> slp160 = month_to_season(xy,"JJA") ; the error will be met if
>> I want to calculate the slp160 and slp110
>>
>> slp160 = dim_standardize(slp160,0)
>> slp110 = month_to_season(xz,"JJA")
>> slp110 = month_to_season(slp110,0)
>> xsmi = new((/4,107/),"float")
>> xsmi(0,:) = ispan(1899,2005,1)
>> xsmi(1,:) = smi
>> xsmi(2,:) = slp160
>> xsmi(3,:) = slp110
>> opt = True
>> opt@fout = "SummerMonsoonIndex_Guo2004_Ncep.dat"
>> write_matrix(transpose(xsmi),"4f10.3",opt)
>> end
>> Leo
>>
>> 2011-04-21
>> --------------------------------------------------------------------
>> leo.aries.g
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Apr 20 13:50:14 2011

This archive was generated by hypermail 2.1.8 : Tue May 03 2011 - 14:47:35 MDT