Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
stw
wt
exercisemodel
Commits
8aadeb67
Commit
8aadeb67
authored
Dec 14, 2017
by
Tomas Pettersson
🏸
Browse files
printouts
parent
1f13a2d8
Changes
4
Hide whitespace changes
Inline
Side-by-side
cloudtrack.dat
View file @
8aadeb67
2017-12-13 08:00 27.0119 60.0031 0.0000
2017-12-13 08:15 27.0112 60.0034 0.0000
2017-12-13 08:15 27.0113 60.0034 0.0000
2017-12-13 08:30 27.0103 60.0036 0.0000
2017-12-13 08:45 27.0094 60.0039 0.0000
2017-12-13 09:00 27.0083 60.0043 0.0000
2017-12-13 09:15 27.0075 60.0046 0.0000
2017-12-13 09:30 27.0065 60.0052 0.0000
2017-12-13 09:45 27.0059 60.0057 0.0000
2017-12-13 10:00 27.0052 60.0061 0.0000
2017-12-13 10:15 27.0047 60.0066 0.0000
2017-12-13 10:30 27.0041 60.0072 0.0000
2017-12-13 10:45 27.0034 60.0077 0.0000
2017-12-13 11:00 27.0028 60.0082 0.0000
2017-12-13 11:15 27.0025 60.0088 0.0000
2017-12-13 11:30 27.0022 60.0093 0.0000
2017-12-13 11:45 27.5613 59.4504 0.0000
2017-12-13 12:00 32.4847 54.5275 0.0000
2017-12-13 12:15 40.9888 46.0239 0.0000
2017-12-13 12:30 50.3883 36.6248 0.0000
2017-12-13 12:45 58.3332 28.6800 0.0000
2017-12-13 13:00 60.0117 27.0015 0.0000
2017-12-13 13:15 60.0117 27.0015 0.0000
2017-12-13 13:30 60.0117 27.0015 0.0000
2017-12-13 13:45 60.0117 27.0015 0.0000
2017-12-13 14:00 60.0117 27.0015 0.0000
2017-12-13 14:15 60.0117 27.0015 0.0000
2017-12-13 14:30 60.0117 27.0015 0.0000
2017-12-13 14:45 60.0117 27.0015 0.0000
2017-12-13 15:00 60.0117 27.0015 0.0000
2017-12-13 15:15 60.0117 27.0015 0.0000
2017-12-13 15:30 60.0117 27.0015 0.0000
2017-12-13 15:45 60.0117 27.0015 0.0000
2017-12-13 16:00 60.0117 27.0015 0.0000
2017-12-13 16:15 60.0117 27.0015 0.0000
2017-12-13 16:30 60.0117 27.0015 0.0000
2017-12-13 16:45 60.0117 27.0015 0.0000
2017-12-13 17:00 60.0117 27.0015 0.0000
2017-12-13 17:15 60.0117 27.0015 0.0000
2017-12-13 17:30 60.0117 27.0015 0.0000
2017-12-13 17:45 60.0117 27.0015 0.0000
2017-12-13 18:00 60.0117 27.0015 0.0000
2017-12-13 18:15 60.0117 27.0015 0.0000
2017-12-13 18:30 60.0117 27.0015 0.0000
2017-12-13 18:45 60.0117 27.0015 0.0000
2017-12-13 19:00 60.0117 27.0015 0.0000
2017-12-13 19:15 60.0117 27.0015 0.0000
2017-12-13 19:30 60.0117 27.0015 0.0000
2017-12-13 19:45 60.0117 27.0015 0.0000
2017-12-13 20:00 60.0117 27.0015 0.0000
exercisemodel/__init__.py
View file @
8aadeb67
...
...
@@ -100,9 +100,9 @@ def run():
outputfeaturecollection
[
'properties'
][
'status'
]
=
'COMPLETE'
outputfeaturecollection
[
'properties'
][
'simulation'
]
=
outletproperties
[
'simulation'
]
#
Cloudtrack.write(outputfeaturecollection)
#
Particletrack.write(outputfeaturecollection)
Output
.
write
(
outputfeaturecollection
)
Cloudtrack
.
write
(
outputfeaturecollection
)
Particletrack
.
write
(
outputfeaturecollection
)
#
Output.write(outputfeaturecollection)
print
(
"COMPLETE"
)
sys
.
exit
(
0
)
...
...
exercisemodel/intersect.py
deleted
100644 → 0
View file @
1f13a2d8
# intersect.py
#
# Demonstrate how Shapely can be used to analyze and plot the intersection of
# a trajectory and regions in space.
from
functools
import
partial
import
random
import
pylab
from
shapely.geometry
import
LineString
,
Point
from
shapely.ops
import
cascaded_union
# Build patches as in dissolved.py
r
=
partial
(
random
.
uniform
,
-
20.0
,
20.0
)
points
=
[
Point
(
r
(),
r
())
for
i
in
range
(
100
)]
spots
=
[
p
.
buffer
(
2.5
)
for
p
in
points
]
patches
=
cascaded_union
(
spots
)
# Represent the following geolocation parameters
#
# initial position: -25, -25
# heading: 45.0
# speed: 50*sqrt(2)
#
# as a line
vector
=
LineString
(((
-
25.0
,
-
25.0
),
(
25.0
,
25.0
)))
# Find intercepted and missed patches. List the former so we can count them
# later
intercepts
=
[
patch
for
patch
in
patches
.
geoms
if
vector
.
intersects
(
patch
)]
misses
=
(
patch
for
patch
in
patches
.
geoms
if
not
vector
.
intersects
(
patch
))
# Plot the intersection
intersection
=
vector
.
intersection
(
patches
)
print
(
intersection
)
assert
intersection
.
geom_type
in
[
'MultiLineString'
]
if
__name__
==
"__main__"
:
# Illustrate the results using matplotlib's pylab interface
pylab
.
figure
(
num
=
None
,
figsize
=
(
4
,
4
),
dpi
=
180
)
# Plot the misses
for
spot
in
misses
:
x
,
y
=
spot
.
exterior
.
xy
pylab
.
fill
(
x
,
y
,
color
=
'#cccccc'
,
aa
=
True
)
pylab
.
plot
(
x
,
y
,
color
=
'#999999'
,
aa
=
True
,
lw
=
1.0
)
# Do the same for the holes of the patch
for
hole
in
spot
.
interiors
:
x
,
y
=
hole
.
xy
pylab
.
fill
(
x
,
y
,
color
=
'#ffffff'
,
aa
=
True
)
pylab
.
plot
(
x
,
y
,
color
=
'#999999'
,
aa
=
True
,
lw
=
1.0
)
# Plot the intercepts
for
spot
in
intercepts
:
x
,
y
=
spot
.
exterior
.
xy
pylab
.
fill
(
x
,
y
,
color
=
'red'
,
alpha
=
0.25
,
aa
=
True
)
pylab
.
plot
(
x
,
y
,
color
=
'red'
,
alpha
=
0.5
,
aa
=
True
,
lw
=
1.0
)
# Do the same for the holes of the patch
for
hole
in
spot
.
interiors
:
x
,
y
=
hole
.
xy
pylab
.
fill
(
x
,
y
,
color
=
'#ffffff'
,
aa
=
True
)
pylab
.
plot
(
x
,
y
,
color
=
'red'
,
alpha
=
0.5
,
aa
=
True
,
lw
=
1.0
)
# Draw the projected trajectory
pylab
.
arrow
(
-
25
,
-
25
,
50
,
50
,
color
=
'#999999'
,
aa
=
True
,
head_width
=
1.0
,
head_length
=
1.0
)
for
segment
in
intersection
.
geoms
:
x
,
y
=
segment
.
xy
pylab
.
plot
(
x
,
y
,
color
=
'red'
,
aa
=
True
,
lw
=
1.5
)
# Write the number of patches and the total patch area to the figure
pylab
.
text
(
-
28
,
25
,
"Patches: %d/%d (%d), total length: %.1f"
\
%
(
len
(
intercepts
),
len
(
patches
.
geoms
),
len
(
intersection
.
geoms
),
intersection
.
length
))
pylab
.
savefig
(
'intersect.png'
)
\ No newline at end of file
exercisemodel/model.py
View file @
8aadeb67
...
...
@@ -303,9 +303,9 @@ class Model(object):
category
=
[
2
]
*
len
(
mp
.
geoms
)
properties
=
self
.
createProperties
((
i
+
2
),
timearray
[
i
],
mp
.
centroid
,
level
,
category
)
features
.
append
(
self
.
createFeature
(
mp
,
properties
))
#
if (i % 10 == 0):
#
Cloudtrack.write(featurecollection)
#
Particletrack.write(featurecollection)
if
(
i
%
10
==
0
):
Cloudtrack
.
write
(
featurecollection
)
Particletrack
.
write
(
featurecollection
)
mp
=
geometry
.
MultiPoint
(
activepoints
)
print
(
'deactivepoints: '
+
str
(
len
(
deactivepoints
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment