Skip to content

Commit

Permalink
Merge pull request #102 from nathangeology/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
JustinGOSSES authored Jun 17, 2020
2 parents df65ed6 + 2696d64 commit ed2cd6e
Show file tree
Hide file tree
Showing 42 changed files with 9,502 additions and 1,524 deletions.
20 changes: 20 additions & 0 deletions dist/base_template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class BaseTemplate {
constructor(params={}) {
this.handle_params(params)
}

handle_params(params) {
for (const [key, value] in Object.entries(params)){
this[key] = value
}
return this
}

start_draw(div_id){
let d3 = module.exports.d3;
let noDIV = d3.select("#" + div_id).selectAll("div").remove();
let noSVG = d3.select("#" + div_id).selectAll("svg").remove();
return d3
}
}
module.exports = BaseTemplate
Empty file added dist/curve_alias/curve_alias.js
Empty file.
15 changes: 15 additions & 0 deletions dist/fill_templates/curve_fill_template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const BaseTemplate = require("../base_template")

class CurveFillTemplate extends BaseTemplate{
constructor(params={}) {
super();
this.curve_name = "default"
this.fill = "no"
this.fill_direction = "left"
this.cutoffs = Array(0) // TODO should take values OR curve names
this.fill_colors = Array(0)
//Update template based on passed params
this.handle_params(params)
}
}
module.exports = CurveFillTemplate
12 changes: 11 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,17 @@
* @returns {obj} It returns the d3.js object and all its functions as a module.
*/
d3: require("d3"),

TrackTemplate: require('./log_style_templates/log_curve_template'),
WellLogTemplate: require('./well_log_templates/well_log_template'),
WellSectionTemplate: require('./well_section_templates/well_section_templates'),
CurveFillTemplate: require('./fill_templates/curve_fill_template'),
LogCurveTemplate: require('./log_style_templates/log_curve_template'),
TripleCombo: require("./well_log_templates/triple_combo_template"),
BaseTemplate: require("./base_template"),
CaliperGRTrack: require("./track_templates/CaliperGR_track"),
GR: require("./log_style_templates/GR"),
CAL: require("./log_style_templates/CAL"),
DefaultSubTrack: require("./track_templates/default_sub_track"),
/**
* A function that directs users to the docs if they need help.
* @returns {string} It says = I'm really no help. Please check out the docs at https://justingosses.github.io/wellioviz/ or the main README.md at https://github.com/JustinGOSSES/wellioviz. \n If you would like to know what wellioviz does, try wellioviz.define(). \n If you would like to see an example template, try wellioviz.curveBoxTemplateExamples('example') \n If you would like to see an example template defintions, try wellioviz.curveBoxTemplateExamples('definitions') Best of luck.
Expand Down
12 changes: 12 additions & 0 deletions dist/log_style_templates/CAL.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const LogCurveTemplate = require("./log_curve_template")

class CAL extends LogCurveTemplate {
constructor(params={}) {
super(params);
this.curve_name = "CAL"
this.units = "cm"
this.stroke_type = "dash" // TODO Warning! This might not be a thing haha
this.handle_params(params)
}
}
module.exports = CAL
12 changes: 12 additions & 0 deletions dist/log_style_templates/GR.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const LogCurveTemplate = require("./log_curve_template")

class GR extends LogCurveTemplate {
constructor(params={}) {
super(params);
this.curve_name = "GR"
// this.fill = null // TODO: GR Fill
this.units = "API"
this.handle_params(params)
}
}
module.exports = GR
50 changes: 50 additions & 0 deletions dist/log_style_templates/log_curve_template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Base sort of abstract template, specialized templates can override pieces of this
const fill_template = require('../fill_templates/curve_fill_template');
const BaseTemplate = require("../base_template")

class LogCurveTemplate extends BaseTemplate {
// const obj = {}
// Define Default Settings Values
constructor(params={}) {
super();
this.curve_name = "default"
this.color = "black"
this.stroke_type = "solid"
this.stroke_linecap = "butt"
this.stroke_width = 1.0
this.stroke_transparency = 1.0
this.fill = new fill_template()
this.units = "unkn"
this.depth_limits = {"min": "autocalculate", "max": "autocalculate"}
this.curve_limits = {"min": -100000, "max":3} // TODO: This needs to be looked at more
this.data = Array(0)
this.data_id = ""
this.well_name = "default"
this.uwi14 = "00000000000000"
this.isLinear = true // false sets to a log scale
this.depth_type = "MD"
this.depth_units = "meter"
// Define Template Functions
// TODO: decide if null are handled here or at load validation
//Update template based on passed params
this.handle_params(params)
}
// Simple function to set the data that is associated with this curve
define_data(data) {
// Add data to a template
// TODO: Validation step here??
this.data = data
return this
}
// Function change the target curve name and data for the instance of curve template
set_curve_and_data(curve_name, data, params={}){
this.define_data(data)
this.curve_name = curve_name
//Update template based on passed params
this.handle_params(params)
return this
}

}

module.exports = LogCurveTemplate;
17 changes: 17 additions & 0 deletions dist/main_funcs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// let wellio = require('wellio')
// let TripleCombo = require("./well_log_templates/triple_combo_template")

async function plot_triple_combo_log(div_id, url="./static/00-01-11-082-23W4-0.LAS") {
let ShaleSiltCutOff = 80
let SiltSandCutOff = 55
// var fileUrltoWellLog = "https://gist.githubusercontent.com/JustinGOSSES/2685e588d5c2f2a0ba1591ec7b9c9421/raw/415fe8a2f27dc7621f06f60ffd40a62c0d55a0f0/00-01-01-095-19W4-0.las"
var fetched = await fetch(url)
var well_as_string = await fetched.text()
var well = las2json(well_as_string)
// let depth_curve_name = well['CURVE INFORMATION BLOCK']
var test = new TrackTemplate()
var log = new TripleCombo()
log.load_log(well)
console.log('here')

}
5 changes: 5 additions & 0 deletions dist/test/curve_fill_template.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const fill_template = require('../fill_templates/curve_fill_template');

test('default fill curve template curve_name is a property', () => {
expect(new fill_template()).toHaveProperty("curve_name")
})
File renamed without changes.
28 changes: 28 additions & 0 deletions dist/test/log_templates.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const log_curve_template = require('../log_style_templates/log_curve_template');
let test_curve_data_1 = [
{'Depth': 0.0, 'Default': 1.0},
{'Depth': 1.0, 'Default': 0.0},
{'Depth': 2.0, 'Default': 1.0},
{'Depth': 4.0, 'Default': 2.0},
]

let test_curve_data_2 = [
{'Depth': 1.0, 'RHOB': 1.0},
{'Depth': 2.0, 'RHOB': 0.0},
{'Depth': 3.0, 'RHOB': 1.0},
{'Depth': 4.0, 'RHOB': 2.0},
]

test('default log curve template name is a property', () => {
expect(new log_curve_template()).toHaveProperty("curve_name")
})


test('test define data function', () => {
expect(new log_curve_template().define_data(test_curve_data_1).data[0]['Depth']).toBeLessThan(0.5)
})

test('test define curve and data function', () => {
expect(new log_curve_template().set_curve_and_data(
'RHOB', test_curve_data_2).data[0]['Depth']).toBeGreaterThan(0.5)
})
Loading

0 comments on commit ed2cd6e

Please sign in to comment.