Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jr
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
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
Jiří Kalvoda
jr
Commits
19df1979
Commit
19df1979
authored
11 months ago
by
Jiří Kalvoda
Browse files
Options
Downloads
Patches
Plain Diff
Explanation of magic constants
parent
589ecaa5
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
prog/data_utils.py
+6
-2
6 additions, 2 deletions
prog/data_utils.py
with
6 additions
and
2 deletions
prog/data_utils.py
+
6
−
2
View file @
19df1979
...
...
@@ -28,9 +28,14 @@ def dist(a, b):
assert
40
<
a
[
0
]
and
a
[
0
]
<
60
,
a
[
0
]
assert
5
<
a
[
1
]
and
a
[
1
]
<
25
,
a
[
1
]
assert
40
<
b
[
0
]
and
b
[
0
]
<
60
,
b
[
0
]
assert
5
<
b
[
1
]
and
b
[
1
]
<
25
,
b
[
1
]
assert
5
<
b
[
1
]
and
b
[
1
]
<
25
,
b
[
1
]
# Check that we are somewhere near Prague
# lat lon
return
math
.
sqrt
(((
a
[
0
]
-
b
[
0
])
*
111.2
)
**
2
+
((
a
[
1
]
-
b
[
1
])
*
71.50
)
**
2
)
# ... and then use distance approximation based on length of one degree there.
lon_muntiplicator
=
71.50
/
111.2
# This is magic constant for approximation globe to plane working near Prague.
# If lon is multiplied with this constant, one unit of lat and multiplied lon will have approximately the same distance
def
shape_indexer
(
shape
,
i
:
float
):
ii
=
int
(
i
)
...
...
@@ -40,7 +45,6 @@ def shape_indexer(shape, i: float):
return
shape
[
ii
]
*
(
1
-
rest
)
+
shape
[
ii
+
1
]
*
rest
lon_muntiplicator
=
71.50
/
111.2
async
def
get_data_of_trip
(
trip_id
,
date_from
,
date_to
):
c
=
await
get_communication
()
dts
=
await
c
.
list_realtime_data
(
date_from
,
date_to
)
...
...
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