Skip to content

Commit

Permalink
Added function to quickly generate a of a survey.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnymaserati committed Dec 17, 2023
1 parent a62fa19 commit 731e3be
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions welleng/survey.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
import math
import pandas as pd
from copy import copy
try:
from magnetic_field_calculator import MagneticFieldCalculator
Expand Down Expand Up @@ -2025,6 +2026,29 @@ def make_survey_header(data):
# export_csv(survey, filename)


def survey_to_df(survey: Survey) -> pd.DataFrame:
data = {
'MD (m)': survey.md,
'INC (deg)': survey.inc_deg,
'AZI_GN (deg)': survey.azi_grid_deg,
'AZI_TN (deg)': survey.azi_true_deg,
'NORTHING (m)': survey.pos_nev[:, 0],
'EASTING (m)': survey.pos_nev[:, 1],
'TVDSS (m)': survey.pos_nev[:, 2],
'X (m)': survey.pos_xyz[:, 0],
'Y (m)': survey.pos_xyz[:, 1],
'Z (m)': survey.pos_xyz[:, 2],
'DLS (deg/30m)': survey.dls,
'TOOLFACE (deg)': np.degrees(survey.toolface + 2 * np.pi) % 360,
'BUILD RATE (deg)': np.nan_to_num(survey.build_rate, nan=0.0),
'TURN RATE (deg)': np.nan_to_num(survey.turn_rate, nan=0.0)
}

df = pd.DataFrame(data)

return df


def export_csv(
survey, filename, tolerance=0.1, dls_cont=False, decimals=3, **kwargs
):
Expand Down

0 comments on commit 731e3be

Please sign in to comment.