Skip to content
Snippets Groups Projects
Commit c9e42218 authored by Cain, Payton David's avatar Cain, Payton David
Browse files

Remove test files, include description of Calculation object

parent 0ce8c6bb
No related branches found
No related tags found
No related merge requests found
File deleted
......@@ -2,8 +2,18 @@ import numpy as np
from .Ordinate import Ordinate
# class object for performing calculations
class Calculate(object):
"""
Class object for performing calculations.
Contains the following:
angle: average angle across a measurement type
residual: average residual across a measurement type
hs: Multiplier for inclination claculations. +1 if measurment was taken in northern hemisphere, -1 if measurement was taken in the southern hemishpere.
ordinate: Variometer data. Ordinate object(contains a datapoint for H, E, Z, and F)
ud: Multiplier for inclination calculations. +1 if instrument is oriented upward, -1 if instrument if oriented downward.
shift: Degree shift in inclination measurements.
"""
def __init__(
self,
angle: float = None,
......@@ -35,7 +45,7 @@ def calculate_I(measurements, ordinates, ordinates_index, total_ordinate, metada
# 1 if observatory is in northern hemisphere
# -1 if observatory is in southern hemisphere
hs = metadata["hemisphere"]
# gather average angles for each measurement type
# gather calculation objects for each measurement type
southdown = process_type(
shift=-180,
inclination=Iprime,
......@@ -118,7 +128,7 @@ def calculate_D(ordinates, measurements, measurements_index, AZ, Hb):
average_mark = np.average(
[m.angle for m in measurements if "mark" in m.measurement_type.capitalize()]
)
# gather average angles for each measurement type
# gather calculation objects for each measurement type
southdown = process_type(
measurements=measurements_index,
ordinates=ordinates,
......@@ -243,6 +253,8 @@ def average_ordinate(ordinates, type):
ordinates = ordinates[type][:-1]
elif type is not None:
ordinates = ordinates[type]
elif type is None:
ordinates = ordinates[:-1]
o = Ordinate(measurement_type=type)
avgs = np.average([[o.h, o.e, o.z, o.f] for o in ordinates], axis=0,)
o.h, o.e, o.z, o.f = avgs
......
import openpyxl
from geomagio.residual import SpreadsheetAbsolutesFactory, Reading
path = "DED-USGS-20140300306.xlsm"
saf = SpreadsheetAbsolutesFactory()
workbook = openpyxl.load_workbook(path, data_only=True)
constants_sheet = workbook["constants"]
measurement_sheet = workbook["measurement"]
summary_sheet = workbook["Summary"]
metadata = saf._parse_metadata(constants_sheet, measurement_sheet, summary_sheet)
include_measurements = True
absolutes = saf._parse_absolutes(summary_sheet, metadata["date"])
measurements = (
include_measurements
and saf._parse_measurements(measurement_sheet, metadata["date"])
or None
)
ordinates = (
include_measurements
and saf._gather_ordinates(measurement_sheet, metadata["date"], metadata["station"])
or None
)
reading = Reading(
absolutes=absolutes,
azimuth=metadata["mark_azimuth"],
hemisphere=metadata["hemisphere"],
measurements=measurements,
metadata=metadata,
pier_correction=metadata["pier_correction"],
ordinates=ordinates,
)
res = reading.calculate()
for i in res[0][:-1]:
print("**************")
print("element", i.element)
print("baseline", i.baseline)
print("absolute", i.absolute)
print("**************")
print("scale", res[1])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment