<div dir="ltr">Hi, All<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> When I read the example 13 about shapefile (<a href="https://www.ncl.ucar.edu/Applications/shapefiles.shtml">https://www.ncl.ucar.edu/Applications/shapefiles.shtml</a>), I found one confused code as follow. my question is that if one geometry has two or more segments, need every segments be closed circle or polygon, if not, how can this code directly determine gc_inout in every segments?</blockquote><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">;---Some Georgia counties have multiple segments
startSegment = geometry(ga_counties(i), geom_segIndex)
numSegments = geometry(ga_counties(i), geom_numSegs)
do seg=startSegment, startSegment+numSegments-1
startPT = segments(seg, segs_xyzIndex)
endPT = startPT + segments(seg, segs_numPnts) - 1
;---Loop through each point on data grid and see if it's in this county.
do n=0,nii_latlon-1
nn = ii_latlon(n) ; Get index of point we're checking
;
; This "if" statement speeds up code, by making sure we don't
; needlessly check a lat/lon point if:
;
; - we've already found it in another county
; - it doesn't fall within the general lat/lon box that covers this county
;
if(skip_check(nn).or.\
lat1d(nn).lt.min(lat(startPT:endPT)).or.\
lat1d(nn).gt.max(lat(startPT:endPT)).or.\
lon1d(nn).lt.min(lon(startPT:endPT)).or.\
lon1d(nn).gt.max(lon(startPT:endPT)))
continue
end if
;---Here's the check if the point is in the county.
if(gc_inout(lat1d(nn),lon1d(nn),\
lat(startPT:endPT),lon(startPT:endPT))) then
data_mask_1d(nn) = 1 ; This point is inside this county
skip_check(nn) = 1 ; Don't check this point again
end if
end do </pre><div><span style="color:rgb(0,0,0);white-space:pre-wrap"> end do ; End of collecting points for this county</span> </div><div><br></div><div>Best,</div><div>Yongli</div></div>