Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lemi2seed
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Software Public
MT
lemi2seed
Commits
bc95bbbe
Commit
bc95bbbe
authored
3 years ago
by
Maeva Pourpoint
Browse files
Options
Downloads
Patches
Plain Diff
Move if statement in convert_coordinate() to avoid unnecessary division operation
parent
5e8cfbe4
No related branches found
Branches containing commit
No related tags found
1 merge request
!3
Util functions
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lemi2seed/utils.py
+4
-4
4 additions, 4 deletions
lemi2seed/utils.py
with
4 additions
and
4 deletions
lemi2seed/utils.py
+
4
−
4
View file @
bc95bbbe
...
...
@@ -101,16 +101,16 @@ def check_serial_number(serial_number: str, equipment: str) -> bool:
def
convert_coordinate
(
coordinate
,
hemisphere
):
"""
Convert coordinates outputted by LEMI to decimal degrees.
"""
if
hemisphere
not
in
[
'
N
'
,
'
S
'
,
'
E
'
,
'
W
'
]:
logger
.
error
(
"
Unexpected hemisphere - {} - listed in data file!
"
.
format
(
hemisphere
))
return
None
try
:
coordinate
=
float
(
coordinate
)
/
100
except
ValueError
:
logger
.
error
(
"
Failed to convert geographic coordinate - {} - to
"
"
decimal degrees!
"
.
format
(
coordinate
))
return
None
if
hemisphere
not
in
[
'
N
'
,
'
S
'
,
'
E
'
,
'
W
'
]:
logger
.
error
(
"
Unexpected hemisphere - {} - listed in data file!
"
.
format
(
hemisphere
))
return
None
return
-
coordinate
if
hemisphere
in
[
"
S
"
,
"
W
"
]
else
coordinate
...
...
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