Commit 2fdf5501 authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

adaptations for Point and LineString input

parent dc97b24b
2017-12-06 15:00 18.3291 58.5122 0.0000 2017-12-06 15:00 18.3291 58.5122 0.0000
2017-12-06 15:15 18.3252 58.4966 0.0000
2017-12-06 15:30 18.3252 58.4765 0.0000
2017-12-06 15:45 18.3252 58.4563 0.0000
2017-12-06 16:00 18.3197 58.4391 0.0000
...@@ -79,7 +79,7 @@ def run(): ...@@ -79,7 +79,7 @@ def run():
multipointoutlet = m.createOutlet(outletgeom) multipointoutlet = 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'],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]
......
...@@ -82,15 +82,18 @@ class Model(object): ...@@ -82,15 +82,18 @@ class Model(object):
def createOutlet(self,polygon): def createOutlet(self,geom):
nrOfParticles = 500 nrOfParticles = 500
center = polygon.centroid center = geom.centroid
points = [] points = []
depth = [] depth = []
properties = {} properties = {}
properties['depth'] = depth properties['depth'] = depth
pArea = (polygon.area)/3 if (geom.geom_type == 'Point'):
geom = geom.buffer(0.0001)
if (geom.geom_type == 'LineString'):
geom = geom.buffer(0.01, 20)
pArea = (geom.area)/3
pDist = math.sqrt((4*pArea)/(nrOfParticles*math.sqrt(3))) pDist = math.sqrt((4*pArea)/(nrOfParticles*math.sqrt(3)))
counter = 0 counter = 0
lvl = 1 lvl = 1
...@@ -100,7 +103,7 @@ class Model(object): ...@@ -100,7 +103,7 @@ class Model(object):
j = 0 j = 0
while (j < len(nodes)): while (j < len(nodes)):
point = nodes[j] point = nodes[j]
if polygon.contains(point): if geom.contains(point):
points.append(point) points.append(point)
depth.append(0.0) depth.append(0.0)
counter += 1 counter += 1
...@@ -217,5 +220,4 @@ class Model(object): ...@@ -217,5 +220,4 @@ class Model(object):
category = [2] * len(mp.geoms) category = [2] * len(mp.geoms)
properties = self.createProperties((i+2), time[i], mp.centroid, level, category) properties = self.createProperties((i+2), time[i], mp.centroid, level, category)
features.append(self.createFeature(mp, properties)) features.append(self.createFeature(mp, properties))
# features.append(self.createFeature(linestring))
return featurecollection return featurecollection
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"startDate": 1512572400000, "startDate": 1512572400000,
"stopDate": 1512576000000, "stopDate": 1512576000000,
"oilclass": "Oil classes", "oilclass": "Oil classes",
"substance": "Medium oils (100-1000 cSt)", "substance": "Heavy oils (>1000 cSt)",
"fresh": true, "fresh": true,
"amount": "10", "amount": "10",
"amountUnit": "m3", "amountUnit": "m3",
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
"primary": "PADM", "primary": "PADM",
"type": "oil", "type": "oil",
"subtype": "instant", "subtype": "instant",
"meanLat": 56.24013088499595, "meanLat": 58.513756484300636,
"meanLng": 18.5064697265625, "meanLng": 18.322448730468754,
"observation": [{ "observation": [{
"id": null, "id": null,
"provider": "USER", "provider": "USER",
...@@ -33,21 +33,26 @@ ...@@ -33,21 +33,26 @@
"model": "NEMO" "model": "NEMO"
}, },
"geometry": { "geometry": {
"type": "LineString", "type": "Polygon",
"coordinates": [ "coordinates": [
[18.160400390625004, 56.127184156131065], [
[18.237304687500004, 56.15166933290848], [18.209838867187504, 58.49082301741564],
[18.303222656250004, 56.16390607394954], [18.220825195312504, 58.50804431680734],
[18.369140625000004, 56.17613891766981], [18.237304687500004, 58.52812515905846],
[18.435058593750004, 56.18225387824834], [18.259277343750004, 58.54246158235835],
[18.500976562500004, 56.1883678647531], [18.292236328125004, 58.55106062287748],
[18.588867187500004, 56.1883678647531], [18.336181640625004, 58.55679214448154],
[18.665771484375004, 56.19448087726972], [18.380126953125004, 58.553926500879044],
[18.731689453125004, 56.21281407174654], [18.413085937500004, 58.54246158235835],
[18.775634765625004, 56.24334992410525], [18.429565429687504, 58.52238894827317],
[18.808593750000004, 56.27996083172847], [18.435058593750004, 58.50517468678928],
[18.830566406250004, 56.31653672211301], [18.418579101562504, 58.487951979600396],
[18.8525390625, 56.353077613860826] [18.380126953125004, 58.47359327016314],
[18.347167968750004, 58.47072082411973],
[18.308715820312504, 58.47072082411973],
[18.297729492187504, 58.47072082411973],
[18.209838867187504, 58.49082301741564]
]
] ]
} }
}, { }, {
...@@ -59,10 +64,10 @@ ...@@ -59,10 +64,10 @@
"geometry": { "geometry": {
"type": "LineString", "type": "LineString",
"coordinates": [ "coordinates": [
[18.586120605468754, 56.202120773375], [18.325195312500004, 58.496564389069675],
[18.580627441406254, 56.21586875215692], [18.325195312500004, 58.476465481471976],
[18.572387695312504, 56.22655821688316], [18.325195312500004, 58.4563550724647],
[18.566894531250004, 56.237244700410336] [18.319702148437504, 58.43910842173683]
] ]
} }
}] }]
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
2 2017-12-06 15:15 47 20.5667 58.8137 0.0000
20.5774 58.8264 0.0 T T F 2 0.000 0.000 0.000
20.5645 58.8241 0.0 T T F 2 0.000 0.000 0.000
20.5624 58.8164 0.0 T T F 2 0.000 0.000 0.000
20.5530 58.8044 0.0 T T F 2 0.000 0.000 0.000
20.5643 58.7971 0.0 T T F 2 0.000 0.000 0.000
20.5764 58.8027 0.0 T T F 2 0.000 0.000 0.000
20.5503 58.8163 0.0 T T F 2 0.000 0.000 0.000
20.5757 58.8230 0.0 T T F 2 0.000 0.000 0.000
20.5724 58.8328 0.0 T T F 2 0.000 0.000 0.000
20.5656 58.8222 0.0 T T F 2 0.000 0.000 0.000
20.5619 58.8228 0.0 T T F 2 0.000 0.000 0.000
20.5608 58.8181 0.0 T T F 2 0.000 0.000 0.000
20.5549 58.8139 0.0 T T F 2 0.000 0.000 0.000
20.5592 58.8082 0.0 T T F 2 0.000 0.000 0.000
20.5611 58.8027 0.0 T T F 2 0.000 0.000 0.000
20.5656 58.8030 0.0 T T F 2 0.000 0.000 0.000
20.5708 58.7994 0.0 T T F 2 0.000 0.000 0.000
20.5797 58.8007 0.0 T T F 2 0.000 0.000 0.000
20.5762 58.8139 0.0 T T F 2 0.000 0.000 0.000
20.5805 58.8270 0.0 T T F 2 0.000 0.000 0.000
20.5702 58.8212 0.0 T T F 2 0.000 0.000 0.000
20.5696 58.8291 0.0 T T F 2 0.000 0.000 0.000
20.5658 58.8332 0.0 T T F 2 0.000 0.000 0.000
20.5640 58.8214 0.0 T T F 2 0.000 0.000 0.000
20.5596 58.8243 0.0 T T F 2 0.000 0.000 0.000
20.5595 58.8195 0.0 T T F 2 0.000 0.000 0.000
20.5549 58.8170 0.0 T T F 2 0.000 0.000 0.000
20.5547 58.8104 0.0 T T F 2 0.000 0.000 0.000
20.5613 58.8097 0.0 T T F 2 0.000 0.000 0.000
20.5581 58.8008 0.0 T T F 2 0.000 0.000 0.000
20.5638 58.8052 0.0 T T F 2 0.000 0.000 0.000
20.5659 58.8008 0.0 T T F 2 0.000 0.000 0.000
20.5690 58.8006 0.0 T T F 2 0.000 0.000 0.000
20.5706 58.8055 0.0 T T F 2 0.000 0.000 0.000
20.5769 58.8036 0.0 T T F 2 0.000 0.000 0.000
20.5853 58.8079 0.0 T T F 2 0.000 0.000 0.000
20.5790 58.8179 0.0 T T F 2 0.000 0.000 0.000
20.5529 58.8198 0.0 T T F 2 0.000 0.000 0.000
20.5565 58.8136 0.0 T T F 2 0.000 0.000 0.000
20.5585 58.8103 0.0 T T F 2 0.000 0.000 0.000
20.5812 58.8066 0.0 T T F 2 0.000 0.000 0.000
20.5739 58.8138 0.0 T T F 2 0.000 0.000 0.000
20.5789 58.8197 0.0 T T F 2 0.000 0.000 0.000
20.5490 58.8168 0.0 T T F 2 0.000 0.000 0.000
20.5590 58.8123 0.0 T T F 2 0.000 0.000 0.000
20.5828 58.8107 0.0 T T F 2 0.000 0.000 0.000
20.5797 58.8163 0.0 T T F 2 0.000 0.000 0.000
3 2017-12-06 15:30 47 20.7418 58.7000 0.0000
20.7532 58.7095 0.0 T T F 2 0.000 0.000 0.000
20.7427 58.7208 0.0 T T F 2 0.000 0.000 0.000
20.7290 58.7122 0.0 T T F 2 0.000 0.000 0.000
20.7338 58.6928 0.0 T T F 2 0.000 0.000 0.000
20.7426 58.6801 0.0 T T F 2 0.000 0.000 0.000
20.7523 58.6917 0.0 T T F 2 0.000 0.000 0.000
20.7504 58.7074 0.0 T T F 2 0.000 0.000 0.000
20.7510 58.7085 0.0 T T F 2 0.000 0.000 0.000
20.7468 58.7112 0.0 T T F 2 0.000 0.000 0.000
20.7422 58.7194 0.0 T T F 2 0.000 0.000 0.000
20.7368 58.7132 0.0 T T F 2 0.000 0.000 0.000
20.7314 58.7095 0.0 T T F 2 0.000 0.000 0.000
20.7229 58.7000 0.0 T T F 2 0.000 0.000 0.000
20.7262 58.6862 0.0 T T F 2 0.000 0.000 0.000
20.7373 58.6871 0.0 T T F 2 0.000 0.000 0.000
20.7423 58.6848 0.0 T T F 2 0.000 0.000 0.000
20.7473 58.6866 0.0 T T F 2 0.000 0.000 0.000
20.7494 58.6937 0.0 T T F 2 0.000 0.000 0.000
20.7566 58.7000 0.0 T T F 2 0.000 0.000 0.000
20.7513 58.7097 0.0 T T F 2 0.000 0.000 0.000
20.7501 58.7144 0.0 T T F 2 0.000 0.000 0.000
20.7436 58.7063 0.0 T T F 2 0.000 0.000 0.000
20.7422 58.7169 0.0 T T F 2 0.000 0.000 0.000
20.7404 58.7066 0.0 T T F 2 0.000 0.000 0.000
20.7399 58.7035 0.0 T T F 2 0.000 0.000 0.000
20.7321 58.7086 0.0 T T F 2 0.000 0.000 0.000
20.7205 58.7065 0.0 T T F 2 0.000 0.000 0.000
20.7296 58.6942 0.0 T T F 2 0.000 0.000 0.000
20.7326 58.6916 0.0 T T F 2 0.000 0.000 0.000
20.7363 58.6898 0.0 T T F 2 0.000 0.000 0.000
20.7382 58.6834 0.0 T T F 2 0.000 0.000 0.000
20.7417 58.6911 0.0 T T F 2 0.000 0.000 0.000
20.7457 58.6859 0.0 T T F 2 0.000 0.000 0.000
20.7505 58.6859 0.0 T T F 2 0.000 0.000 0.000
20.7500 58.6929 0.0 T T F 2 0.000 0.000 0.000
20.7545 58.6957 0.0 T T F 2 0.000 0.000 0.000
20.7529 58.7034 0.0 T T F 2 0.000 0.000 0.000
20.7269 58.7068 0.0 T T F 2 0.000 0.000 0.000
20.7263 58.6997 0.0 T T F 2 0.000 0.000 0.000
20.7258 58.6926 0.0 T T F 2 0.000 0.000 0.000
20.7576 58.6927 0.0 T T F 2 0.000 0.000 0.000
20.7602 58.6998 0.0 T T F 2 0.000 0.000 0.000
20.7579 58.7072 0.0 T T F 2 0.000 0.000 0.000
20.7293 58.7025 0.0 T T F 2 0.000 0.000 0.000
20.7288 58.6973 0.0 T T F 2 0.000 0.000 0.000
20.7526 58.6978 0.0 T T F 2 0.000 0.000 0.000
20.7543 58.7020 0.0 T T F 2 0.000 0.000 0.000
4 2017-12-06 15:45 47 20.9617 58.6082 0.0000
20.9735 58.6180 0.0 T T F 2 0.000 0.000 0.000
20.9627 58.6297 0.0 T T F 2 0.000 0.000 0.000
20.9476 58.6220 0.0 T T F 2 0.000 0.000 0.000
20.9478 58.5974 0.0 T T F 2 0.000 0.000 0.000
20.9627 58.5877 0.0 T T F 2 0.000 0.000 0.000
20.9734 58.5991 0.0 T T F 2 0.000 0.000 0.000
20.9736 58.6196 0.0 T T F 2 0.000 0.000 0.000
20.9716 58.6177 0.0 T T F 2 0.000 0.000 0.000
20.9669 58.6199 0.0 T T F 2 0.000 0.000 0.000
20.9621 58.6295 0.0 T T F 2 0.000 0.000 0.000
20.9568 58.6217 0.0 T T F 2 0.000 0.000 0.000
20.9509 58.6184 0.0 T T F 2 0.000 0.000 0.000
20.9420 58.6085 0.0 T T F 2 0.000 0.000 0.000
20.9440 58.5925 0.0 T T F 2 0.000 0.000 0.000
20.9568 58.5945 0.0 T T F 2 0.000 0.000 0.000
20.9624 58.5928 0.0 T T F 2 0.000 0.000 0.000
20.9674 58.5949 0.0 T T F 2 0.000 0.000 0.000
20.9706 58.6006 0.0 T T F 2 0.000 0.000 0.000
20.9780 58.6084 0.0 T T F 2 0.000 0.000 0.000
20.9715 58.6183 0.0 T T F 2 0.000 0.000 0.000
20.9705 58.6236 0.0 T T F 2 0.000 0.000 0.000
20.9637 58.6147 0.0 T T F 2 0.000 0.000 0.000
20.9622 58.6258 0.0 T T F 2 0.000 0.000 0.000
20.9591 58.6173 0.0 T T F 2 0.000 0.000 0.000
20.9600 58.6119 0.0 T T F 2 0.000 0.000 0.000
20.9517 58.6174 0.0 T T F 2 0.000 0.000 0.000
20.9404 58.6149 0.0 T T F 2 0.000 0.000 0.000
20.9491 58.6025 0.0 T T F 2 0.000 0.000 0.000
20.9511 58.5991 0.0 T T F 2 0.000 0.000 0.000
20.9517 58.5914 0.0 T T F 2 0.000 0.000 0.000
20.9581 58.5910 0.0 T T F 2 0.000 0.000 0.000
20.9613 58.5978 0.0 T T F 2 0.000 0.000 0.000
20.9658 58.5938 0.0 T T F 2 0.000 0.000 0.000
20.9709 58.5937 0.0 T T F 2 0.000 0.000 0.000
20.9730 58.5977 0.0 T T F 2 0.000 0.000 0.000
20.9767 58.6032 0.0 T T F 2 0.000 0.000 0.000
20.9735 58.6124 0.0 T T F 2 0.000 0.000 0.000
20.9418 58.6178 0.0 T T F 2 0.000 0.000 0.000
20.9460 58.6080 0.0 T T F 2 0.000 0.000 0.000
20.9455 58.6008 0.0 T T F 2 0.000 0.000 0.000
20.9785 58.6006 0.0 T T F 2 0.000 0.000 0.000
20.9814 58.6081 0.0 T T F 2 0.000 0.000 0.000
20.9783 58.6158 0.0 T T F 2 0.000 0.000 0.000
20.9483 58.6113 0.0 T T F 2 0.000 0.000 0.000
20.9488 58.6057 0.0 T T F 2 0.000 0.000 0.000
20.9757 58.6058 0.0 T T F 2 0.000 0.000 0.000
20.9746 58.6105 0.0 T T F 2 0.000 0.000 0.000
5 2017-12-06 16:00 47 21.1816 58.5166 0.0000
21.1967 58.5289 0.0 T T F 2 0.000 0.000 0.000
21.1827 58.5392 0.0 T T F 2 0.000 0.000 0.000
21.1670 58.5313 0.0 T T F 2 0.000 0.000 0.000
21.1677 58.5058 0.0 T T F 2 0.000 0.000 0.000
21.1827 58.4946 0.0 T T F 2 0.000 0.000 0.000
21.1948 58.5064 0.0 T T F 2 0.000 0.000 0.000
21.1935 58.5281 0.0 T T F 2 0.000 0.000 0.000
21.1917 58.5263 0.0 T T F 2 0.000 0.000 0.000
21.1869 58.5288 0.0 T T F 2 0.000 0.000 0.000
21.1819 58.5398 0.0 T T F 2 0.000 0.000 0.000
21.1767 58.5305 0.0 T T F 2 0.000 0.000 0.000
21.1689 58.5290 0.0 T T F 2 0.000 0.000 0.000
21.1611 58.5169 0.0 T T F 2 0.000 0.000 0.000
21.1634 58.5005 0.0 T T F 2 0.000 0.000 0.000
21.1751 58.4992 0.0 T T F 2 0.000 0.000 0.000
21.1824 58.5010 0.0 T T F 2 0.000 0.000 0.000
21.1875 58.5032 0.0 T T F 2 0.000 0.000 0.000
21.1918 58.5078 0.0 T T F 2 0.000 0.000 0.000
21.1981 58.5169 0.0 T T F 2 0.000 0.000 0.000
21.1916 58.5270 0.0 T T F 2 0.000 0.000 0.000
21.1906 58.5324 0.0 T T F 2 0.000 0.000 0.000
21.1841 58.5266 0.0 T T F 2 0.000 0.000 0.000
21.1821 58.5344 0.0 T T F 2 0.000 0.000 0.000
21.1777 58.5290 0.0 T T F 2 0.000 0.000 0.000
21.1798 58.5202 0.0 T T F 2 0.000 0.000 0.000
21.1714 58.5262 0.0 T T F 2 0.000 0.000 0.000
21.1599 58.5235 0.0 T T F 2 0.000 0.000 0.000
21.1690 58.5110 0.0 T T F 2 0.000 0.000 0.000
21.1707 58.5072 0.0 T T F 2 0.000 0.000 0.000
21.1715 58.4997 0.0 T T F 2 0.000 0.000 0.000
21.1773 58.4962 0.0 T T F 2 0.000 0.000 0.000
21.1807 58.5015 0.0 T T F 2 0.000 0.000 0.000
21.1859 58.5019 0.0 T T F 2 0.000 0.000 0.000
21.1911 58.5017 0.0 T T F 2 0.000 0.000 0.000
21.1930 58.5062 0.0 T T F 2 0.000 0.000 0.000
21.1985 58.5112 0.0 T T F 2 0.000 0.000 0.000
21.1935 58.5209 0.0 T T F 2 0.000 0.000 0.000
21.1603 58.5271 0.0 T T F 2 0.000 0.000 0.000
21.1658 58.5165 0.0 T T F 2 0.000 0.000 0.000
21.1654 58.5092 0.0 T T F 2 0.000 0.000 0.000
21.2010 58.5079 0.0 T T F 2 0.000 0.000 0.000
21.2022 58.5167 0.0 T T F 2 0.000 0.000 0.000
21.1985 58.5244 0.0 T T F 2 0.000 0.000 0.000
21.1671 58.5203 0.0 T T F 2 0.000 0.000 0.000
21.1631 58.5131 0.0 T T F 2 0.000 0.000 0.000
21.1960 58.5143 0.0 T T F 2 0.000 0.000 0.000
21.1948 58.5190 0.0 T T F 2 0.000 0.000 0.000
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