From f7ce7a090567ee88c42437eab5910814a70637bb Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Wed, 22 Apr 2020 17:17:07 -0600 Subject: [PATCH] Add precision to minutes conversion --- geomagio/residual/Calculation.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/geomagio/residual/Calculation.py b/geomagio/residual/Calculation.py index 5fa11645a..937429dd8 100644 --- a/geomagio/residual/Calculation.py +++ b/geomagio/residual/Calculation.py @@ -207,10 +207,8 @@ def calculate_D(ordinates_index, measurements, measurements_index, metadata, h_b # azimuth(in geon) to get the declination baseline D_b = (meridian - average_mark) + azimuth d_b = round(D_b * 54, 2) - # convert baseline into dms - d_b_dms = int(d_b / 60) * 100 + (d_b / 60) % 1 * 60 # convert baseline into decimal degrees - d_b_dec = from_dms(degrees=int(d_b_dms / 100), minutes=float(str(d_b_dms)[2::])) + d_b_dec = from_dms(minutes=d_b) # gather first declination measurements' H ans E ordinates wd_E_1 = ordinates_index[mt.WEST_DOWN][0].e wd_H_1 = ordinates_index[mt.WEST_DOWN][0].h @@ -372,10 +370,11 @@ def convert_to_geon(angle, precision="DMS"): Convert angles from measurements to geon """ degrees = int(angle) - minutes = int((angle % 1) * 100) / 60 if precision == "DMS": + minutes = int((angle % 1) * 100) / 60 seconds = ((angle * 100) % 1) / 36 else: + minutes = (angle % 1) * 100 / 60 seconds = 0 dms = (degrees + minutes + seconds) / 0.9 -- GitLab