<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title></title><style type="text/css">.felamimail-body-blockquote {margin: 5px 10px 0 3px;padding-left: 10px;border-left: 2px solid #000088;} </style></head><body>Hello<br><br>Thank you.<br><br>The res@trXMaxF = 12 doesnt work because i cannot convert the float to string, my xlabels are in months, so i try to use "Dec" but:<br>fatal:NhlCvtStringToFloat:Unable to Convert "Dec"<br>warning:Error retrieving resource trXMaxF from args - Ignoring Arg<br><br>Attached is my script.<br> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" <br> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl" <br><br> begin<br>; ==============================================================<br>; NAO region + Caspian region<br>; ==============================================================<br> yrStrt = 1900<br> yrLast = 1999<br><br>; ==============================================================<br>; Open the file: Read only the user specified period first observations then model<br>; ==============================================================<br>f = addfile("air.mon.mean.nc", "r") ;<br>TIME = f->time<br>YYYY = cd_calendar(TIME,-1)/100 ; entire file<br>iYYYY = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast)<br>air = f->air(iYYYY,:,:)<br>air = air(:,::-1,:) ; make latitudes monotonically increasing (NCL syntax)<br>printVarSummary(air) ; (time, lat,lon)<br>;===================================================<br>; compute desired global annual or monthly climatology (12,nlat,mlon)(100,nlat,nlon) <br>; ==============================================================<br> temp=clmMonTLL(air) <br> printVarSummary(temp) <br>;==========================================================weighting<br> rad = 4.*atan(1.)/180.<br> lat = f->lat<br> if (typeof(lat).eq."double") then<br> clat = sqrt( cos(rad*tofloat(lat)) )<br> else<br> clat = sqrt( cos(rad*lat) )<br> end if<br> copy_VarCoords(lat, clat) ; contributed<br> printVarSummary(clat) <br>;==========================================================compute for weighted area average over spatial lat lon<br> aAve = wgt_areaave(temp(:,{36:51},{46:55}), clat({36:51}), 1.0, 0) ; aAve(time over caspian/volga area)<br> printVarSummary(aAve) <br>print(aAve)<br>;===================================================================<br>f1= addfile("T2M_cam5.nc", "r") ;<br>TIME3 = f1->time<br>YYYY3 = cd_calendar(TIME3,-1)/100 ; entire file<br>iYYYY3 = ind(YYYY3.ge.yrStrt .and. YYYY3.le.yrLast)<br>T4 = f1->TREFHT(iYYYY3,:,:)<br>T4=T4-273.15<br>printVarSummary(T4) ; (time, lat,lon)<br>T4@_FillValue = -9.96921e+36 <br> ;airf = lonFlip( air )<br> T2M=clmMonTLL(T4) <br> printVarSummary(T2M) <br>;==========================================================weighting<br> rad = 4.*atan(1.)/180.<br>lat2=f1->lat<br> if (typeof(lat2).eq."double") then<br> clat2 = sqrt( cos(rad*tofloat(lat2)) )<br> else<br> clat2 = sqrt( cos(rad*lat2) )<br> end if<br> copy_VarCoords(lat2, clat2) ; contributed<br> printVarSummary(clat2) <br><br> ; xAnom = calcMonAnomTLL (airw, AIR) <br> ; printVarSummary(xAnom)<br> t4Ave = wgt_areaave(T2M(:,{36:51},{46:55}), clat2({36:51}), 1.0, 0) ; aAve(time over caspian/volga area)<br> printVarSummary(t4Ave)<br>;=====================================================================<br> datarray1 = new((/2,12/),double) ;<br>datarray1(0,:) = aAve<br>datarray1(1,:) = t4Ave<br><br> time = ispan(0,11,1) ;is integer change to scalar<br>time1=int2flt(time)<br>printVarSummary(time1) <br>;===================================================plotting<br>;plot that shit<br>;=======================================================================open a workstation<br> wks_type = "png"<br> wks_type@wkWidth = 1024<br> wks_type@wkHeight = 1024<br>wks = gsn_open_wks(wks_type, "annual cycle")<br>;-- set resources<br> res = True<br> res@xyExplicitLegendLabels = (/ "T2M(Wilmott)","T2M CAM5"/)<br> res@xyLineThicknesses = (/ 3,3/) ; make second line thicker<br> res@xyLineColors = (/ "red","blue"/) <br> res@gsnMaximize = True<br> res@gsnDraw = False<br> res@gsnFrame = False<br>res@xyDashPattern = (/0,1/) ; Make curves all solid<br> res@xyMarkLineMode = "MarkLines" ; Markers *and* lines<br> res@xyMarkers = (/16,16/) ; 3 different markers<br> res@xyMarkerColors := (/"black","black"/) ; 3 different colors<br><br><br>;res@tiMainFont = "Helvetica" ; Font for title<br>;res@tiXAxisFont = "Helvetica" ; Font for X axis label<br>;res@tiYAxisFont = "Helvetica" ; Font for Y axis label<br><br> res@tiYAxisFont = 21<br> res@tiYAxisFontAspectF = 1.3<br> res@tiYAxisFontHeightF = 0.012<br> res@tiXAxisFont = 21<br> res@tiXAxisFontAspectF = 1.3<br> res@tiXAxisFontHeightF = 0.012<br> res@tiXAxisOffsetYF = 0.0<br> res@tiMainOffsetYF = 0.11<br> res@tiMainString = "T2M Annual cycle over Caspian basin"<br> res@tmXBLabelFontAspectF = 1<br> res@tmXBLabelFontHeightF = 0.012<br> ;res@trYMinF = 9.0<br> res@trXMaxF = "Dec"<br> res@gsnMaximize = True<br> res@gsnDraw = False<br> res@gsnFrame = False<br> res@vpXF = 0.25 ;-- set viewport resourcesm<br> res@vpYF = 0.6<br> res@vpWidthF = 0.7<br> res@vpHeightF = 0.4<br><br> res@pmLegendDisplayMode = "Always"<br> res@lgLabelFontHeightF = 0.01<br> res@pmLegendWidthF = 0.04 ;-- set legend width 0.3<br> res@pmLegendHeightF = 0.07 ;-- set legend height0.37 <br> res@pmLegendOrthogonalPosF = -1.15 ;-- move legend up<br> res@pmLegendParallelPosF = 0.14 ;-- move legend right<br> res@tiXAxisString = "Months"<br> res@tiYAxisString = "~S~o~N~C"<br><br> res@tmXBMode="Explicit"<br>x= ispan(0,11,1) ;setup x axis<br> res@tmXBValues = x ;-- bottom x-axis tickmark values<br> res@tmXBLabelFontHeightF = 0.015 ;-- x-axis font size<br>res@tmXBLabels = (/ "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" /) ;-- x-axis labels<br> res@tmLabelAutoStride=True<br><br>;=========================================start plotting<br>plot = gsn_csm_xy(wks,time,datarray1,res)<br><br><br> draw(plot)<br> frame(wks)<br><br>end<br><br><br><br><br><br><br><br>On Jun 8, 2017 7:29:21 PM, Alan Brammer wrote:
<br><blockquote class="felamimail-body-blockquote">sorry, not trYMaxF should be trXMaxF <div><br></div><div><br><div><br></div><div><br><div><blockquote class="felamimail-body-blockquote"><div>On 8 Jun 2017, at 11:55, Alan Brammer <<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div><div>There’s no data after Dec so there’s nothing to plot there. If you want Dec to be at the very edge of the plot, set res@trYMaxF = 12 ; or whatever the coordinate Dec is equal to. <div><br></div><div>if you wanted the line to join back to the Jan value, you could extend the data to 13 points with the last point equal to the first point and now set trYMaxF = 13 or equivalent. </div><div><br></div><div>e.g. (untested pseudo-code):</div><div>plot_var = array_append_record( var, var(0), 0) </div><div><br></div><div><div><br></div><div>Seeing the resources / code you’re using would enable more precise feedback. </div><div><br></div><div><br></div><div>Good luck, </div><div><br></div><div>Alan</div><div><br></div><div><br><div><blockquote class="felamimail-body-blockquote"><div>On 8 Jun 2017, at 11:47, Sri Nandini <<a href="mailto:snandini@marum.de" target="_blank">snandini@marum.de</a>> wrote:</div><br class="Apple-interchange-newline"><div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;">Hello</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;">I have successfully plotted annual cycle. I have it attached.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;">Could someone please tell me why there is a gap between Dec and the end of the plot? I specify my data correctly into 12months but i still cannot remove this gap.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;">Deeply appreciated</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><span><annual cycle.png></span><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;">_______________________________________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;">ncl-talk mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><a href="mailto:ncl-talk@ucar.edu" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" target="_blank">ncl-talk@ucar.edu</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;">List instructions, subscriber options, unsubscribe:</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;"><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></div></blockquote></div><br></div></div></div></div></blockquote></div><br></div></div></blockquote><br></body></html>