Commit f797a6bb authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

testing radius

parent 8673d807
**/*.pyc
\ No newline at end of file
2017-12-07 14:00 19.5647 58.5044 0.0000 2017-12-12 12:00 19.7563 57.5310 0.0000
2017-12-07 14:15 19.5674 58.5027 0.0000 2017-12-12 12:15 19.7699 57.5309 0.0000
2017-12-07 14:30 19.5694 58.5005 0.0000 2017-12-12 12:30 19.7780 57.5261 0.0000
2017-12-07 14:45 19.5722 58.4988 0.0000 2017-12-12 12:45 19.7903 57.5208 0.0000
2017-12-07 15:00 19.5756 58.4973 0.0000 2017-12-12 13:00 19.7997 57.5166 0.0000
2017-12-07 15:15 19.5790 58.4958 0.0000 2017-12-12 13:15 19.8109 57.5116 0.0000
2017-12-07 15:30 19.5832 58.4951 0.0000 2017-12-12 13:30 19.8182 57.5084 0.0000
2017-12-07 15:45 19.5872 58.4944 0.0000 2017-12-12 13:45 19.8274 57.5047 0.0000
2017-12-07 16:00 19.5914 58.4941 0.0000 2017-12-12 14:00 19.8399 57.5006 0.0000
2017-12-07 16:15 19.5969 58.4941 0.0000 2017-12-12 14:15 19.8564 57.4959 0.0000
2017-12-07 16:30 19.6017 58.4941 0.0000 2017-12-12 14:30 19.8688 57.4930 0.0000
2017-12-07 16:45 19.6058 58.4944 0.0000 2017-12-12 14:45 19.8823 57.4922 0.0000
2017-12-07 17:00 19.6092 58.4959 0.0000 2017-12-12 15:00 19.8920 57.4921 0.0000
2017-12-07 17:15 19.6120 58.4976 0.0000 2017-12-12 15:15 19.9030 57.4931 0.0000
2017-12-07 17:30 19.6140 58.4998 0.0000 2017-12-12 15:30 19.9113 57.4953 0.0000
2017-12-07 17:45 19.6140 58.5023 0.0000 2017-12-12 15:45 19.9194 57.4988 0.0000
2017-12-07 18:00 19.6140 58.5048 0.0000 2017-12-12 16:00 19.9291 57.5025 0.0000
2017-12-07 18:15 19.6133 58.5070 0.0000 2017-12-12 16:15 19.9389 57.5078 0.0000
2017-12-07 18:30 19.6127 58.5091 0.0000 2017-12-12 16:30 19.9471 57.5128 0.0000
2017-12-07 18:45 19.6127 58.5116 0.0000 2017-12-12 16:45 19.9539 57.5174 0.0000
2017-12-07 19:00 19.6127 58.5141 0.0000 2017-12-12 17:00 19.9607 57.5209 0.0000
2017-12-07 19:15 19.6127 58.5170 0.0000 2017-12-12 17:15 19.9675 57.5254 0.0000
2017-12-07 19:30 19.6127 58.5195 0.0000 2017-12-12 17:30 19.9730 57.5290 0.0000
2017-12-07 19:45 19.6106 58.5217 0.0000 2017-12-12 17:45 19.9800 57.5319 0.0000
2017-12-07 20:00 19.6072 58.5231 0.0000 2017-12-12 18:00 19.9909 57.5342 0.0000
2017-12-07 20:15 19.6030 58.5245 0.0000 2017-12-12 18:15 20.0048 57.5358 0.0000
2017-12-07 20:30 19.5989 58.5252 0.0000 2017-12-12 18:30 20.0143 57.5372 0.0000
2017-12-07 20:45 19.5948 58.5256 0.0000 2017-12-12 18:45 20.0239 57.5380 0.0000
2017-12-07 21:00 19.5907 58.5263 0.0000 2017-12-12 19:00 20.0377 57.5379 0.0000
2017-12-07 21:15 19.5866 58.5271 0.0000 2017-12-12 19:15 20.0514 57.5379 0.0000
2017-12-07 21:30 19.5818 58.5274 0.0000 2017-12-12 19:30 20.0611 57.5380 0.0000
2017-12-07 21:45 19.5769 58.5281 0.0000 2017-12-12 19:45 20.0775 57.5366 0.0000
2017-12-07 22:00 19.5721 58.5281 0.0000 2017-12-12 20:00 20.0871 57.5342 0.0000
2017-12-07 22:15 19.5673 58.5285 0.0000 2017-12-12 20:15 20.0981 57.5299 0.0000
2017-12-07 22:30 19.5632 58.5289 0.0000 2017-12-12 20:30 20.1063 57.5254 0.0000
2017-12-07 22:45 19.5563 58.5288 0.0000 2017-12-12 20:45 20.1118 57.5209 0.0000
2017-12-07 23:00 19.5515 58.5288 0.0000 2017-12-12 21:00 20.1160 57.5159 0.0000
2017-12-07 23:15 19.5460 58.5288 0.0000 2017-12-12 21:15 20.1187 57.5115 0.0000
2017-12-07 23:30 19.5413 58.5288 0.0000 2017-12-12 21:30 20.1201 57.5070 0.0000
2017-12-07 23:45 19.5364 58.5288 0.0000 2017-12-12 21:45 20.1201 57.4981 0.0000
2017-12-08 00:00 19.5316 58.5288 0.0000 2017-12-12 22:00 20.1200 57.4922 0.0000
2017-12-08 00:15 19.5268 58.5288 0.0000 2017-12-12 22:15 20.1228 57.4870 0.0000
2017-12-08 00:30 19.5213 58.5288 0.0000 2017-12-12 22:30 20.1229 57.4819 0.0000
2017-12-08 00:45 19.5165 58.5288 0.0000 2017-12-12 22:45 20.1173 57.4768 0.0000
2017-12-08 01:00 19.5117 58.5289 0.0000 2017-12-12 23:00 20.1090 57.4730 0.0000
2017-12-08 01:15 19.5069 58.5288 0.0000 2017-12-12 23:15 20.1022 57.4692 0.0000
2017-12-08 01:30 19.5021 58.5288 0.0000 2017-12-12 23:30 20.0967 57.4649 0.0000
2017-12-08 01:45 19.4973 58.5288 0.0000 2017-12-12 23:45 20.0912 57.4596 0.0000
2017-12-08 02:00 19.4925 58.5281 0.0000 2017-12-13 00:00 20.0871 57.4530 0.0000
2017-12-08 02:15 19.4884 58.5278 0.0000
2017-12-08 02:30 19.4843 58.5270 0.0000
2017-12-08 02:45 19.4794 58.5267 0.0000
2017-12-08 03:00 19.4746 58.5267 0.0000
2017-12-08 03:15 19.4698 58.5267 0.0000
2017-12-08 03:30 19.4650 58.5267 0.0000
2017-12-08 03:45 19.4602 58.5267 0.0000
2017-12-08 04:00 19.4561 58.5263 0.0000
2017-12-08 04:15 19.4520 58.5260 0.0000
2017-12-08 04:30 19.4479 58.5256 0.0000
2017-12-08 04:45 19.4437 58.5245 0.0000
2017-12-08 05:00 19.4396 58.5235 0.0000
2017-12-08 05:15 19.4362 58.5217 0.0000
2017-12-08 05:30 19.4348 58.5195 0.0000
2017-12-08 05:45 19.4334 58.5174 0.0000
2017-12-08 06:00 19.4328 58.5152 0.0000
2017-12-08 06:15 19.4321 58.5127 0.0000
2017-12-08 06:30 19.4321 58.5102 0.0000
2017-12-08 06:45 19.4321 58.5077 0.0000
2017-12-08 07:00 19.4334 58.5055 0.0000
2017-12-08 07:15 19.4334 58.5030 0.0000
2017-12-08 07:30 19.4328 58.5001 0.0000
2017-12-08 07:45 19.4307 58.4980 0.0000
2017-12-08 08:00 19.4279 58.4962 0.0000
2017-12-08 08:15 19.4259 58.4941 0.0000
2017-12-08 08:30 19.4245 58.4919 0.0000
2017-12-08 08:45 19.4231 58.4897 0.0000
2017-12-08 09:00 19.4218 58.4876 0.0000
2017-12-08 09:15 19.4218 58.4851 0.0000
2017-12-08 09:30 19.4218 58.4826 0.0000
2017-12-08 09:45 19.4231 58.4804 0.0000
2017-12-08 10:00 19.4245 58.4783 0.0000
2017-12-08 10:15 19.4259 58.4761 0.0000
2017-12-08 10:30 19.4279 58.4740 0.0000
2017-12-08 10:45 19.4307 58.4722 0.0000
2017-12-08 11:00 19.4328 58.4700 0.0000
2017-12-08 11:15 19.4334 58.4678 0.0000
2017-12-08 11:30 19.4334 58.4650 0.0000
2017-12-08 11:45 19.4341 58.4628 0.0000
2017-12-08 12:00 19.4355 58.4607 0.0000
2017-12-08 12:15 19.4369 58.4582 0.0000
2017-12-08 12:30 19.4389 58.4560 0.0000
2017-12-08 12:45 19.4410 58.4538 0.0000
2017-12-08 13:00 19.4424 58.4513 0.0000
2017-12-08 13:15 19.4437 58.4488 0.0000
2017-12-08 13:30 19.4451 58.4467 0.0000
2017-12-08 13:45 19.4451 58.4441 0.0000
2017-12-08 14:00 19.4451 58.4409 0.0000
2017-12-08 14:15 19.4458 58.4387 0.0000
2017-12-08 14:30 19.4458 58.4362 0.0000
2017-12-08 14:45 19.4458 58.4334 0.0000
2017-12-08 15:00 19.4444 58.4305 0.0000
2017-12-08 15:15 19.4431 58.4280 0.0000
...@@ -76,10 +76,10 @@ def run(): ...@@ -76,10 +76,10 @@ def run():
if ('primary' in inputfeature['properties'] and inputfeature['properties']['primary'] == 'PADM'): if ('primary' in inputfeature['properties'] and inputfeature['properties']['primary'] == 'PADM'):
outletproperties = inputfeature['properties'] outletproperties = inputfeature['properties']
outletgeom = geometry.shape(inputfeature['geometry']) outletgeom = geometry.shape(inputfeature['geometry'])
multipointoutlet = m.createOutlet(outletgeom) multipointoutlet, pDist = m.createOutlet(outletgeom)
if ('auxiliary' in inputfeature['properties'] and inputfeature['properties']['auxiliary'] == 'exercise'): if ('auxiliary' in inputfeature['properties'] and inputfeature['properties']['auxiliary'] == 'exercise'):
exercisefeature = inputfeature exercisefeature = inputfeature
outputfeaturecollection = m.createOutput(outletproperties['simulation']['startDate'],multipointoutlet,exercisefeature, strtree) outputfeaturecollection = m.createOutput(outletproperties['simulation']['startDate'],pDist,multipointoutlet,exercisefeature, strtree)
outputfeaturecollection['properties'] = {} outputfeaturecollection['properties'] = {}
outputfeaturecollection['properties']['uuid'] = os.getcwd().split(os.sep)[-1] outputfeaturecollection['properties']['uuid'] = os.getcwd().split(os.sep)[-1]
outputfeaturecollection['properties']['status'] = 'COMPLETE' outputfeaturecollection['properties']['status'] = 'COMPLETE'
......
...@@ -86,7 +86,7 @@ class Model(object): ...@@ -86,7 +86,7 @@ class Model(object):
def createOutlet(self,geom): def createOutlet(self,geom):
nrOfParticles = 100 nrOfParticles = 300
center = geom.centroid center = geom.centroid
points = [] points = []
depth = [] depth = []
...@@ -119,7 +119,7 @@ class Model(object): ...@@ -119,7 +119,7 @@ class Model(object):
print("Outlet particles count: "+str(counter)) print("Outlet particles count: "+str(counter))
return geometry.MultiPoint(points) return geometry.MultiPoint(points),pDist
def createFeatureCollection(self): def createFeatureCollection(self):
featurecollection = {} featurecollection = {}
...@@ -140,18 +140,23 @@ class Model(object): ...@@ -140,18 +140,23 @@ class Model(object):
print("On land calculated") print("On land calculated")
return result return result
def calculateRadius(self, pDist, points):
radius = [pDist] * len(points)
for i in range(len(points)):
radius[i] *= random.uniform(0.05, 3)
return radius
def displacePoints(self, points):
def displacePoints(self, pDist, points):
p = 0 p = 0
xdisp = [0] * len(points) xdisp = [0] * len(points)
ydisp = [0] * len(points) ydisp = [0] * len(points)
minoverlap = [float('Inf')] * len(points) minoverlap = [float('Inf')] * len(points)
radius = [0] * len(points) radius = self.calculateRadius(pDist, points)
for i in range(len(points)):
radius[i] = 0.0015 * random.uniform(0.1, 1)
while (p < len(points)): while (p < len(points)):
pn = 0 pn = 0
while (pn < len(points)): while (pn < len(points)):
...@@ -205,7 +210,7 @@ class Model(object): ...@@ -205,7 +210,7 @@ class Model(object):
return properties return properties
def createOutput(self, starttime, multipoint, exercisefeature, strtree): def createOutput(self, starttime, pDist, multipoint, exercisefeature, strtree):
featurecollection = self.createFeatureCollection() featurecollection = self.createFeatureCollection()
features = featurecollection['features'] features = featurecollection['features']
...@@ -215,9 +220,8 @@ class Model(object): ...@@ -215,9 +220,8 @@ class Model(object):
mp = multipoint mp = multipoint
linestring = geometry.shape(exercisefeature['geometry']) linestring = geometry.shape(exercisefeature['geometry'])
for i, coord in enumerate(linestring.coords): for i, coord in enumerate(linestring.coords):
print(mp.centroid)
points = self.centerPoints(coord, mp.centroid, mp.geoms) points = self.centerPoints(coord, mp.centroid, mp.geoms)
displacedpoints = self.displacePoints(points) displacedpoints = self.displacePoints(pDist, points)
# onlandpoints = self.onlandPoints(displacedpoints,strtree) # onlandpoints = self.onlandPoints(displacedpoints,strtree)
mp = geometry.MultiPoint(displacedpoints) mp = geometry.MultiPoint(displacedpoints)
level = [0] * len(mp.geoms) level = [0] * len(mp.geoms)
......
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"simulation":{"forwardCalculation":true,"startDate":1513080000000,"stopDate":1513083600000,"oilclass":"Oil classes","substance":"Medium oils (100-1000 cSt)","fresh":true,"amount":"10","amountUnit":"m3","uncertainty":false,"mode":"Normal"},"primary":"PADM","type":"exercise","subtype":"instant","meanLat":56.95620768360087,"meanLng":20.06515502929688,"observation":[{"id":null,"provider":"USER","providerDataRef":null,"providerImgRef":null,"providerType":null,"type":"MANUAL","date":1513080000000}],"domain":"HELCOM","model":"NEMO"},"geometry":{"type":"Polygon","coordinates":[[[20.055541992187504,56.962947135260585],[20.0775146484375,56.962947135260585],[20.085754394531254,56.953961741347385],[20.069274902343754,56.95096612859506],[20.052795410156254,56.94946823194116],[20.044555664062504,56.95845470910799],[20.047302246093754,56.95995224466898],[20.055541992187504,56.962947135260585]]]}},{"type":"Feature","properties":{"auxiliary":"exercise","time":[1513080900000,1513081800000,1513082700000,1513083600000]},"geometry":{"type":"LineString","coordinates":[[20.06584167480469,56.953961741347385],[20.06584167480469,56.95227673879617],[20.06584167480469,56.95059166007404],[20.06584167480469,56.94928099062754]]}}]} {"type":"FeatureCollection","features":[{"type":"Feature","properties":{"simulation":{"forwardCalculation":true,"startDate":1513080000000,"stopDate":1513123200000,"oilclass":"Oil classes","substance":"Medium oils (100-1000 cSt)","fresh":true,"amount":"10","amountUnit":"m3","uncertainty":false,"mode":"Normal"},"primary":"PADM","type":"exercise","subtype":"instant","meanLat":57.532041723896384,"meanLng":19.761657714843754,"observation":[{"id":null,"provider":"USER","providerDataRef":null,"providerImgRef":null,"providerType":null,"type":"MANUAL","date":1513080000000}],"domain":"HELCOM","model":"NEMO"},"geometry":{"type":"Polygon","coordinates":[[[19.720458984375004,57.53057086019259],[19.731445312500004,57.54826058225394],[19.775390625,57.54531289147553],[19.802856445312504,57.53057086019259],[19.775390625,57.51582286553883],[19.736938476562504,57.51582286553883],[19.720458984375004,57.51582286553883],[19.720458984375004,57.53057086019259]]]}},{"type":"Feature","properties":{"auxiliary":"exercise","time":[1513080900000,1513081800000,1513082700000,1513083600000,1513084500000,1513085400000,1513086300000,1513087200000,1513088100000,1513089000000,1513089900000,1513090800000,1513091700000,1513092600000,1513093500000,1513094400000,1513095300000,1513096200000,1513097100000,1513098000000,1513098900000,1513099800000,1513100700000,1513101600000,1513102500000,1513103400000,1513104300000,1513105200000,1513106100000,1513107000000,1513107900000,1513108800000,1513109700000,1513110600000,1513111500000,1513112400000,1513113300000,1513114200000,1513115100000,1513116000000,1513116900000,1513117800000,1513118700000,1513119600000,1513120500000,1513121400000,1513122300000,1513123200000]},"geometry":{"type":"LineString","coordinates":[[19.7698974609375,57.53057086019259],[19.778137207031254,57.52614708801571],[19.79049682617188,57.520247890174275],[19.800109863281254,57.51656040692372],[19.811096191406254,57.51139730407089],[19.81796264648438,57.50844663149949],[19.827575683593754,57.50475795522328],[19.83993530273438,57.50033105150468],[19.85641479492188,57.49590361081804],[19.868774414062504,57.492951685358975],[19.882507324218754,57.492213666700756],[19.892120361328125,57.492213666700756],[19.90310668945313,57.492951685358975],[19.91134643554688,57.49516565182901],[19.91958618164063,57.49885529760746],[19.92919921875,57.50254457048255],[19.93881225585938,57.507708926072574],[19.94705200195313,57.512872550877304],[19.953918457031254,57.51729793339678],[19.960784912109375,57.52098534209085],[19.967651367187504,57.52540974047066],[19.973144531250004,57.5290963291026],[19.98001098632813,57.53204533164888],[19.99099731445313,57.534256927023264],[20.00473022460938,57.535731249401564],[20.014343261718754,57.53720551215121],[20.02395629882813,57.537942621165705],[20.03768920898438,57.537942621165705],[20.05142211914063,57.537942621165705],[20.061035156250004,57.537942621165705],[20.0775146484375,57.53646838822989],[20.08712768554688,57.534256927023264],[20.09811401367188,57.52983360210189],[20.10635375976563,57.52540974047066],[20.11184692382813,57.52098534209085],[20.115966796875004,57.51582286553883],[20.118713378906254,57.51139730407089],[20.120086669921875,57.5069712057317],[20.120086669921875,57.498117398284776],[20.120086669921875,57.492213666700756],[20.12283325195313,57.48704711838609],[20.12283325195313,57.48187983904036],[20.11734008789063,57.47671182860216],[20.109100341796875,57.47301994493327],[20.102233886718754,57.469327688204295],[20.096740722656254,57.46489648765881],[20.091247558593754,57.45972607462754],[20.08712768554688,57.45307732607687]]}}]}
\ No newline at end of file \ No newline at end of file
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