[ncl-talk] subsetting across the date line
Dennis Shea
shea at ucar.edu
Sat Jan 12 15:18:51 MST 2019
Rather than:
lon(ind(lon.lt.0)) = -lon(ind(lon.lt.0)) + 180
which invokes the *ind* function* twice*, you could do
ilon0 := *ind*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/ind.shtml>(lon.lt.0)
lon(ilon0) = -lon(ilon0) + 180
Personally, I would do the following upon input
lon = f->lon ; input
lon = *where*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml>(lon.lt.0,
lon+360, lon) ; lon => 0-to-360
D
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>
>
>
> "The time has come", the tui said,
> "to talk of many things:
> Of songs - and ferns - and flowering flax,
> of Pukekos and dreams ..."
>
> (not Lewis Carroll)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190112/d2a9fe58/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SamMcClatchie2_small.jpg
Type: image/jpeg
Size: 45362 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190112/d2a9fe58/attachment.jpg>
More information about the ncl-talk
mailing list