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
8babe978
Commit
8babe978
authored
5 years ago
by
Cain, Payton David
Browse files
Options
Downloads
Patches
Plain Diff
Make Calculation pydantic BaseModel
parent
7b4aa150
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
+11
-25
11 additions, 25 deletions
geomagio/residual/Calculation.py
with
11 additions
and
25 deletions
geomagio/residual/Calculation.py
+
11
−
25
View file @
8babe978
...
...
@@ -3,9 +3,10 @@ from .Ordinate import Ordinate
from
.Absolute
import
Absolute
from
.Angle
import
to_dms
from
.MeasurementType
import
MeasurementType
as
mt
from
pydantic
import
BaseModel
class
Calculate
(
object
):
class
Calculate
(
BaseModel
):
"""
Class object for performing calculations.
Contains the following:
...
...
@@ -17,23 +18,13 @@ class Calculate(object):
shift: Degree shift in inclination measurements.
"""
def
__init__
(
self
,
angle
:
float
=
None
,
residual
:
float
=
None
,
ordinate
:
Ordinate
=
None
,
f
:
float
=
None
,
ud
:
int
=
None
,
shift
:
int
=
None
,
pm
:
int
=
None
,
):
self
.
angle
=
angle
self
.
residual
=
residual
self
.
ordinate
=
ordinate
self
.
f
=
f
self
.
ud
=
ud
self
.
shift
=
shift
self
.
pm
=
pm
angle
:
float
=
None
residual
:
float
=
None
ordinate
:
Ordinate
=
None
f
:
float
=
None
ud
:
int
=
None
pm
:
int
=
None
shift
:
int
=
None
def
calculate
(
Reading
):
...
...
@@ -66,12 +57,7 @@ def calculate(Reading):
# calculate scale value
scale_ordinates
=
Reading
.
ordinate_index
()[
"
NorthDownScale
"
]
scale_measurements
=
Reading
.
measurement_index
()[
"
NorthDownScale
"
]
scale
=
calculate_scale
(
f
,
scale_ordinates
,
scale_measurements
,
inclination
,
)
scale
=
calculate_scale
(
f
,
scale_ordinates
,
scale_measurements
,
inclination
,)
# calculate declination absolute and baseline
Db
,
Dabs
=
calculate_D
(
Reading
.
ordinate_index
(),
...
...
@@ -233,7 +219,7 @@ def calculate_D(ordinates_index, measurements, measurements_index, AZ, Hb):
measurements
=
[
westdown
,
westup
,
eastdown
,
eastup
]
# average meridian terms calculated from each declination measurements
meridian
=
np
.
average
([
calculate_meridian_term
(
i
,
Hb
)
for
i
in
measurements
])
# add subtract average mark angle from average meridian angle and add
# add subtract average mark angle from average meridian angle and add
# azimuth(in geon) to get the declination baseline
D_b
=
(
meridian
-
average_mark
)
+
AZ
# convert decimal baseline into dms baseline
...
...
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