<div dir="ltr"><div class="gmail_default" style="font-size:small">Yongli,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">gc_inout will automatically close the polygon for you, so there&#39;s no need to do this yourself.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">See the description under:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/gc_inout.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/gc_inout.shtml</a></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 22, 2016 at 7:26 PM, Sitan Heyl <span dir="ltr">&lt;<a href="mailto:heylsitan@gmail.com" target="_blank">heylsitan@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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" target="_blank">https://www.ncl.ucar.edu/<wbr>Applications/shapefiles.shtml</a>)<wbr>, 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&#39;s in this county.
      do n=0,nii_latlon-1
        nn = ii_latlon(n)     ; Get index of point we&#39;re checking
;
; This &quot;if&quot; statement speeds up code, by making sure we don&#39;t
; needlessly check a lat/lon point if:

; - we&#39;ve already found it in another county
; - it doesn&#39;t fall within the general lat/lon box that covers this county

        if(skip_check(nn).or.\
           lat1d(nn).lt.min(lat(startPT:<wbr>endPT)).or.\
           lat1d(nn).gt.max(lat(startPT:<wbr>endPT)).or.\
           lon1d(nn).lt.min(lon(startPT:<wbr>endPT)).or.\
           lon1d(nn).gt.max(lon(startPT:<wbr>endPT))) 
           continue
        end if

;---Here&#39;s the check if the point is in the county.
        if(gc_inout(lat1d(nn),lon1d(<wbr>nn),\
                    lat(startPT:endPT),lon(<wbr>startPT:endPT))) then
          data_mask_1d(nn) = 1    ; This point is inside this county
          skip_check(nn)   = 1    ; Don&#39;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>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>