Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
skais
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Raphael Sturgis
skais
Commits
f6dcbe94
Commit
f6dcbe94
authored
3 years ago
by
Raphael Sturgis
Browse files
Options
Downloads
Patches
Plain Diff
set bounding box with 2 numbers
parent
abd34a4f
No related branches found
No related tags found
2 merge requests
!18
set bounding box with 2 numbers
,
!13
Draft: Develop
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
skais/ais/ais_trajectory.py
+16
-6
16 additions, 6 deletions
skais/ais/ais_trajectory.py
with
16 additions
and
6 deletions
skais/ais/ais_trajectory.py
+
16
−
6
View file @
f6dcbe94
import
numbers
import
random
import
random
import
pandas
as
pd
import
pandas
as
pd
...
@@ -232,7 +233,7 @@ class AISTrajectory(AISPoints):
...
@@ -232,7 +233,7 @@ class AISTrajectory(AISPoints):
result
.
append
((
row
[
'
ts_sec
'
],
current_label
))
result
.
append
((
row
[
'
ts_sec
'
],
current_label
))
return
result
return
result
def
generate_array_from_positions
(
self
,
height
=
256
,
width
=
256
,
link
=
True
,
bounding_box
=
'
fit
'
,
features
=
None
,
def
generate_array_from_positions
(
self
,
height
=
256
,
width
=
256
,
link
=
True
,
bounding_box
=
'
fit
'
,
ref_index
=-
1
,
features
=
None
,
node_size
=
0
):
node_size
=
0
):
nb_channels
=
1
nb_channels
=
1
...
@@ -241,7 +242,7 @@ class AISTrajectory(AISPoints):
...
@@ -241,7 +242,7 @@ class AISTrajectory(AISPoints):
lower_lon
,
upper_lon
=
(
min
(
positions
[:,
0
]),
max
(
positions
[:,
0
]))
lower_lon
,
upper_lon
=
(
min
(
positions
[:,
0
]),
max
(
positions
[:,
0
]))
lower_lat
,
upper_lat
=
(
min
(
positions
[:,
1
]),
max
(
positions
[:,
1
]))
lower_lat
,
upper_lat
=
(
min
(
positions
[:,
1
]),
max
(
positions
[:,
1
]))
elif
bounding_box
==
'
centered
'
:
elif
bounding_box
==
'
centered
'
:
center_lon
,
center_lat
=
positions
[
-
1
]
center_lon
,
center_lat
=
positions
[
ref_index
]
min_lon
,
max_lon
=
(
min
(
positions
[:,
0
]),
max
(
positions
[:,
0
]))
min_lon
,
max_lon
=
(
min
(
positions
[:,
0
]),
max
(
positions
[:,
0
]))
min_lat
,
max_lat
=
(
min
(
positions
[:,
1
]),
max
(
positions
[:,
1
]))
min_lat
,
max_lat
=
(
min
(
positions
[:,
1
]),
max
(
positions
[:,
1
]))
...
@@ -253,10 +254,19 @@ class AISTrajectory(AISPoints):
...
@@ -253,10 +254,19 @@ class AISTrajectory(AISPoints):
upper_lon
=
center_lon
+
distance_to_center
upper_lon
=
center_lon
+
distance_to_center
lower_lon
=
center_lon
-
distance_to_center
lower_lon
=
center_lon
-
distance_to_center
elif
type
(
bounding_box
)
is
list
:
elif
type
(
bounding_box
)
is
list
:
if
type
(
bounding_box
[
0
])
is
not
numbers
.
Number
:
upper_lon
=
bounding_box
[
1
][
0
]
upper_lon
=
bounding_box
[
1
][
0
]
lower_lon
=
bounding_box
[
0
][
0
]
lower_lon
=
bounding_box
[
0
][
0
]
upper_lat
=
bounding_box
[
1
][
1
]
upper_lat
=
bounding_box
[
1
][
1
]
lower_lat
=
bounding_box
[
0
][
1
]
lower_lat
=
bounding_box
[
0
][
1
]
else
:
center_lon
,
center_lat
=
positions
[
ref_index
]
distance_to_center_lon
=
bounding_box
[
0
]
distance_to_center_lat
=
bounding_box
[
1
]
upper_lat
=
center_lat
+
distance_to_center_lat
lower_lat
=
center_lat
-
distance_to_center_lat
upper_lon
=
center_lon
+
distance_to_center_lon
lower_lon
=
center_lon
-
distance_to_center_lon
else
:
else
:
raise
ValueError
(
f
"
Option not supported:
{
bounding_box
}
"
)
raise
ValueError
(
f
"
Option not supported:
{
bounding_box
}
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment