JustinGOSSES / wellio.js

JavaScript for converting well-log standard .las file format to json format
https://justingosses.github.io/wellio.js/
MIT License
34 stars 5 forks source link

Add function to read lasio json files #33

Closed dcslagel closed 4 years ago

dcslagel commented 4 years ago

This change adds the function read_json(). This version of the function reads Lasio json files.

Example Lasio json files are added in assets/json_files. The examples include a json with empty las header info, and a formated (pretty) json file.

Basic tests are added in dist/test/read_las_json/. The test can be run with npm run test-read-lasio-json

This change is based on the input gathered on exploratory pull request #32. See #32 for additional information and discussion. Numerical information in the Lasio json retains its numerical type when translated to wellio json.

Let me know if this change could be accepted (or rejected) or needs some additional changes before being approved and merged.

Thank you,

DC

Here are the lasio steps used to create the Lasio Json object.

import json
import lasio
from lasio import las
l = lasio.read("./tests/examples/2.0/sample_2.0.las")
with open('sample_2.0.json', 'w') as fp:
    json.dump(l, fp, cls=las.JSONEncoder)

Here are the steps to import into wellio.js. Note: change the read_json([filepath]) to be the actual file path that the Lasio json file was output to.

$>cd wellio.js
$>node
>w = require('./dist/index.js'); 
>lj = w.read_json('assets/json_files/sample_2.0.json')