GithubHelp home page GithubHelp logo

justingosses / wellio.js Goto Github PK

View Code? Open in Web Editor NEW
32.0 9.0 5.0 2.97 MB

JavaScript for converting well-log standard .las file format to json format

Home Page: https://justingosses.github.io/wellio.js/

License: MIT License

HTML 0.31% JavaScript 10.06% CSS 0.46% Jupyter Notebook 89.16%
las geology javascript json-parser well-logs geoscience dataunderground athabasca athabasca-preprocessed

wellio.js's Introduction

wellio.js

JavaScript for converting well-log standard .las file format to json format and then back again.

DOI

NPM

Purpose

Wellio.js is a JavaScript library for converting a LAS 2.0 well log file into a wellio style JSON. It was created to enable well logs to be easily visualized on the web.ss

You might be wondering...Why Bother? Geologists Use Python.

Although Python is great for data analysis, and it is the language most learned by geologists, it isn't great for building user interfaces that live on the web. If you want to enable that functionality, you need to get well logs into a format JavaScript visualization libraries can consume and that's JSON.

Further explanation on why create wellio is given in the docs.

Demos

1. Github pages demo page:

Open the demo page running on github pages. Click one of the big blue buttons up top to open a file loader. You can either use a LAS files already part of the webpage or you can load a local LAS file from your computer.

If you want to test the 'load local file' feature and don't have any local LAS files, you can quickly get one by going to this link and saving the results to a ".las" file using your browser. That is a raw las file for well UWI 00-01-01-073-05W5-0.

2. ObservableHQ demo page:

ObservableHQ is new way to explore and play with JavaScript code. Think Jupyter notebook but in a more reactive and interactive form. It runs JavaScript code instead of Python/Julia/R. There's this demo that uses vega to visualize the well log but is limited to horizontal visualization. There's also this demo that uses wellioviz to visualize the well log as people expect it to be visualized in a vertical orientation with shading, etc.

3. Jupyter Notebook Node.js demo

Wellio can also be worked with in a jupyter notebook running a node.js kernal.

Data in the demos

Data for the demos is mostly wells from an open source dataset of the Mannville Group from Alberta Canada. A preprocessed version of this dataset can be found on dataunderground along with many other well dataset.

Documentation

Please find the documentation here: https://justingosses.github.io/wellio.js/docs/

Contents include:

  • PURPOSE
  • USAGE
  • HOW TO INSTALL
  • HOW TO USE ONCE INSTALLED
  • WELLIO-STYLE JSON VS OTHERS
  • HOW TO EDIT DOCUMENTATION
  • FUNCTIONS
  • TESTS

Contributing

There are a variety of issues that need worked. Several of which are suitable for those who are new to JavaScript.

Please add any suggestions you'd like or bugs you find to the issues.

Docs are a great way to make pull request contributions even if you aren't immmersed in the code base yet.

Contributors:

Road Map

Right now, the main functionality of wellio.js is LAS file -> Wellio-style JSON.

There is also functionality to:

  • save wellio-style JSON as a .json file.
  • load & convert LASIO-style json into wellio-style JSON.

In the future, we may add functionality to convert JSON well log format, or what becomes the unfortunately named JSON-style JSON, to wellio-style json and back.

Wellio.js & Wellioviz.js

Wellioviz is the visualization companion to wellio!

Where are Wellio is just concerned with the conversion of LAS 2.0 files into JSON, Wellioviz is concerned with making a visualization of the resulting JSON using d3.js v5. This means you can load, convert, and visualize well logs entirely on the web with front-end JavaScript.

Find out more about WELLIOVIZ here

Where To Get Open-Source Well Logs in .LAS format?

You can use the file upload button to load into your browsers memory any LAS files from your local computer. I've also included a few well logs in the /assets/ folder of this repo from the electronic data file below.

Electronic data (including well logs, tops, etc.) for Athabasca Oil Sands Data McMurray/Wabiskaw Oil Sands Deposit http://ags.aer.ca/publications/SPE_006.html Data is also in the repo folder: SPE_006_originalData

Report for Athabasca Oil Sands Data McMurray/Wabiskaw Oil Sands Deposit http://ags.aer.ca/document/OFR/OFR_1994_14.PDF

You can also find them on USGS and Kansas open data sites as is done in this Observable notebook that leverages wellio & wellioviz.

Example of LAS format and JSON formated well log data

Original las file example

or go here for live example.

~VERSION INFORMATION
 VERS.                 2.0:   CWLS LOG ASCII STANDARD -VERSION 2.0
 WRAP.                  NO:   ONE LINE PER DEPTH STEP
~WELL INFORMATION BLOCK
#MNEM.UNIT           DATA                    DESCRIPTION OF MNEMONIC
#---------    -------------------            -------------------------------
# Generated from Intellog Unique Number	CW_73_75/WELL/2722
WELL.         CHEVRON MGSU 1 MITSUE 01-01    : Well_name    - WELL
LOC .         00/01-01-073-05W5/0            : Location     - LOCATION
UWI .         00/01-01-073-05W5/0            : Uwi          - UNIQUE WELL ID
ENTR.         JAYE                           : Entered      - ENTERED BY
SRVC.         SCHLUMBERGER                   : Scn          - SERVICE COMPANY
DATE.         23 DEC 86                      : Date         - LOG DATE
STRT.M        390                            : top_depth    - START DEPTH
STOP.M        650                            : bot_depth    - STOP DEPTH
STEP.M        0.25                           : increment    - STEP LENGTH
 NULL. -999.2500:NULL Value
~CURVE INFORMATION BLOCK
#MNEM UNIT       ERCB CURVE CODE    CURVE DESCRIPTION
#-----------   ------------------   ----------------------------------
DEPT.M        00 001 00 00         : DEPTH        - DEPTH
DPHI.V/V      00 890 00 00         : PHID         - DENSITY POROSITY (SANDSTONE)
NPHI.V/V      00 330 00 00         : PHIN         - NEUTRON POROSITY (SANDSTONE)
GR  .API      00 310 00 00         : GR           - GAMMA RAY
CALI.MM       00 280 01 00         : CAL          - CALIPER
ILD .OHMM     00 120 00 00         : RESD         - DEEP RESISTIVITY (DIL)
~PARAMETER INFORMATION
#MNEM.UNIT           DATA             DESCRIPTION OF MNEMONIC
#---------         -----------     ------------------------------
GL  .M        583.3                : gl           - GROUND LEVEL ELEVATION
EREF.M        589                  : kb           - ELEVATION OF DEPTH REFERENCE
DATM.M        583.3                : datum        - DATUM ELEVATION
TDD .M        733.4                : tdd          - TOTAL DEPTH DRILLER
RUN .         ONE                  : Run          - RUN NUMBER
ENG .         SIMMONS              : Engineer     - RECORDING ENGINEER
WIT .         SANK                 : Witness      - WITNESSED BY
BASE.         S.L.                 : Branch       - HOME BASE OF LOGGING UNIT
MUD .         GEL CHEM             : Mud_type     - MUD TYPE
MATR.         SANDSTONE            : Logunit      - NEUTRON MATRIX
TMAX.C        41                   : BHT          - MAXIMUM RECORDED TEMPERATURE
BHTD.M        733.8                : BHTDEP       - MAXIMUM RECORDED TEMPERATURE
RMT .C        17                   : MDTP         - TEMPERATURE OF MUD
MUDD.KG/M     1100                 : MWT          - MUD DENSITY
NEUT.         1                    : NEUTRON      - NEUTRON TYPE
RESI.         0                    : RESIST       - RESISTIVITY TYPE
RM  .OHMM     2.62                 : RM           - RESISTIVITY OF MUD
RMC .OHMM     0                    : RMC          - RESISTIVITY OF MUD CAKE
RMF .OHMM     1.02                 : RMF          - RESISTIVITY OF MUD FILTRATE
SUFT.C        0                    : SUFT         - SURFACE TEMPERATURE
~A  DEPTH     PHID     PHIN       GR      CAL     RESD
  390.000    0.199    0.457   82.478  238.379    2.923
  390.250    0.208    0.456   86.413  238.331    2.925
  390.500    0.246    0.452   90.229  238.069    2.917
  390.750    0.266    0.475   90.944  238.752    2.898
  391.000    0.287    0.484   88.866  239.724    2.890
  391.250    0.288    0.474   82.638  241.951    2.844
  391.500    0.241    0.461   83.345  244.478    2.748
  391.750    0.215    0.471   88.403  247.116    2.725
  392.000    0.190    0.448   91.038  250.475    2.748
  392.250    0.219    0.478   89.579  254.764    2.845
  392.500    0.269    0.552   84.092  258.019    2.939
  392.750    0.316    0.458   78.479  260.143    3.088
  393.000    0.299    0.429   72.249  256.370    3.338

LAS -> JSON

var lasjson = function las2json(onelas) will give you something like this though in the example below all the data is taken out to save space:

var lasjson = {
			"VERSION INFORMATION":{
				"VERS":{"MNEM":"","UNIT":"","DATA":"","DESCRIPTION OF MNEMONIC 1":"","DESCRIPTION OF MNEMONIC 2":""},
				"WRAP":{"MNEM":"","UNIT":"","DATA":"","DESCRIPTION OF MNEMONIC 1":"","DESCRIPTION OF MNEMONIC 2":""}
			}
			,
			"WELL INFORMATION BLOCK":{
					"GENERATED":"",
					"MNEM_0":{"MNEM":"","UNIT":"","DATA":"","DESCRIPTION OF MNEMONIC 1":"","DESCRIPTION OF MNEMONIC 2":""},
					"MNEM_1":{"MNEM":"","UNIT":"","DATA":"","DESCRIPTION OF MNEMONIC 1":"","DESCRIPTION OF MNEMONIC 2":""},
					"MNEM_2":{"MNEM":"","UNIT":"","DATA":"","DESCRIPTION OF MNEMONIC 1":"","DESCRIPTION OF MNEMONIC 2":""}
				}
			,
			"CURVE INFORMATION BLOCK":{
					"MNEM_0":{"MNEM":"","UNIT":"","ERCB CURVE CODE":"","CURVE DESCRIPTION 1":"","CURVE DESCRIPTION 2":""}, 
					"MNEM_0":{"MNEM":"","UNIT":"","ERCB CURVE CODE":"","CURVE DESCRIPTION 1":"","CURVE DESCRIPTION 2":""},
				}		
			,
			"PARAMETER INFORMATION":{
					"MNEM_0":{"MNEM":"","UNIT":"","DATA":"","DESCRIPTION OF MNEMONIC 1":"","DESCRIPTION OF MNEMONIC 2":""}, 
					"MNEM_1":{"MNEM":"","UNIT":"","DATA":"","DESCRIPTION OF MNEMONIC 1":"","DESCRIPTION OF MNEMONIC 2":""},
				}
			,
			"CURVES":{
					"Curve_NAME_ONE" :[1,2,3,4,5,6,7,8,9,10,11],
					"Curve_NAME_ONE" :[1,2,3,4,5,6,7,8,9,10,11],
				}
		}

wellio.js's People

Contributors

dcslagel avatar dependabot[bot] avatar huseyinkozan avatar justingosses avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wellio.js's Issues

Test Failure: las2json : test_data_characters.js

The test should find the first element (the start time) in a well_json.TIME array.

The current error is:
t.equal(well_json.TIME[0] === "00:00:00");
TypeError: Cannot read property '0' of undefined

Create notebook or file that documents which tests fail & why & propose fixes to wellio code to fix.

Create notebook or file that documents which tests fail & why & propose fixes to wellio code to fix.

  • Not sure best way to package this...but probably good to make a place for examples of tests that fail and reasons why first... then propose changes to wellio.js parsing code to handle. I suspect at least some of the tests fail for related reasons. This might bring them to surface.

Tagging @dcslagel as you're working in this direction. I'll be unable to spend time on this until next week.

demo has some weird state issue

demo has some weird state issue weird if you load several wells in sequence switching between loading from local file and built-in well, you eventually can't load a local file well anymore unless you refresh the page.

what should or shouldn't be included in a wellio_plus JSON object?

Wellio_plus being defined as having data and functions that go behind the data in a LAS file.

Examples of wellio_plus data & functions that could be part of the prototype would be:

common function calls like max, min, average of each curve, etc.
pick depths
geographic location
age of data acquisition
non-original curves that are created and used as engineered features for machine-learning.
other well-centric data points or datasets that might be useful for machine-learning.

Some of these exist in welly.py python objects. You could make a case anything that exists in welly should exist in some form in wellio_plus? I'm not sure that's a necessary requirement?

wellio <-> lasio (python)

Would be nice to be able to convert back and forth between a LASIO.py object and a wellio.js JSON object. They are both objects, so this is probably just a matter of mapping? I'm assuming both retain all the information in the original LAS file.

need to write function that converts JSON -> LAS file

Need to write this function in js/wellio.js:

//// Function that takes a single json representing a single well and writes a paper LAS 2.0 file.
function json2las(oneJSON){
//// nothing written yet
return LAS
}

Possible problem with wellio.loadLAS("well.LAS")

It looks like maybe wellio.loadLAS() has a problem when used on front-end in browser.

Couldn't get it to run without problem and looks like the demo page always uses ajax to load the file in the demo...so not sure if new problem or just missed it due to that?

We did make a change recently to get it to run well with REACT, so maybe problem from that?

Test Failure: las2json : test_v2_inf_api_leading_zero_value.js

Current error is thrown when las2json is processing the test file assets/sample_2.0_inf_api_leading_zero.las

This test should verify that the api field value is treated as a string rather than a number so that if there is a leading zero it is not removed.

Error:
/usr/local/devel/Apps/node-apps/wellio.js/dist/index.js:120
var unit = unit_and_data_str[0,5].trim();
TypeError: Cannot read property 'trim' of undefined

Duplication of demo page between wellio & wellioviz?

We are currently more or less duplicating the demo page between the wellio and wellioviz repositories.

This seems...inelegant.

Should we:

1. Continue duplication. Keep wellio demo page bare and spartan and develop wellioviz into fancier version?
This seems somewhat logical as wellio is about conversion not visualization. But there will be pressure to make it look nicer because the other one does.

2. Move the demo page to wellioviz and point to that location from wellio?
Having a single page makes sense. Wellioviz needs more actual visual inspection to make sure it works where as wellio only really needs tests, not a visual representation to make sure it works.

3. Move it to its own repository and point to it from both wellioviz & wellio?
This has some logic in that both libraries contribute to make the demo.html page possible.
The downside is then it becomes harder to use it as a test page for the libraries without deploying them to NPM.

4. Duplicate it exactly in both places via a script that copies the whole repository of one of them, deletes everything except the right files and folders and pastes into the repository where the script is running, probably wellio.js.

Another malformed LAS file example

In trying to visualize well logs from Texas here: https://rrcsearch3.neubus.com/esd3-rrc/index.php?_module_=esd&_action_=keysearch&profile=15#

It become apparent that a lot of the well logs were created by digidrill who put a few extra lines in the top of their LAS files.

https://www.digidrill.com/products/software/datalogger

EXAMPLE:
https://rrcsearch3.neubus.com/rrcdisplay/FULLROP.s_1a365895682a19433e2f5339d575b86b.las

Need to add this to the test cases and figure out the exact bug.

Allow time colons before colon delimiter

File and content example:
assets/data_character.las

...
#MNEM.UNIT                   Data Type:Information
#__________________________________________________________
  STRT.           01-JAN-2020 00:00:00 : START INDEX
....

Incorrect parsing of 'STRT' with a time-date as value:

  'WELL INFORMATION BLOCK': {                                    
    STRT: {                                                      
      MNEM: 'STRT',                                              
      UNIT: '',                                                  
      DATA: '01-JAN-2020 00',                                    
      'DESCRIPTION OF MNEMONIC 1': '00',                         
      'DESCRIPTION OF MNEMONIC 2': ''                            
    },    

Correct parsing should be:

  'WELL INFORMATION BLOCK': {                                    
    STRT: {                                                      
      MNEM: 'STRT',                                              
      UNIT: '',                                                  
      DATA: '01-JAN-2020 00:00:00',                                    
      'DESCRIPTION OF MNEMONIC 1': 'START INDEX',                         
      'DESCRIPTION OF MNEMONIC 2': ''                            
    },    

Documention is mostly inline...can we reformat and make more user-friendly?

wellio.js doesn't have that much code but documenting it in a friendly manner might help more people understand its internals.

I've mostly used sphinx for documentation in Python. Sphinx has a JS version, but it is pretty heavy featured. Something small and light that looks pretty by default but isn't super powerful might be a better choice.

I've previously looked at : https://github.com/documentationjs/documentation/blob/master/docs/GETTING_STARTED.md

but I'm open to other options?

Test Failure: las2json : test_v2_inf_uwi_leading_zero_value.js

Current error is thrown when las2json is processing the test file assets/sample_2.0_inf_uwi_leading_zero.las

This test should verify that the api field value is treated as a string rather than a number so that if there is a leading zero it is not removed.

Error:
/usr/local/devel/Apps/node-apps/wellio.js/dist/index.js:120
var unit = unit_and_data_str[0,5].trim();
TypeError: Cannot read property 'trim' of undefined

BUG: fs for file uploading works with node.js but not in jupyter notebook

BUG: fs for file uploading works with node.js but not in jupyter notebook

Probably need to have the file upload function figure out which type of environment it is in and then use the appropriate file upload method. This has likely been figured out before, so might pull in a library for it or use an example?

This was mentioned in issue #7
#7 (comment)

and relates to issue #39

Test Failure: las2json : test_blank_line_in_header.js

The test should find that a curve header for 'DEPT' is in well_json.curves.

The current error is:
t.equal(well_json.curves[0] === "DEPT");
TypeError: Cannot read property '0' of undefined

This suggests that well_json.curves is not getting populated properly.

Modify index.js to handle wrapped LAS files, meaning lines longer than 80 characters get continued on next line.

Modify index.js to handle wrapped LAS files, meaning lines longer than 80 characters get continued on next line. Current wellio.js fails with LAS files that are wrapped.

https://github.com/JustinGOSSES/wellio.js/blob/master/dist/index.js

This was first suggested by @oze4 in issue #5.

This would be a good first issue and after a quick look seems like it would involve editing lines 158-194 in index.js.

Please refer to http://www.cwls.org/las/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.