Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
df-aggregator
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oleksandr Barabash
df-aggregator
Commits
b6d4d389
Commit
b6d4d389
authored
Nov 16, 2020
by
Corey Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed handling of empty database
parent
eb711a43
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
df-aggregator.py
df-aggregator.py
+13
-10
No files found.
df-aggregator.py
View file @
b6d4d389
...
...
@@ -143,11 +143,14 @@ def process_data(database_name, outfile):
c
=
conn
.
cursor
()
intersect_list
=
[]
c
.
execute
(
"SELECT COUNT(*) FROM intersects"
)
n_intersects
=
int
(
c
.
fetchone
()[
0
])
c
.
execute
(
"SELECT longitude, latitude, time FROM intersects"
)
intersect_array
=
np
.
array
(
c
.
fetchall
())
try
:
c
.
execute
(
"SELECT COUNT(*) FROM intersects"
)
n_intersects
=
int
(
c
.
fetchone
()[
0
])
c
.
execute
(
"SELECT longitude, latitude, time FROM intersects"
)
intersect_array
=
np
.
array
(
c
.
fetchall
())
except
sqlite3
.
OperationalError
:
n_intersects
=
0
intersect_array
=
np
.
array
([])
likely_location
=
[]
weighted_location
=
[]
ellipsedata
=
[]
...
...
@@ -214,11 +217,11 @@ def process_data(database_name, outfile):
except
IndexError
:
intersect_list
.
append
(
x
.
tolist
())
return
likely_location
,
intersect_list
,
ellipsedata
else
:
print
(
"No Intersections."
)
return
None
# return None
return
likely_location
,
intersect_list
,
ellipsedata
def
write_geojson
(
best_point
,
all_the_points
):
all_pt_style
=
{
"name"
:
"Various Points"
,
"marker-color"
:
"#FF0000"
}
...
...
@@ -281,7 +284,7 @@ def write_czml(best_point, all_the_points, ellipsedata):
receiver_point_packets
=
[]
ellipse_packets
=
[]
if
all_the_points
!=
None
and
(
ms
.
plotintersects
or
ms
.
eps
==
0
):
if
len
(
all_the_points
)
>
0
and
(
ms
.
plotintersects
or
ms
.
eps
==
0
):
all_the_points
=
np
.
array
(
all_the_points
)
scaled_time
=
minmax_scale
(
all_the_points
[:,
-
1
])
all_the_points
=
np
.
column_stack
((
all_the_points
,
scaled_time
))
...
...
@@ -293,13 +296,13 @@ def write_czml(best_point, all_the_points, ellipsedata):
position
=
{
"cartographicDegrees"
:
[
x
[
0
],
x
[
1
],
10
]},
))
if
best_point
!=
None
:
if
len
(
best_point
)
>
0
:
for
x
in
best_point
:
best_point_packets
.
append
(
Packet
(
id
=
str
(
x
[
0
])
+
", "
+
str
(
x
[
1
]),
point
=
best_point_properties
,
position
=
{
"cartographicDegrees"
:
[
x
[
1
],
x
[
0
],
15
]}))
if
ellipsedata
!=
None
:
if
len
(
ellipsedata
)
>
0
:
for
x
in
ellipsedata
:
# rotation = 2 * np.pi - x[2]
if
x
[
0
]
>=
x
[
1
]:
...
...
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