def xtgeo_well_logs_to_json_format(well: xtgeo.Well) -> List[Dict]: header = generate_header(well_name=well.name) curves = [] # Calculate well geometrics if MD log is not provided if well.mdlogname is None: well.geometrics() # Add MD and TVD curves curves.append(generate_curve(log_name="MD", description="Measured depth")) curves.append( generate_curve(log_name="TVD", description="True vertical depth (SS)")) # Add additonal logs, skipping geometrical logs if calculated lognames = [ logname for logname in well.lognames if logname not in ["Q_MDEPTH", "Q_AZI", "Q_INCL", "R_HLEN"] ] for logname in lognames: curves.append(generate_curve(log_name=logname.upper())) # Filter dataframe to only include relevant logs curve_names = [well.mdlogname, "Z_TVDSS"] + lognames dframe = well.dataframe[curve_names] dframe = dframe.reindex(curve_names, axis=1) return [{ "header": header, "curves": curves, "data": dframe.values.tolist() }]
def get_plotly_zonelog_trace( well: xtgeo.Well, zonelog: str, ) -> List[Dict]: """Zonetops are extracted from a zonelog and plotted as markers""" df = well.dataframe # Find zone transitions df["transitions"] = df[zonelog].diff() logrecord = well.get_logrecord(zonelog) traces = [] for idx in range(0, df.shape[0] - 1): # Use current sample if moving upwards in stratigraphy # Use next sample if moving downwards in stratigraphy if df.iloc[idx + 1]["transitions"] < 0 or df.iloc[idx]["transitions"] > 0: traces.append( { "x": [df.iloc[idx]["R_HLEN"]], "y": [df.iloc[idx]["Z_TVDSS"]], "marker": {"size": 10, "color": "red"}, "showlegend": False, "hoverinfo": "y+name+text", "text": "TVDSS", "hoverlabel": {"namelength": -1}, "name": f"Zonetop: <br>{logrecord[df.iloc[idx][zonelog]]}", } ) return traces
def wrapper(wellstring, **kwargs): """It is currently not possible to initiate from spec. We work around by dumping to csv before reloading """ fpath = "well_data.rmswell" with open(fpath, "w") as fh: fh.write(wellstring) well = Well(fpath, **kwargs) return well
def make_well_layer(well: xtgeo.Well, name: str = "well", zmin: float = 0) -> Dict[str, Any]: """Make LayeredMap well polyline""" well.dataframe = well.dataframe[well.dataframe["Z_TVDSS"] > zmin] positions = well.dataframe[["X_UTME", "Y_UTMN"]].values return { "name": name, "checked": True, "base_layer": False, "data": [{ "type": "polyline", "color": "black", "positions": positions, "tooltip": name, }], }
def make_well_layer(well: xtgeo.Well, name: str = "well", zmin: float = 0) -> Dict[str, Any]: """Make LayeredMap well polyline""" well.dataframe = well.dataframe[well.dataframe["Z_TVDSS"] > zmin] positions = well.dataframe[["X_UTME", "Y_UTMN"]].values return { "name": "Well", "id": "Well", "checked": True, "baseLayer": False, "action": "update", "data": [ { "type": "polyline", "color": "black", "positions": positions, "id": name, "tooltip": name, }, { "type": "circle", "center": positions[0], "radius": 60, "color": "black", "tooltip": "A", }, { "type": "circle", "center": positions[-1], "radius": 60, "color": "black", "tooltip": "A'", }, ], }
def append_well_to_data( data: List[Dict[str, Any]], well: xtgeo.Well, wellfile: str, surface: str, color: str, ) -> None: with np.errstate(invalid="ignore"): surface_picks = well.get_surface_picks(surface) # get_surface_picks raises warning when MD column is missing in well if surface_picks is not None: surface_picks_df = surface_picks.dataframe coordinates = surface_picks_df[["X_UTME", "Y_UTMN"]].values for coord in coordinates: data.append({ "type": "circle", "center": coord, "color": color, "radius": 100, "tooltip": well.wellname, "id": wellfile, })