Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
geomag-algorithms
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
ghsc
National Geomagnetism Program
geomag-algorithms
Commits
61d60b5e
Commit
61d60b5e
authored
1 year ago
by
Wernle, Alexandra Nicole
Browse files
Options
Downloads
Patches
Plain Diff
Slight reformatting to residual_test.py
parent
3943856a
No related branches found
No related tags found
1 merge request
!213
Removed valid requirements, added valid as attribute to Absolutes, added features to handle spreadsheets that do not have 4 sets"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/residual_test/residual_test.py
+32
-14
32 additions, 14 deletions
test/residual_test/residual_test.py
with
32 additions
and
14 deletions
test/residual_test/residual_test.py
+
32
−
14
View file @
61d60b5e
...
...
@@ -55,15 +55,21 @@ def get_json_readings(filename: str):
return
readings
def
get_spreadsheet_absolutes
(
path
):
def
get_spreadsheet_absolutes
(
observatory
:
str
,
starttime
:
UTCDateTime
,
endtime
:
UTCDateTime
,
path
):
"""
Tests functionality of SpreadsheetAbsolutesFactory and recalculation of absolutes
"""
# establish SpreadsheetAbsolutesFactory for reading test data from Excel
saf
=
SpreadsheetAbsolutesFactory
()
saf
=
SpreadsheetAbsolutesFactory
(
base_directory
=
path
)
# Read spreadsheet containing test data
reading
=
saf
.
parse_spreadsheet
(
path
=
path
)
return
reading
readings
=
saf
.
get_readings
(
observatory
=
observatory
,
starttime
=
UTCDateTime
(
starttime
),
endtime
=
UTCDateTime
(
endtime
),
)
return
readings
def
get_spreadsheet_directory_readings
(
path
,
observatory
,
starttime
,
endtime
):
...
...
@@ -100,11 +106,17 @@ def test_DED_20140952332():
Tests calculations for measurements in units of DMS.
"""
# gather absolute from DED test data and recalculate
reading
=
get_spreadsheet_absolutes
(
path
=
"
etc/residual/DED-20140952332.xlsm
"
)
# test results with original spreadsheet values
assert_readings_equal
(
expected
=
reading
,
actual
=
calculate
(
reading
=
reading
),
decimal
=
2
readings
=
get_spreadsheet_absolutes
(
observatory
=
"
DED
"
,
starttime
=
"
2014-01-01
"
,
endtime
=
"
2014-05-01
"
,
path
=
"
etc/residual/DED-20140952332.xlsm
"
,
)
# test results with original spreadsheet values
for
reading
in
readings
:
assert_readings_equal
(
expected
=
reading
,
actual
=
calculate
(
reading
=
reading
),
decimal
=
2
)
def
test_BRW_20133650000
():
...
...
@@ -114,13 +126,19 @@ def test_BRW_20133650000():
Tests calculations for measurements in units of DM.
"""
# gather absolute from DED test data and recalculate
reading
=
get_spreadsheet_absolutes
(
path
=
"
etc/residual/BRW-20133650000.xlsm
"
)
# test results with original spreadsheet values
assert_readings_equal
(
expected
=
reading
,
actual
=
calculate
(
reading
=
reading
),
decimal
=
1
,
# change due to no longer rounding
readings
=
get_spreadsheet_absolutes
(
observatory
=
"
BRW
"
,
starttime
=
"
2013-01-01
"
,
endtime
=
"
2013-12-31
"
,
path
=
"
etc/residual/BRW-20133650000.xlsm
"
,
)
# test results with original spreadsheet values
for
reading
in
readings
:
assert_readings_equal
(
expected
=
reading
,
actual
=
calculate
(
reading
=
reading
),
decimal
=
1
,
# change due to no longer rounding
)
def
test_BOU_20190702
():
...
...
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