Commit 1f13a2d8 authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

onland fixes

parent 57250af5
......@@ -91,7 +91,7 @@ class Model(object):
def createOutlet(self,geom):
nrOfParticles = 100
nrOfParticles = 300
center = geom.centroid
points = []
depth = []
......@@ -281,20 +281,23 @@ class Model(object):
properties = self.createProperties(1, starttime, multipoint.centroid, [0] * len(multipoint.geoms), [2] * len(multipoint.geoms))
features.append(self.createFeature(multipoint, properties))
mp = multipoint
activepoints = []
deactivepoints = []
linestring = geometry.shape(exercisefeature['geometry'])
latlngpoints = [[latlng[1], latlng[0]] for latlng in linestring.coords]
matches = strtree.query(LineString(latlngpoints))
print('matches: '+str(matches))
# print('matches: '+str(matches))
for i, coord in enumerate(linestring.coords):
points = self.centerPoints(coord, mp.centroid, mp.geoms)
displacedpoints = self.displacePoints(pDist, points)
start = time.time()
activepoints = []
activepoints, onlandpoints = self.onlandPoints(mp.geoms, displacedpoints, matches)
end = time.time()
print('onland: '+str(end-start))
deactivepoints += onlandpoints
# start = time.time()
if (len(mp.geoms) > 0):
points = self.centerPoints(coord, mp.centroid, mp.geoms)
displacedpoints = self.displacePoints(pDist, points)
activepoints, onlandpoints = self.onlandPoints(mp.geoms, displacedpoints, matches)
deactivepoints += onlandpoints
# print('active: '+str(len(activepoints)))
# print('onland: '+str(len(onlandpoints)))
# end = time.time()
# print('onland: '+str(end-start))
mp = geometry.MultiPoint(activepoints+deactivepoints)
level = [0] * len(mp.geoms)
category = [2] * len(mp.geoms)
......@@ -303,5 +306,8 @@ class Model(object):
# if (i % 10 == 0):
# Cloudtrack.write(featurecollection)
# Particletrack.write(featurecollection)
mp = geometry.MultiPoint(activepoints)
print('deactivepoints: '+str(len(deactivepoints)))
return featurecollection
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment