<div dir="ltr"><div>Sam,</div><div><br></div><div>Please change your formula as follows. Remove the minus sign to the right of the equal sign:</div><div><br></div><div> lon(ind(lon.lt.0)) = lon(ind(lon.lt.0)) + 360</div><div><br></div><div>It may be helpful to split up self-referencing indexing, like this:</div><div><br></div><div> xind = ind(lon.lt.0)<br></div><div> lon(xind) = lon(xind) + 360 <br></div><div><br></div><div>The error "variable unassigned" is not explained. Try inserting print statements and printVarSummary to narrow down where this is happening.</div><div><br></div><div>--Dave</div><div dir="ltr"><br></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" target="_blank">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="m_7833232964974545332gmail-m_-1268349882004443619moz-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="m_7833232964974545332gmail-m_-1268349882004443619moz-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></div></div>
</blockquote></div></div>