<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi,</p>
<p><br>
</p>
<p>I am trying to add a line that has missing values onto an XY plot using gsn_add_polyline. If the missing values are arranged such that 2 segments are created(ie MM###MMM## where M=missval and #=a number) the following error occurs:</p>
<p><br>
</p>
<p></p>
<div>fatal:Dimension sizes on right hand side of assignment do not match dimension sizes of left hand side<br>
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 85 in file polylin_order.ncl<br>
<br>
If only 1 segment is created(#####MMMM) then everything works fine. A simplified version of the script is below with a sample dataset attached. Any help is appreciated.<br>
<br>
Dave<br>
</div>
<p></p>
<p><br>
</p>
<p>---------------------------------------------------------------------------------------------------------------------</p>
<p></p>
<div>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>
;-----------------------------------------------------------------; <br>
;polylin_test.ncl<br>
; djv 3/16<br>
; This program is tests polyline issue w/missvals. If have more than 1 segment <br>
; and use gsn_add_polyline will get error:<br>
;fatal:Dimension sizes on right hand side of assignment do not match dimension sizes of left hand side<br>
;fatal:["Execute.c":8575]:Execute: Error occurred at or near line 95 in file ploylin_order.ncl<br>
<br>
; Can avoid using gsn_polyline but cannot control order of plotting<br>
;-----------------------------------------------------------------;<br>
<br>
begin<br>
res = True<br>
resplan = True<br>
;------------------ User PARAMETERS -----------------------------<br>
<br>
;------------------ End User PARAMETERS ------------------------- <br>
<br>
datafile = "test.dat"<br>
data = asciiread(datafile,-1,"string")<br>
vert_accel = stringtofloat(str_get_cols(data, 0,6))<br>
altkm = stringtofloat(str_get_cols(data, 7,12))<br>
vert_accel@_FillValue = -32767<br>
altkm@_FillValue = -32767<br>
<br>
mintime = 0<br>
maxtime = numAsciiRow(datafile) - 1<br>
flight_time = fspan(mintime,maxtime,maxtime+1)<br>
<br>
;Set some resources for xy plots <br>
ytres = True ;Resources for timeseries plots<br>
ytres@tiXAxisString = "minutes"<br>
ytres@trXMinF = 0<br>
ytres@trXMaxF = maxtime<br>
ytres@xyLineThicknessF = 2.<br>
ytres@gsnDraw = False ;Set to False so can plot multi-colored lines<br>
ytres@gsnFrame = False<br>
ytres@tiYAxisOn = True <br>
<div>; Set plt resources for vert accel<br>
ytresa = ytres<br>
ytresa@trYMinF = -2<br>
ytresa@trYMaxF = 2<br>
ytresa@tiYAxisString = "Vacc(Yellow)"<br>
; ytresa@xyCurveDrawOrder = "PreDraw"<br>
; ytresa@xyLineColor = -1 ;Set=Transparent so polyline colors work<br>
<br>
; Set plt resources for altitude<br>
altres = ytres<br>
altres@trYMinF = 10<br>
altres@trYMaxF = 15<br>
altres@tiYAxisString = "Alt"<br>
altres@xyLineColor = 1 ;Set=Transparent so polyline colors work<br>
wks = gsn_open_wks("X11","outfile")<br>
<br>
plot = gsn_csm_xy2(wks,flight_time(mintime:maxtime),vert_accel(mintime:maxtime),altkm(mintime:maxtime),ytresa,altres)<br>
<br>
;----------------------------------------------<br>
; Overlay colored lines<br>
; gsn_add_polyline does not work if segment is brken up into 2 due to missval<br>
; Will work w/gsn_ployline but will plot 1st and then overlay gsn_csm_xy plt<br>
;----------------------------------------------<br>
dum1 = new(20,"graphic")<br>
polyres = True<br>
polyres@gsLineThicknessF = 8.<br>
polyres@gsLineColor = "yellow"<br>
; ytresa@tfPolyDrawOrder = "PostDraw"<br>
<br>
if(any(.not.ismissing(vert_accel(mintime:maxtime))))then<br>
; dum1(0) = gsn_add_polyline(wks,plot,flight_time(mintime:maxtime),vert_accel(mintime:maxtime),polyres)<br>
<br>
gsn_polyline(wks,plot,flight_time(mintime:maxtime),vert_accel(mintime:maxtime),polyres)<br>
end if<br>
draw(plot)<br>
frame(wks)<br>
end</div>
</div>
<br>
<p></p>
</div>
</body>
</html>