<div dir="ltr"><div>OK, Apologies -- I see now. Right after opening the workstation, there's this line:</div><div><br></div><div> plot = new(2,graphic) <br></div><div><br></div><div>So "plot" is indeed a 1D array of length 2. Either remove this line or do something like:</div><div><br></div><div> plot(0) = gsn_csm_xy(....) ; 1st line plot</div><div>...</div><div> plot(1) = gsn_csm_xy(....) ; 2nd line plot</div><div>...<br></div><div> overlay(plot(0), plot(1))</div><div><br></div><div>Hope that help...</div><div>Rick</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 2, 2019 at 9:25 AM S Br <<a href="mailto:sbr.climate@gmail.com">sbr.climate@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Rick,<div>Thanks for your quick response. The error message indicates to the following line.</div><div>overlay(plot,plotb)</div><div><br></div><div>Both variables has same dimension but don't know why this error appears.</div><div>I also checked that individual variables are displaying fine for the line plot. The error comes when I use overlay.</div><div><br></div><div>Best,</div><div>SB</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 2, 2019 at 4:14 PM Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>Impossible to tell -- the script fragment had only 40-some lines, whereas the error message points to line #82. Can you tell us what line that corresponds to? In any case, the error message indicates the problem - there's a mismatch between expected dimensionality and the actual dimensions that you'll need to address somehow.</div><div><br></div><div>Rick</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 2, 2019 at 8:49 AM S Br via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi All,<br><div>I am trying to prepare a line plot (having two lines) using Overlay function. Both individual lines are working fine, but I get the following error message when I use the Overlay function.</div><div><br></div><div>fatal:Number of elements of dimension (0) of argument (0) is (2) in function (overlay), expected (1) elements<br>fatal:["Execute.c":8640]:Execute: Error occurred at or near line 82 in file lineplot.ncl<br></div><div><br></div><div>My script and PrintVarSummary are given below.</div><div><br></div><div>;create plot<br>;************************************<br> wks = gsn_open_wks("x11","lineplot") ; send graphics to PNG file<br> plot = new(2,graphic) ; create graphic array<br> times = (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12/)<br> xlabels = (/"J", "F","M","A","M","J","J","A","S","O","N","D"/)<br> res = True<br> res@gsnDraw = False ; don't draw<br> res@gsnFrame = False ; don't advance frame<br> res@vpHeightF = 0.40 ; Changes the aspect ratio<br> res@vpWidthF = 0.60<br><br> res@xyMarkLineMode = "MarkLines" ; Markers *and* lines<br> res@xyDashPattern = 0 ; Make curves all solid<br> res@xyLineThicknesses = 3.0 ; make second line thicker<br> res@xyLineColors = "black" ; change line color<br> res@xyMarkers = 5 ; 3 different markers<br> res@xyMarkerSizeF = 0.015<br> res@xyMarkerThicknesses = 3<br><br> res@tmYROn = False<br> res@trYMinF = 0. ; Make sure Y axis starts at 0.<br> res@trYMaxF = 10. ; Make sure Y axis starts at 0.<br> res@trXMinF = 0. ; Make sure Y axis starts at 0.<br> res@trXMaxF = 13. ; Make sure Y axis starts at 0.<br> res@tiYAxisString = ""<br> res@gsnCenterString = "SurTemp (K)" ; change Center string<br> res@gsnRightString = "" ; change Center string<br>;************<br> res@tmXBMode = "Explicit"<br> res@tmXBValues = (/1, 2, 3, 4, 5, 6, 7,8,9,10,11,12/)<br> res@tmXBLabels = (/"J", "F","M","A","M","J","J","A","S","O","N","D"/)<br>;************<br> plot = gsn_csm_xy(wks,times, obssats(:), res)<br>; res@xyLineColors = "red" ; change line color<br>; res@xyMarkerColors = "red"<br> plotb = gsn_csm_xy(wks,times, ctrlsats2(:), res)<br> overlay(plot,plotb)<br><br> draw(plot)<br> frame(wks)<br>end<br></div><div>################################</div><div><br></div><div>VarSummary of two variables:</div><div><br></div><div>Variable: obssats<br>Type: float<br>Total Size: 48 bytes<br> 12 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [time | 12]<br>Coordinates: <br> time: [-657073..-656739]<br>Number Of Attributes: 13<br> _FillValue : -9.96921e+36<br> actual_range : ( 0.0005604419, 30.16107 )<br> parent_stat : Mean<br> statistic : Long Term Mean<br> level_desc : Surface<br> dataset : GPCP Version 2.3 Combined Precipitation Dataset<br> var_desc : Precipitation<br> least_significant_digit : 2<br> precision : 32767<br> units : mm/day<br> long_name : Long Term Mean Average Monthly Rate of Precipitation<br> missing_value : -9.96921e+36<br> wgt_areaave_op_ncl : Area Average<br><br></div><div><br></div><div>ariable: ctrlsats2<br>Type: float<br>Total Size: 48 bytes<br> 12 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [time | 12]<br>Coordinates: <br> time: [ 588.. 599]<br>Number Of Attributes: 8<br> surface : 0<br> wgt_areaave_op_ncl : Area Average<br> missing_value : 2e+20<br> long_name : TOTAL RAINFALL<br> units : MM/DAY<br> grid_type : gaussian<br> lev_type_char : surfa<br> _FillValue : 2e+20<br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div>
</blockquote></div>