Skip to content

Formation tops in another application

This recipe reads formation tops and writes them as CSV for another application (a spreadsheet, a petrophysics package, your own tool). client is an ophiolite.Client for your project — see Build on Ophiolite for a key and the SDK.

tops_asset = next(a for a in client.assets() if a["name"] == "Formation tops")
tops = client.read_data(tops_asset["asset_id"], tops_asset["revision"])
tops.to_frame().to_csv("tops.csv", index=False)
print(open("tops.csv").read())

tops.csv has one row per top: name, md (measured depth), tvd (true vertical depth, empty when the source did not give it) and source. Depth units and the depth reference are the source’s declarations (tops.context); nothing is converted. Keep tops_asset["revision"] with the file if the other application needs to know exactly which version it received.