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
Admin message
Maintenance scheduled for Thursday, April 10, from 5 PM to 6 PM ET.
Show more breadcrumbs
ghsc
National Geomagnetism Program
geomag-algorithms
Commits
0b068201
Commit
0b068201
authored
4 years ago
by
Cain, Payton David
Browse files
Options
Downloads
Patches
Plain Diff
Extend null parameter to HZ absolutes
parent
ab33b3a1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
geomagio/residual/Calculation.py
+16
-4
16 additions, 4 deletions
geomagio/residual/Calculation.py
with
16 additions
and
4 deletions
geomagio/residual/Calculation.py
+
16
−
4
View file @
0b068201
...
...
@@ -28,6 +28,12 @@ def calculate(reading: Reading) -> Reading:
new reading object with calculated absolutes and scale_value.
NOTE: rest of reading object is shallow copy.
"""
if
len
(
mt
.
WEST_DOWN
)
==
2
:
null
=
False
else
:
null
=
True
# reference measurement, used to adjust absolutes
reference
=
reading
[
mt
.
WEST_DOWN
][
0
]
# calculate inclination
...
...
@@ -37,7 +43,11 @@ def calculate(reading: Reading) -> Reading:
corrected_f
=
f
+
reading
.
pier_correction
# calculate absolutes
absoluteH
,
absoluteZ
=
calculate_HZ_absolutes
(
corrected_f
=
corrected_f
,
inclination
=
inclination
,
mean
=
mean
,
reference
=
reference
corrected_f
=
corrected_f
,
inclination
=
inclination
,
mean
=
mean
,
reference
=
reference
,
null
=
null
,
)
absoluteD
=
calculate_D_absolute
(
azimuth
=
reading
.
azimuth
,
...
...
@@ -46,7 +56,7 @@ def calculate(reading: Reading) -> Reading:
reference
=
reference
,
)
# calculate scale
if
len
(
reading
[
mt
.
NORTH_DOWN_SCALE
])
>
0
:
if
null
==
False
:
scale_value
=
calculate_scale_value
(
corrected_f
=
corrected_f
,
inclination
=
inclination
,
...
...
@@ -123,6 +133,7 @@ def calculate_HZ_absolutes(
corrected_f
:
float
,
mean
:
AverageMeasurement
,
reference
:
Measurement
,
null
:
bool
,
)
->
Tuple
[
Absolute
,
Absolute
]:
"""
Calculate H and Z absolutes.
...
...
@@ -145,8 +156,9 @@ def calculate_HZ_absolutes(
h_b
=
round
(
np
.
sqrt
(
h_abs
**
2
-
mean
.
e
**
2
)
-
mean
.
h
,
1
)
z_b
=
round
(
z_abs
-
mean
.
z
,
1
)
# adjust absolutes to reference measurement
h_abs
=
np
.
sqrt
((
h_b
+
reference
.
h
)
**
2
+
(
reference
.
e
)
**
2
)
z_abs
=
z_b
+
reference
.
z
if
null
==
False
:
h_abs
=
np
.
sqrt
((
h_b
+
reference
.
h
)
**
2
+
(
reference
.
e
)
**
2
)
z_abs
=
z_b
+
reference
.
z
# return absolutes
return
(
Absolute
(
...
...
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