Skip to content

Your notebook, connected

A notebook that reads a CSV or a LAS file from disk keeps working when it reads from your project instead. You change the one line that reads the file; the cells that compute stay as they are when the project holds the curves they need. At the end, one cell publishes the computed curves as a result that names the exact log version it came from.

Andy McDonald’s Petrophysical Calculations (Petrophysics-Python-Series, notebook 05) reads an interpreted table of a Volve well from disk:

well = pd.read_csv("Data/15_9-19.csv", header=0, skiprows=[1])
well.replace(-999.00, np.nan, inplace=True)

Connected, it reads the longest gamma-ray log you may use (or the log you name) at its exact version, as a DataFrame whose missing samples are already NaN:

from ophiolite.gallery import connect
client = connect()
log = client.find_log(curves=['GR'], name=None)
wanted = [c for c in ('GR', 'RHOB', 'DEN') if c in log['curves']]
well, metadata = client.read(log['asset_id'], log['revision'], wanted).to_frame()

The shale-volume and density-porosity cells after it run unchanged. The publishing cell writes the computed columns with their units and sends them with the method you declare and the exact log version as the one parent:

import uuid
from ophiolite.frames import write_frame
written = write_frame(well[['VSHALE']], {'VSHALE': 'v/v'}, depth_unit=metadata.axis.unit)
receipt = client.publish_derived(written, name='Petrophysical calculations', from_=[(log['asset_id'], log['revision'])],
method={'name': 'Petrophysical calculations', 'parameters': {'vshale': 'GR P01/P99'}},
command_id=uuid.uuid4().hex)

The adapted notebook, with the list of cells it changed or skipped, is in the notebook gallery.

In your notebook todayReading from your project
pd.read_csv(...) of a well logwell, metadata = client.read(asset_id, revision, curves).to_frame()
lasio.read(...)las = ophiolite.lasio.to_lasio(client.read(asset_id, revision, curves))
wp.read_csv(...) of a deviation surveytrajectory = client.read_data(asset_id, revision), then trajectory.stations or trajectory.minimum_curvature()

And back into your project:

You haveSend it with
a DataFrame of computed curvesophiolite.frames.write_frame(frame, units, depth_unit=...) and client.publish_derived(...)
a LASFile you built with lasioophiolite.lasio.lasio_bytes(las) and client.upload_las(...)

find_log finds a log by the curves it carries, a declared quantity or its exact name; it never renames a curve. to_lasio rebuilds a LAS header from the exact version read; the file as it was uploaded is what client.download_original returns. These adapters need pip install 'ophiolite[lasio,pandas]'.