[ncl-talk] subsetting across the date line

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Sat Jan 12 12:53:30 MST 2019


Sam,

Please change your formula as follows.  Remove the minus sign to the right
of the equal sign:

    lon(ind(lon.lt.0)) = lon(ind(lon.lt.0)) + 360

It may be helpful to split up self-referencing indexing, like this:

    xind = ind(lon.lt.0)
    lon(xind) = lon(xind) + 360

The error "variable unassigned" is not explained.  Try inserting print
statements and printVarSummary to narrow down where this is happening.

--Dave


On Sat, Jan 12, 2019 at 12:01 AM Sam McClatchie <smcclatchie at fishocean.info>
wrote:

> Colleagues
>
> 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.
>
> 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:
> <https://my.pcloud.com/publink/show?code=kZsanC7ZlKPCnfV5wnLFWm4C2yCww4mtUIYV>
> <https://my.pcloud.com/publink/show?code=kZsanC7ZlKPCnfV5wnLFWm4C2yCww4mtUIYV>
> .
>
> 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.
>
> 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:
>
>                 ; test ************************************************
>                 lon(ind(lon.lt.0)) = -lon(ind(lon.lt.0)) + 180
>                 print("%%%%%%%%%%%%%%%%%%%%%%%%")
>                 printVarSummary(lon)
>                 print("%%%%%%%%%%%%%%%%%%%%%%%%")
>                 ; end test **********************************************
>
> Using the reassignment operator (:=) does not fix the problem.
>
> Any hints would be most gratefully received.
>
> Best fishes
> Sam
> --
> Sam McClatchie (fisheries oceanographer)
> & Elena Turin (accounting & auditing)
> FishOcean Enterprises
> 38 Upland Rd, Huia, Auckland 0604, New Zealand
> cell: 027 752 8495
> Internet <http://www.fishocean.info>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190112/2ee8279c/attachment.html>


More information about the ncl-talk mailing list