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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Raphael Sturgis
skais
Merge requests
!9
Resolve "Creation of images from AIS"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Creation of images from AIS"
16-creation-of-images-from-ais
into
develop
Overview
0
Commits
6
Pipelines
0
Changes
2
Merged
Raphael Sturgis
requested to merge
16-creation-of-images-from-ais
into
develop
3 years ago
Overview
0
Commits
6
Pipelines
0
Changes
2
Expand
Closes
#16 (closed)
0
0
Merge request reports
Viewing commit
71ab7a04
Prev
Next
Show latest version
2 files
+
14
−
7
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
71ab7a04
refactoring for getting coordinate in array
· 71ab7a04
Raphael
authored
3 years ago
skais/ais/ais_trajectory.py
+
7
−
7
Options
@@ -5,7 +5,7 @@ import numpy as np
from
numba
import
jit
from
scipy.interpolate
import
interp1d
from
skais.utils.geography
import
great_circle
,
position_from_distance
from
skais.utils.geography
import
great_circle
,
position_from_distance
,
get_coord
from
skais.ais.ais_points
import
AISPoints
@@ -229,16 +229,13 @@ class AISTrajectory(AISPoints):
if
features
is
not
None
:
nb_channels
=
len
(
features
)
data
=
np
.
zeros
((
height
,
width
,
nb_channels
),
dtype
=
np
.
uint8
)
if
link
:
raise
ValueError
(
"
feature not implemented
"
)
if
bounding_box
!=
'
fit
'
:
raise
ValueError
(
"
feature not implemented
"
)
positions
=
self
.
df
[[
'
longitude
'
,
'
latitude
'
]].
to_numpy
()
range_longitude
=
(
min
(
positions
[:,
0
]),
max
(
positions
[:,
0
]))
range_latitude
=
(
min
(
positions
[:,
1
]),
max
(
positions
[:,
1
]))
min_lon
,
max_lon
=
(
min
(
positions
[:,
0
]),
max
(
positions
[:,
0
]))
min_lat
,
max_lat
=
(
min
(
positions
[:,
1
]),
max
(
positions
[:,
1
]))
for
longitude
,
latitude
in
positions
:
x_coord
=
max
(
min
(
height
-
int
(
height
*
(
latitude
-
range_latitude
[
0
])
/
(
range_latitude
[
1
]
-
range_latitude
[
0
]))
-
1
,
height
-
1
),
0
)
y_coord
=
max
(
min
(
int
((
width
-
1
)
*
(
longitude
-
range_longitude
[
0
])
/
(
range_longitude
[
1
]
-
range_longitude
[
0
])),
width
-
1
),
0
)
x_coord
,
y_coord
=
get_coord
(
latitude
,
longitude
,
height
,
width
,
min_lat
,
max_lat
,
min_lon
,
max_lon
)
x_lower_bound
=
max
(
0
,
x_coord
-
node_size
)
x_upper_bound
=
min
(
height
-
1
,
x_coord
+
node_size
)
@@ -249,4 +246,7 @@ class AISTrajectory(AISPoints):
for
x
in
range
(
x_lower_bound
,
x_upper_bound
+
1
):
for
y
in
range
(
y_lower_bound
,
y_upper_bound
+
1
):
data
[
x
,
y
]
=
[
1
]
if
link
:
raise
ValueError
(
"
feature not implemented
"
)
return
data
Loading