jonnymaserati / welleng

A collection of Wells/Drilling Engineering tools, focused on well trajectory planning for the time being.
Apache License 2.0
113 stars 31 forks source link

Update survey output #182

Closed jonnymaserati closed 1 month ago

jonnymaserati commented 3 months ago

The current survey listing output could be updated to be a bit more thorough, useful:

def survey_to_df(survey):
    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

The following code can be used to output a list of surveys to separate sheets in an Excel file:

dfs = [
    survey_to_df(survey) for survey in [
        survey_pilot, survey_horizontal
    ]
]

well_name = 'prospect_1'
filename_excel = f'{datetime.strftime(datetime.now(), "%Y%m%d%H%M%S")}_{well_name}'

with pd.ExcelWriter(f'{filename_excel}.xlsx') as writer:
    dfs[0].to_excel(writer, sheet_name="pilot", index=False)
    dfs[1].to_excel(writer, sheet_name="horizontal", index=False)
jonnymaserati commented 1 month ago

Closed with #188