<div dir="ltr"><div>Rather than:</div><div>     lon(ind(lon.lt.0)) = -lon(ind(lon.lt.0)) + 180    <br></div><div>which invokes the <b>ind</b>  function<b> twice</b>, you could do</div><div>     ilon0 := <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/ind.shtml"><b>ind</b></a>(lon.lt.0)</div><div>     lon(ilon0) = -lon(ilon0) + 180</div><div><br></div><div>Personally, I would do the following upon input<br></div><div><b></b><br></div><div dir="ltr">lon           = f->lon         ; input<br>lon           =<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml"> <b>where</b></a>(lon.lt.0, lon+360, lon)   ; lon => 0-to-360<br></div><div dir="ltr"><br></div><div>D<br></div><div dir="ltr"><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Jan 12, 2019 at 12:01 AM Sam McClatchie <<a href="mailto:smcclatchie@fishocean.info">smcclatchie@fishocean.info</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    Colleagues<br>
    <br>
    I have a new question that is related to my original question.
    Initially, I wanted to subset the large Global Fishing Watch dataset
    into regional datasets, and then plot the unstructured station data
    as fishing hours colored by their magnitude. Rick pointed me to the
    gc_inout function, and Dennis wrote some code with nested loops to
    do the subsetting and plotting at the same time.<br>
    <br>
    This was extremely helpful, but the loops were exceedingly slow
    because there are over 250,000 points per region, so I sped up the
    plots by doing the subsetting with a separate script before doing
    the plotting. I also figured out how to use the new cmocean colour
    tables. The data, code and figure produced are here:
<a class="gmail-m_8218959853096267226moz-txt-link-rfc2396E" href="https://my.pcloud.com/publink/show?code=kZsanC7ZlKPCnfV5wnLFWm4C2yCww4mtUIYV" target="_blank"><https://my.pcloud.com/publink/show?code=kZsanC7ZlKPCnfV5wnLFWm4C2yCww4mtUIYV></a>.<br>
    <br>
    My new question is how to subset the data across the dateline (in
    the New Zealand plot) when the longitude data run from -180:180? As
    you can see from the plot, my plotted fishing hours data stops at
    the dateline.<br>
    <br>
    To conveniently subset beyond 180 degrees, I tried this to convert
    lon to 0:360, but I'm getting a variable unassigned error for lon:<br>
    <br>
                    ; test
    ************************************************<br>
                    lon(ind(lon.lt.0)) = -lon(ind(lon.lt.0)) + 180 <br>
                    print("%%%%%%%%%%%%%%%%%%%%%%%%")  <br>
                    printVarSummary(lon)<br>
                    print("%%%%%%%%%%%%%%%%%%%%%%%%")  <br>
                    ; end test
    **********************************************<br>
    <br>
    Using the reassignment operator (:=) does not fix the problem.<br>
    <br>
    Any hints would be most gratefully received.<br>
    <br>
    Best fishes<br>
    Sam<br>
    <div class="gmail-m_8218959853096267226moz-signature">-- <br>
      
      
      Sam McClatchie (fisheries oceanographer)<br>
      & Elena Turin (accounting & auditing)<br>
      FishOcean Enterprises<br>
      38 Upland Rd, Huia, Auckland 0604, New Zealand<br>
      cell: 027 752 8495<br>
      <span style="text-decoration:underline"><a href="http://www.fishocean.info" target="_blank">Internet</a></span><br>
      <img style="width: 150px; height: 149px;" alt="" src="cid:168441d72eeb74f45fb1"><br>
      <br>
      "The time has come", the tui said,<br>
      "to talk of many things:<br>
      Of songs - and ferns - and flowering flax,<br>
      of Pukekos and dreams ..."<br>
      <br>
      (not Lewis Carroll)
    </div>
  </div>

</blockquote></div>