Closed Marchowes closed 8 years ago
Turns out the above idea wont work. It has the potential to regard penninsulas as islands. possible alternatives are:
Going to need hash in with Gridpoints as well if I am going to use sets.
In [24]: class blah(object):
def init(self,x,y):
self.x = x
self.y = y
def eq(self,other):
return [self.x,self.y] == [other.x,other.y]
def hash(self):
return hash((self.x, self.y))
....:
In [25]: t1 = blah(1,0)
In [26]: t2 = blah(2,0)
In [27]: t3 = blah(3,0)
In [28]: t4 = blah(1,0)
In [29]: set([t1,t2,t3,t4])
Out[29]:
{<main.blah at 0x7f28e8c05590>,
<main.blah at 0x7f28e8c055d0>,
<main.blah at 0x7f28e8c05e50>}
note, pop should be pop(0) in scanner -- fix later..
Done with shore tracer portion of this. It will spit out a list of lists of gridpoints along all discontigous shores. What has to happen next is we need to figure out how to tell if a shore grid is an island or if its a lake shore.
Most likely way is to run through the list, grab item N and N+1 and then on item N+1 choose a point. Now find all cross section points on item N and determine if N+1 is between crosssection0 and crosssection1 (iterate through even-odds) on X and Y axis. If so, we know N is a lake shore and N+1 is an island and therefore all non N blobs are island shores. It is VERY likely that N will be an island on every analysis simply because N is collected from the first member of a blob whose first point is always going to be the first found which is always going to be a lake shore.
Island finder partially done. https://github.com/Marchowes/pyProm/pull/15
Went a different route with this, since there are some major problems with the slice approach.
Instead I assess the extremities of each list of shore points. From there I can determine what is an island and what is the pond. https://github.com/Marchowes/pyProm/pull/17
Going to need a way to find island within equal height multipoint blobs. Islands are going to have to be treated differently than regular summits when I get to the surface network phase of this project.
Easiest way I can think is to match the position on one axis (probably X) and see if the point fits between two semi-contigous points: This can be easily achieved since an edge finder has already been implemented:
EX peak at (450, 700). Blob has edges along 450 slice at (450,645), (450,708), (450, 715), (450,733). We should be able to determine from that information that the summit is within the pond, and that the "col" with the the water level. and not a traditional col.