|
| 1 | +from pathlib import Path |
| 2 | + |
| 3 | +import dash |
| 4 | +import flask |
| 5 | + |
| 6 | +from examples.well_correlation_data.well_log_testdata import ( |
| 7 | + axis_mnemos, |
| 8 | + axisTitles, |
| 9 | + color_tables, |
| 10 | + lithology_info_table, |
| 11 | + patterns, |
| 12 | + patternsTable, |
| 13 | + spacers, |
| 14 | + templates, |
| 15 | + wellDistances, |
| 16 | + welllogs_two_wells, |
| 17 | + wellpickFlatting, |
| 18 | + wellpicks, |
| 19 | +) |
| 20 | +from webviz_subsurface_components import SyncLogViewer |
| 21 | + |
| 22 | +slv = SyncLogViewer( |
| 23 | + id="WellCorrelation-viewer", |
| 24 | + welllogs=welllogs_two_wells, |
| 25 | + wellpicks=wellpicks, |
| 26 | + patterns=patterns, |
| 27 | + spacers=spacers, |
| 28 | + wellDistances=wellDistances, |
| 29 | + templates=templates, |
| 30 | + wellpickFlatting=wellpickFlatting, |
| 31 | + colorTables=color_tables, |
| 32 | + patternsTable=patternsTable, # {'patternSize': 24, 'patterns': [], 'names': []}, |
| 33 | + axisTitles=axisTitles, |
| 34 | + axisMnemos=axis_mnemos, |
| 35 | + syncContentDomain=False, |
| 36 | + syncContentSelection=True, |
| 37 | + syncTrackPos=True, |
| 38 | + syncTemplate=True, |
| 39 | + horizontal=False, |
| 40 | + viewTitles=True, |
| 41 | + welllogOptions={"wellpickColorFill": False, "wellpickPatternFill": False}, |
| 42 | + lithologyInfoTable=lithology_info_table, |
| 43 | + # spacerOptions={ |
| 44 | + # "wellpickColorFill": True, |
| 45 | + # "wellpickPatternFill": True |
| 46 | + # } |
| 47 | +) |
| 48 | + |
| 49 | +static_image_route = "/static/" |
| 50 | + |
| 51 | +app = dash.Dash(__name__) |
| 52 | +app.layout = dash.html.Div( |
| 53 | + id="app-id", |
| 54 | + style={ |
| 55 | + "height": "100%", |
| 56 | + "width": "80%", |
| 57 | + "position": "absolute", |
| 58 | + }, |
| 59 | + children=[ |
| 60 | + slv, |
| 61 | + ], |
| 62 | +) |
| 63 | + |
| 64 | + |
| 65 | +@app.server.route("/static/<image_path>.gif") |
| 66 | +def serve_image(image_path): |
| 67 | + image_name = "{}.gif".format(image_path) |
| 68 | + # Images are located in react/src/demo/example-data/pattern |
| 69 | + return flask.send_from_directory( |
| 70 | + Path(__file__).parent.parent.parent / "react/src/demo/example-data/patterns", |
| 71 | + image_name, |
| 72 | + ) |
| 73 | + |
| 74 | + |
| 75 | +if __name__ == "__main__": |
| 76 | + app.run_server( |
| 77 | + host="localhost", |
| 78 | + port=8000, |
| 79 | + debug=True, |
| 80 | + ) |
0 commit comments