Public
Edited
Jun 24, 2024
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
d3 = require("https://d3js.org/d3.v5.min.js")
Insert cell
Insert cell
wellio = require("wellio")
Insert cell
Insert cell
wellioviz = require('https://bundle.run/wellioviz@0.0.32')
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
fetched = await fetch(fileUrltoWellLog)
Insert cell
well_as_string = await fetched.text()
Insert cell
Insert cell
Insert cell
well_json_01_01_095_19W4 = wellio.las2json(well_as_string)
Insert cell
Insert cell
well_log_json =
d3.json("https://cdn.rawgit.com/JustinGOSSES/c643e25774aea39556799cc517654d46/raw/db70839e481551dcbadb509fb75c68e3c099de71/00_01-01-073-05W5_0.json")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
depth_curve_name = "DEPTH"
Insert cell
three_things_2 = wellioviz.fromJSONofWEllGetThingsForPlotting(well_log_json,depth_curve_name)
Insert cell
wellioviz.fromJSONofWEllGetThingsForPlotting
Insert cell
Insert cell
Insert cell
Insert cell
well_log_curves_reformatted_for_d3_2 = three_things_2["well_log_curves_reformatted_for_d3"]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
example_template = wellioviz.curveBoxTemplateExamples("example")
Insert cell
Insert cell
Insert cell
gr_plot_template_noFill = wellioviz.minimumDataIntoTemplateFunc(example_template,well_log_curves_reformatted_for_d3_2,[uwi2],["GR"],["black"],[""],[
{"curve_name":"GR","fill":"no","fill_direction":"left","cutoffs":[0,ShaleSiltCutOff,SiltSandCutOff],"fill_colors":["gray","orange","yellow"],"curve2":""}],"well_holder_1A",200,400,"DEPTH")
Insert cell
resd_plot_template_1 = wellioviz.minimumDataIntoTemplateFunc(example_template,well_log_curves_reformatted_for_d3_2,[uwi2],['RESD'],["RED"],[""],[[
{"curve_name":"RESD","fill":"yes","fill_direction":"left","cutoffs":[0,4,25],"fill_colors":["#ffe6e6","#ffb3b3","red"],"curve2":""}]],"well_holder_1B",200,400,"DEPTH")
Insert cell
poro_plot_template_1 = wellioviz.minimumDataIntoTemplateFunc(example_template,well_log_curves_reformatted_for_d3_2,[uwi2],["PHID","PHIN"],["purple","pink"],[""],[{
"curve_name":"PHID",
"fill":"yes",
"fill_direction":"between",
"cutoffs":[0],
"fill_colors":["lightblue"],
"curve2":"PHIN"
},
{
"curve_name":"PHID",
"fill":"no",
"fill_direction":"left",
"cutoffs":[],
"fill_colors":[],
"curve2":""
}
],"well_holder_1C",200,400,"DEPTH")
Insert cell
gr_plot_template_1 = wellioviz.minimumDataIntoTemplateFunc(example_template,well_log_curves_reformatted_for_d3_2,[uwi2],["GR"],["black"],[""],[
{"curve_name":"GR","fill":"yes","fill_direction":"left","cutoffs":[0,ShaleSiltCutOff,SiltSandCutOff],"fill_colors":["gray","orange","yellow"],"curve2":""}],"well_holder_1A",200,400,"DEPTH")
Insert cell
Insert cell
Insert cell
Insert cell
result_1 = wellioviz.multipleLogPlot("well_holder",[gr_plot_template_noFill,gr_plot_template_1,resd_plot_template_1,poro_plot_template_1])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
logs2 = [await FileAttachment("00-11-18-079-03W5-0.LAS").text(),await FileAttachment("00-06-02-076-15W4-0.LAS").text(), await FileAttachment("00-11-22-068-14W4-0.LAS").text(),await FileAttachment("00-16-13-071-01W4-0.LAS").text(), await FileAttachment("00-10-35-081-15W4-0.LAS").text(),await FileAttachment("00-06-26-075-21W4-0.LAS").text()]
Insert cell
Insert cell
Insert cell
function fileToJSON(afile) {
return wellio.las2json(afile)
}
Insert cell
function turnFilesIntoTextIntoWellioJSON(files_array){
//// For each well log file, turn into text, then convert text into wellio style JSON using wellio.js
let logs_in_json = []
for (let i = 0; i < files_array.length; i++) {
logs_in_json.push(fileToJSON(files_array[i]))
}
return logs_in_json
}
Insert cell
Insert cell
Insert cell
Insert cell
result1 = wellioviz.putArrayOfLogsIntoSection(logs2b,"div_id_result1",example_template,"GR","black","",
{"curve_name":"GR","fill":"yes","fill_direction":"left","cutoffs":[0,ShaleSiltCutOff,SiltSandCutOff],"fill_colors":["gray","orange","yellow"],"curve2":""},"DEPT",140,400)
Insert cell
result2 = wellioviz.putArrayOfLogsIntoSection(logs2b,div_id2,example_template,"GR","black","",
{"curve_name":"GR","fill":"yes","fill_direction":"left","cutoffs":[0,ShaleSiltCutOff,SiltSandCutOff],"fill_colors":["gray","orange","yellow"],"curve2":""},"DEPT",140,400)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
input_sparse_style = [{
"single_curve_box_or_cross_section":"single",
"cross_section_title":"",
"width": 1040, /// not skippable, check if number // default if blank or missing =250 or autocalculate?
"height": 500, /// not skippable, check if number // default if blank or missing=500
////////////////////////////
"curve_boxes":[{
"curve_box":{
"show_well_name":"yes", // not built yet /// Should be skip-able /// default=No
"show_depth_type":"no", // not built yet /// Should be skip-able /// default=No
"show_curve_units":"yes", // not built yet /// Should be skip-able /// default=No
"curve_box_depth_min":-999, // not built yet /// Should be skip-able /// default=skip func if string or -999
"curve_box_depth_max":-999, // not built yet /// Should be skip-able /// default=skip func if string or -999
"take_out_null_or_visualize":"no", // not built yet /// Should be skip-able /// default=No
"show_title":"no", // not built into plotting template yet /// Should be skip-able /// default=No
"width": 260, /// not skippable, check if number // default if blank or missing =250
"height": 500, /// not skippable, check if number // default if blank or missing=500
"height_multiplier_components":3, // default if missing is 0.95
"margin": {"top": 50, "right": 10, "bottom": 30, "left": 60}, /// not skippable, check if number // defaults used if blank, string, or missing. If string or blank, add message to error message to console stating what default was used.
"title": {"text": "", "title_font_size": "10px"}, /// Should be skip-able // default=skip
"div_id": "well_holder4", /// Should be skip-able // default=random str? What happens if div doesn't exist?
"order_of_component":["curves","rectangles","lines"], // not built yet, default is curve, then line, then rectangle
"lines_connected_across_curve_boxes":"no", // not built yet, default is skip function
"header_sep_svg_or_not":"yes",
"svg_header_height":"4em",
"gridlines":"yes",
"gridlines_color":'#D3D3D3',
"gridlines_stroke_width":0.20,
"grouped_or_independent_x_scales":"independent",
//// variables for how to draw mouseover of hover box
"mouseover_yes_or_no":"yes", //// "yes" or "no"
"mouseover_depth_or_depth_and_curve":"depth_and_curve", /// options= "depth_and_curve", "depth", or "curve"
"mouseover_curvename":"default", //// default is first curve
"mouseover_color_or_default_which_is_curve_color":"default" /// default is default, which then uses curve color or black
},
"components":[{
"curves":[
{
"data_type":"curve", // not built yet /// requires one of possible strings: curve, line, rectangle if not one of acceptable string it just skips it.
"data_id":"placeholder_data_id", // not built yet /// can be anything, just used for tracking & is optional
"well_name": "", // not built yet /// Ideally string. Will skip function if ""
"curve_type": "RHOB", // should be string. name of curve
"curve_values": [
2.2322, 2.2513, 2.2548, 2.2445, 2.2223, 2.2047, 2.198, 2.2088, 2.2248, 2.2399, 2.251, 2.255, 2.2526,2.2322, 2.2513, 2.2548, 2.2445, 2.2223, 2.2047, 2.198, 2.2088, 2.2248, 2.2399, 2.251, 2.255, 2.2526,2.2322, 2.2513, 2.2548, 2.2445, 2.2223, 2.2047, 2.198, 2.2088, 2.2248, 2.2399, 2.251, 2.255, 2.2526,2.2322, 2.2513, 2.2548, 2.2445, 2.2223, 2.2047, 2.198, 2.2088, 2.2248, 2.2399, 2.251, 2.255, 2.2526,2.2322, 2.2513, 2.2548, 2.2445, 2.2223, 2.2047, 2.198, 2.2088, 2.2248, 2.2399, 2.251, 2.255, 2.2526,2.2322, 2.2513, 2.2548, 2.2445, 2.2223, 2.2047, 2.198, 2.2088, 2.2248, 2.2399, 2.251, 2.255, 2.2526,2.2322, 2.2513, 2.2548, 2.2445, 2.2223, 2.2047, 2.198, 2.2088, 2.2248, 2.2399, 2.251, 2.255, 2.2526], /// Should be array. If not array, return error message?
"step": 0.1, /// Should be number. If not array, return error message?
"units": "g/cc", /// should be string but try to plot whatever as string. if greater than X length include error message in console about excessive length will look bad but still plot.
"scale_linear_log_or_yours": "linear",
////// Plotting things but need to be next to curve data or will be too confusing.
"line_color": "rgb(205,0,0,1)", /// Test for string, if string use. If not string "black"
"curve_stroke_dasharray":"5,5",
"stroke_linecap":"butt",
"stroke_width":0.5,
"fill":{"curve_name":"RHOB","fill":"yes","fill_direction":"left","cutoffs":[0.21,2.23,2.24],"fill_colors":["gray","beige","white"],"curve2":""},
"data_ID":"",
"max_depth": "1607.3", /// should be number, if not number or doens't exit then "autocalculate"
"min_depth": "1598.3", /// should be number, if not number or doens't exit then "autocalculate"
"depth_type_string":"TVDSS", /// should be string, if not or doesn't exist, then skip func
"depth_units_string":"md",
"depth_curve_name":"DEPTH", /// should be string, ideally all depth curve names are the same
"null_value": "", // not built yet, can be anything. Skip if blank or "" or "unknown". If not skip, then look for any values that match after d3 style data object is generated and either take them out or give special value based on behavior defined for curvebox in key "take_out_null_or_visualize" above.
"x_max": 3, // not built yet /// should be number /// auto-calculate if not number or is "autocalculate"
"x_min": 2, // not built yet /// should be number /// auto-calculate if not number or is "autocalculate"
}
],
"lines":[
{
"data_type":"line", /// must be string, will be ignored if not "line", "curve", or "rectangle".
"label":"top 1", /// Ideally a string.
"depth":1601.4, /// Should be Float or integer, attempt to convert to number if string. Otherwise skip this part entirely!
"color":"blue", /// should be string, if not or doesn't exist use "black"
"stroke_width":"3px", /// should be string, if not or doesn't exist use "1px"
"stroke_linecap":"butt",
"stroke_style":"solid", /// should be string, if not or doesn't exist use "solid"
"transparency":1.0 /// should be number between 0 and 1, if not or doesn't exist use 1.
},
{
"data_type":"line", /// must be string, will be ignored if not "line", "curve", or "rectangle".
"label":"top 2", /// Ideally a string.
"depth":1602.4, /// Should be Float or integer, attempt to convert to number if string. Otherwise skip this part entirely!
"color":"orange", /// should be string, if not or doesn't exist use "black"
"stroke_width":"5px", /// should be string, if not or doesn't exist use "1px"
"stroke_linecap":"butt",
"stroke_style":"solid", /// should be string, if not or doesn't exist use "solid"
"transparency":0.5 /// should be number between 0 and 1, if not or doesn't exist use 1.
}
],
"rectangles":[
{
"data_type":"rectangle",
"depth_top":1601,
"x_starting_upper_left_corner":0,
"width":100,
"height":100,
"stroke_width":"2px",
"stroke_linecap":"butt",
"fill":"red",
"opacity":0.5,
"label":"Core Example", // not built into plotting template yet
"label_orientation":"horizontal", // not built into plotting template yet
"lable_position":"right" // not built into plotting template yet
}
]
}]
}]
}]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
wellioviz.curveBoxTemplateExamples("help")
Insert cell
wellioviz.curveBoxTemplateExamples("example")
Insert cell
wellioviz.curveBoxTemplateExamples("defintions")
Insert cell
wellioviz.curveBoxTemplateExamples("mandatories")
Insert cell
input_sparse_style[0]["curve_boxes"][0]["curve_box"]["margin"]["left"] = 90
Insert cell
template_example = wellioviz.curveBoxTemplateExamples("example")
Insert cell
wellioviz
Insert cell
template_for_plotting = wellioviz.putIncomingSparseJsonIntoPlottingTemplate(input_sparse_style ,template_example)
Insert cell
template_for_plotting[0]["curve_box"]["margin"]["top"] = 10
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
wellioviz.makeThisCurveBox(template_for_plotting)
Insert cell
html `<div id="well_holder4" style="width:300px;height:600px;display:block;text-align:center;position:relative"></>`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
wellioviz.saveSvg
Insert cell
//// uncomment this line and push the arrow button on right to download a saved SVG
//saveSvg(plot_RHOB_Test, "test2.svg")
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more