;************************************************************** ; These files are loaded by default in NCL V6.2.0 and newer ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl" f = addfile ("spatial_leh.nc","r"); add file temp= short2flt( f->t2m(:,::-1,:)) ; Used to cal daily mean ----------------------------------------------- tem=temp(0:122,:,:) printVarSummary(tem) tt=temp ;----------------------------------------------------------------------- ;Extraction for time steps for 2 m temp.-------------------------------- ts1 = f->t2m(0:247,::-1,:) ts=(ts1*0.000804)+290 ; conversion tim=f->time copy_VarCoords(ts1,ts) ; format = "%d %c" ; replace format_string with the desired format string ; stime = cd_string(time, format) ; printVarSummary(stime) ; print(stime) cd_date = cd_calendar(tim, 3) cd_date@units="days since 1990-01-01 00:00:00" printVarSummary(cd_date) print(cd_date) ;year=tointeger(cd_date(: ,0)) ;month=tointeger(cd_date(: ,1)) ;day=tointeger(cd_date(: ,2)) ;print(day) printVarSummary(temp) printVarSummary(ts1) printVarSummary(ts) printVarSummary(tim) ;**Calculate daily mean values ------------------------- opt= True opt@nval_crit=3 xDay=calculate_daily_values(tt,"avg",0,opt) ; method 2 ---------------------------------------------- ; nDim = 0 ; xDayAvg = calculate_daily_values(tt, "avg", nDim, True) printVarSummary(xDay) ;************************* ; plotting parameters ;************************* wks = gsn_open_wks ("png", "time_lat" ) ; send graphics to PNG file res = True ; plot mods desired res@tiMainString = "" ; title res@tmXBLabelStride = 1 ; tick mark label stride 2 res@tiXAxisString = "Latitude" ; y axis title res@tiYAxisString = "Time" ; y axis title res@cnFillOn = True ; color on res@lbLabelStride = 2 ; every other label 2 res@lbOrientation = "Vertical" ; vertical label bar res@cnLinesOn = True ; turn off contour lines res@cnFillPalette = "WhiteBlueGreenYellowRed" ; set color map res@cnLevelSpacingF = 5 ; contour spacing restick = True restick@ttmFormat = "%d %c" restick@ttmAxis = "YL" restick@ttmMajorStride = 25 time_axis_labels(ts&time,res,restick) plot = gsn_csm_hov(wks,xDay(:,:,{78}),res) ; lat vs time. end