<div dir="ltr"><div>Dear NCL Community,<br><br></div><div>I have a shape file containing 3 polyline segments. Each segment is a &quot;contour&quot; level and these level values are stored in the CONTOUR variable. See the description of the shape file below.<br><br>ncl 0&gt; f = addfile(&quot;mp143-mpua5-contour.<wbr>shp&quot;,&quot;r&quot;)<br>ncl 1&gt; print(f)<br><br>Variable: f<br>Type: file<br>filename:    mp143-mpua5-contour<br>path:    mp143-mpua5-contour.shp<br>   file global attributes:<br>      layer_name : mp143-mpua5-contour<br>      geometry_type : polyline<br>      geom_segIndex : 0<br>      geom_numSegs : 1<br>      segs_xyzIndex : 0<br>      segs_numPnts : 1<br>   dimensions:<br>      geometry = 2<br>      segments = 2<br>      num_features = 3  // unlimited<br>      num_segments = 3<br>      num_points = 149<br>   variables:<br>      integer geometry ( num_features, geometry )<br><br>      integer segments ( num_segments, segments )<br><br>      double x ( num_points )<br><br>      double y ( num_points )<br><br>      string CONTOUR ( num_features )<br><br></div><div><div>When I plot these shape files, I want to label each segment with the contour level. I am trying to do this by setting labels=f-&gt;CONTOUR and then setting the gsLineLabelString resource equal to &quot;labels&quot;. This, however, labels each segment with the first entry in labels (labels(0)), instead of each segment with each value. See the description of labels below.<br><br>ncl 5&gt; print(labels)<br><br><br>Variable: labels<br>Type: string<br>Total Size: 24 bytes<br>            3 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [num_features | 3]<br>Coordinates: <br>Number Of Attributes: 0<br>(0)    1,000<br>(1)    10<br>(2)    100<br><br></div><div>So in the output, each segment is given a value of 1,000.<br></div><div><br></div><div>Is there a way that I can either 1) label each segment with the values in labels or 2) convert the polylines to polygons and shade each a different color?<br><br></div><div>The NCL script is below (and is attached) as well as the shape files. <br><br></div><div>Thanks again for your help!<br></div><div>Sean<br><br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/wrf/WRFUserARW.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl&quot;<br><br>begin<br><br>  shapefile = &quot;mp143-mpua5-contour.shp&quot;<br>  f = addfile(shapefile,&quot;r&quot;)<br><br>  b = addfile(&quot;wrf_redoubt_domain&quot;+&quot;<wbr>.nc&quot;,&quot;r&quot;)<br><br>  wks = gsn_open_wks(&quot;x11&quot;,&quot;testing&quot;)<br><br>  lat = f-&gt;y<br>  lon = f-&gt;x<br><br>  gsn_define_colormap(wks,&quot;<wbr>WhBlGrYeRe&quot;)<br>  res                         = True<br>  res@gsnMaximize             = False<br>  res@gsnDraw                 = False        ; Turn off for now.<br>  res@gsnFrame                = False        ; Will draw later<br><br>  res@tiMainOn                = False<br><br>  mpres                         <wbr>     = res<br>  mpres                         <wbr>     = wrf_map_resources(b,mpres)<br>  mpres@mpOutlineBoundarySets   <wbr>     = &quot;GeophysicalAndUSStates&quot;<br>  mpres@mpFillOn                <wbr>     = False<br>  mpres@mpOutlineOn             <wbr>     = True<br>  mpres@mpCountyLineThicknessF  <wbr>     = 2.5<br>  mpres@<wbr>mpGeophysicalLineThicknessF  = 2.5<br>  mpres@mpNationalLineThicknessF<wbr>     = 2.5<br>  mpres@<wbr>mpProvincialLineThicknessF   = 2.5<br>  mpres@mpUSStateLineThicknessF <wbr>     = 2.5<br>  mpres@mpCountyLineColor       <wbr>     = &quot;Black&quot;<br>  mpres@mpGeophysicalLineColor  <wbr>     = &quot;Black&quot;<br>  mpres@mpNationalLineColor     <wbr>     = &quot;Black&quot;<br>  mpres@mpUSStateLineColor      <wbr>     = &quot;Black&quot;<br><br>  mpres@mpRightCornerLonF = 215.0<br>  mpres@mpRightCornerLatF = 64.5<br>  mpres@mpLeftCornerLonF  = 200.0<br>  mpres@mpLeftCornerLatF  = 55.5<br><br>  print(mpres)<br><br>  map = gsn_csm_map(wks, mpres)<br><br>  labels=f-&gt;CONTOUR<br><br>  pres                          <wbr>     = res<br>  pres@gsLineColor              <wbr>     = &quot;Red&quot;<br>  pres@gsMarkerIndex            <wbr>     = 16<br>  pres@gsMarkerColor            <wbr>     = &quot;Red&quot;<br>  pres@gsLineLabelString        <wbr>     = labels<br><br>  poly = gsn_add_shapefile_polylines(<wbr>wks,map,shapefile,pres)<br><br>  draw(map)<br>  frame(wks)<br><br>end<br><br><br></div><div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font size="1">PO1 Sean D. Egan, US Navy<br></font><font size="1">PhD Candidate<br></font><font size="1">Geophysical Institute<br></font><div><font size="1">University of Alaska Fairbanks<br></font></div><div><font size="1">903 Koyukuk Drive<br>Fairbanks, AK 99775<br><a href="mailto:sdegan@alaska.edu" target="_blank">sdegan@alaska.edu</a> | <a href="tel:907%20474-5483" value="+19074745483" target="_blank">907 474-5483</a><br></font></div><font size="1">IARC Office 334 | <a href="http://www.gi.alaska.edu/%7Esdegan" target="_blank">www.gi.alaska.edu/~sdegan</a><br></font></div></div></div></div></div></div>
</div></div></div>