1+ import lasio
12import argparse
23import os
4+ import re
35import pandas
46import pathlib
57
810import dash_core_components as dcc
911import dash_html_components as html
1012import dash_table as dt
11- import base64
1213
1314from plotly import tools
1415import plotly .graph_objs as go
1516
16- import lasio
17-
18- import re
1917
2018app = dash .Dash (__name__ )
2119
@@ -36,7 +34,11 @@ def parse_args():
3634 help = "Log ASCII Standard (LAS) file" ,
3735 )
3836
39- parser .add_argument ("--debug" , "-d" , action = "store_true" , help = "enable debug mode" )
37+ parser .add_argument (
38+ "--debug" , "-d" ,
39+ action = "store_true" ,
40+ help = "enable debug mode"
41+ )
4042
4143 args = parser .parse_args ()
4244
@@ -53,51 +55,41 @@ def parse_args():
5355
5456
5557def generate_frontpage ():
56-
5758 filename = os .path .basename (lasfile .name )
5859
59- frontpage = []
60-
61- # get the header
62- frontpage .append (
63- html .Div (
64- id = "las-header" ,
65- children = [
66- html .Img (
67- id = "las-logo" ,
68- src = "data:image/png;base64,{}" .format (
69- base64 .b64encode (open ("assets/logo.png" , "rb" ).read ()).decode ()
60+ return html .Div (
61+ id = "las-header" ,
62+ children = [
63+ html .Img (
64+ id = "las-logo" ,
65+ src = app .get_asset_url ("logo.png" )
66+ ),
67+ html .Div (
68+ id = "las-header-text" ,
69+ children = [
70+ html .H1 ("LAS Report" ),
71+ html .Div (
72+ id = "las-file-info" ,
73+ children = [
74+ html .Span (id = "las-filename" , children = filename ),
75+ html .Span (
76+ " ({0})" .format (
77+ lf .version ["VERS" ].descr
78+ if "VERS" in lf .version
79+ else "Unknown version"
80+ )
81+ ),
82+ ],
7083 ),
71- ),
72- html .Div (
73- id = "las-header-text" ,
74- children = [
75- html .H1 ("LAS Report" ),
76- html .Div (
77- id = "las-file-info" ,
78- children = [
79- html .Span (id = "las-filename" , children = filename ),
80- html .Span (
81- " ({0})" .format (
82- lf .version ["VERS" ].descr
83- if "VERS" in lf .version
84- else "Unknown version"
85- )
86- ),
87- ],
88- ),
89- ],
90- ),
91- html .Img (
92- id = "dash-logo" ,
93- src = app .get_asset_url ("dash-logo.png" )
94- )
95- ],
96- )
84+ ],
85+ ),
86+ html .Img (
87+ id = "dash-logo" ,
88+ src = app .get_asset_url ("dash-logo.png" )
89+ )
90+ ],
9791 )
9892
99- return frontpage
100-
10193
10294def generate_axis_title (descr , unit ):
10395 title_words = descr .split (" " )
@@ -306,7 +298,10 @@ def generate_table():
306298)
307299
308300
309- @app .callback (Output ("las-table-print" , "children" ), [Input ("table" , "data" )])
301+ @app .callback (
302+ Output ("las-table-print" , "children" ),
303+ [Input ("table" , "data" )]
304+ )
310305def update_table_print (data ):
311306 colwidths = {
312307 "mnemonic" : "100px" ,
@@ -340,5 +335,4 @@ def update_table_print(data):
340335
341336
342337if __name__ == "__main__" :
343-
344338 app .run_server (debug = debug )
0 commit comments