Re: clmMonTLL: Error in Time dimension

From: <asphilli_at_nyahnyahspammersnyahnyah>
Date: Mon, 21 May 2007 06:34:11 -0600 (MDT)

Hi Simone,

clmMonTLL requires the input array to be dimensioned time x lat x lon,
with the time dimension being divisible by 12:
http://www.ncl.ucar.edu/Document/Functions/Contributed/clmMonTLL.shtml

You name your tmp array dimensions (lat,lon,time).. If that is indeed the
order of your dimensions then you can either reorder your dimensions to
time x lat x lon (clim = clmMonTLL(tmp(time|:,lat|:,lon|:)) or you can use
clmMonLLT/stdMonLLT for your calculations.
http://www.ncl.ucar.edu/Document/Functions/Contributed/stdMonLLT.shtml
http://www.ncl.ucar.edu/Document/Functions/Contributed/clmMonLLT.shtml

Good luck,
Adam

> Good morning, I am having a problem with running a climatological script
> (the
> one in the example from "http://www.ncl.ucar.edu/Applications/climo.shtml"
> after making some modification so that it can work with my *.nc file.
> Though, I obatin an error that I cannot solve even if conceptually very
> simple.
>
> ERROR:
> Coordinates:
> (0) contributed.ncl: clmMonTLL: dimension must be a multiple of 12
>
> I understand that I need to invert the order of the array components in
> the
> clmMonTLL input file (in my case I called it tmp), but even when I do
> that,
> I keeo obtaining the same error.
>
> Here is my script, and I can provife u with information on my *.nc file if
> needed
>
> Thanks a lot
>
> Regards,
> Simone
>
> ;*****************************************************
> ; climo_2.ncl
> ;*****************************************************
> 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
> ;**************************
> ; open file and read in monthly data
> ;**************************
> f = addfile
> ("../ERA40/2_monthlyMeans/ERA40_2mT_SLP_monthlyMeans_1970to1994.nc", "r")
> P = f->msl
> ntim = dimsizes(P&time) ; # time steps [months]
> printVarSummary(ntim)
> nmos = 12
>
> ; printVarSummary(P)
> tmp = (/ short2flt(P) /)
> ; printVarSummary(tmp)
> ; printVarSummary(P)
> ; P = (/ short2flt(P) /)
> ; printVarSummary(P)
> ;**************************
> ; use functions in contributed.ncl
> ;**************************
>
> tmp!0 = "lat"
> tmp!1 = "lon"
> tmp!2 = "time"
>
> Pclm = clmMonTLL (tmp) ; monthly climatology (12,nlat,mlon)
> Pstd = stdMonTLL (tmp) ; stDev monthly means (12,nlat,mlon)
> ;**************************
> ; compute Seasonal means
> ;*********s*****************
> Psea = P(lat|:,lon|:,time|:) ; reorder variable-to-variable transfer
> Psea = runave (Psea, 3, 1) ; seasonal (3-month) averages
>
> printVarSummary(Psea)
>
> ;**************************
> ; calculate eof's
> ;**************************
> ; eofData = Psea(::4, ::4, 10:ntim-1:12) ; temporary
> eofData = Psea(::4, ::4, 1:2) ;
> eof = eofcov_Wrap (eofData,3) ; eof of seasonal means
> eofTs = eofcov_ts_Wrap(eofData,eof) ; time series coef
> ;******************************************
> ; create plot
> ;******************************************
> wks = gsn_open_wks("ps" ,"climo") ; open ps file
> gsn_define_colormap(wks,"gui_default") ; choose colormap
> plot = new ( 3, "graphic") ; create graphic array
>
> res = True ; plot mods desired
> res_at_gsnDraw = False ; don't draw
> res_at_gsnFrame = False ; don't advance frame
>
> res_at_cnLevelSelectionMode = "ManualLevels" ; manual contour levels
> res_at_cnMinLevelValF = -0.40 ; min level
> res_at_cnMaxLevelValF = 0.40 ; max level
> res_at_cnLevelSpacingF = 0.04 ; interval
>
> res_at_cnFillOn = True ; turn on color
> res_at_gsnSpreadColors = True ; use full color table
> res_at_lbLabelBarOn = False ; turn off individual color
> bars
>
> res_at_tmXBOn = False ; eliminate bottom labels
> res_at_cnLinesOn = False ; no contour lines
>
> if (isatt(eof,"long_name")) then
> eof_LongName = eof_at_long_name ; save for later use as title
> delete (eof_at_long_name)
> end if
>
> do ne=0,2
> res_at_gsnLeftString = "Covariance"
> res_at_gsnCenterString = "EOF "+(ne+1)
> res_at_gsnRightString = "%Var=" + sprintf("%4.1f", eof_at_pcvar(ne))
> plot(ne) = gsn_csm_contour_map_ce(wks,eof(ne,:,:), res)
> end do
>
> resP = True ; panel mods desired
> resP_at_gsnPanelLabelBar = True ; common color bar
> resP_at_lbLabelStride = 3 ; every other label
> gsn_panel(wks,plot,(/3,1/),resP)
> ;******************************************
> ; create plot of time series
> ;******************************************
> resxy = True ; xy plot mods
> desired
> resxy_at_gsnDraw = False ; don't draw yet
> resxy_at_gsnFrame = False ; don't advance frame
> yet
> resxy_at_vpWidthF = 0.80 ; plot width
> resxy_at_vpHeightF= 0.50 ; plot height
>
> time = eofTs&time
>
> do ne=0,2
> resxy_at_gsnLeftString = "Covariance" ; titles
> resxy_at_gsnCenterString = "EOF "+(ne+1)
> resxy_at_gsnRightString = "%Var=" + sprintf("%4.1f", eof_at_pcvar(ne))
> plot(ne) = gsn_csm_xy(wks,time,eofTs(ne,:), resxy)
> end do
> gsn_panel(wks,plot,(/3,1/),False) ; draw: 1-across, 3-down
> end
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon May 21 2007 - 06:34:11 MDT

This archive was generated by hypermail 2.2.0 : Mon May 21 2007 - 09:22:55 MDT