<div dir="ltr"><div>Dear NCL Community,<br><br></div><div>I have a shape file containing 3 polyline segments. Each segment is a "contour" level and these level values are stored in the CONTOUR variable. See the description of the shape file below.<br><br>ncl 0> f = addfile("mp143-mpua5-contour.<wbr>shp","r")<br>ncl 1> 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->CONTOUR and then setting the gsLineLabelString resource equal to "labels". 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> 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 "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/wrf/WRFUserARW.ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl"<br><br>begin<br><br> shapefile = "mp143-mpua5-contour.shp"<br> f = addfile(shapefile,"r")<br><br> b = addfile("wrf_redoubt_domain"+"<wbr>.nc","r")<br><br> wks = gsn_open_wks("x11","testing")<br><br> lat = f->y<br> lon = f->x<br><br> gsn_define_colormap(wks,"<wbr>WhBlGrYeRe")<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> = "GeophysicalAndUSStates"<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> = "Black"<br> mpres@mpGeophysicalLineColor <wbr> = "Black"<br> mpres@mpNationalLineColor <wbr> = "Black"<br> mpres@mpUSStateLineColor <wbr> = "Black"<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->CONTOUR<br><br> pres <wbr> = res<br> pres@gsLineColor <wbr> = "Red"<br> pres@gsMarkerIndex <wbr> = 16<br> pres@gsMarkerColor <wbr> = "Red"<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>