KVL_converter / app.py
dhhien's picture
Upload 9 files
7a654d3
import streamlit as st
st.set_page_config(layout="wide", page_title='Rock physics template v.0.1')
from load_css import local_css
#import lasio
import missingno as mno
import pandas as pd
# Local Imports
import home
import raw_data
import plotting
import header
import export_kvl
#import missingdata
#import RPT
#import GeoMechanics
import plotly.express as px
from io import StringIO
local_css("style.css")
@st.cache_data
def load_data(uploaded_file):
if uploaded_file is not None:
try:
bytes_data = uploaded_file.read()
str_io = StringIO(bytes_data.decode('Windows-1252'))
column_name=['X','Y','Z']
data = pd.read_csv(str_io, delim_whitespace=True, header=None)
data.columns=column_name
#well_data = las_file.df()
#well_data['DEPTH'] = well_data.index
except UnicodeDecodeError as e:
st.error(f"error loading dat file: {e}")
else:
data = None
return data
# Sidebar Options & File Uplaod
las_file=None
st.sidebar.write('# Grid file Explorer')
st.sidebar.write('To begin using the app, load your Grid file (dat format) file using the file upload option below.')
path = st.sidebar.file_uploader('Choose a grid files', accept_multiple_files=True, type=['.dat'])
for uploadfile in path:
data = load_data(uploadfile)
if uploadfile:
st.sidebar.success('File Uploaded Successfully')
#st.sidebar.write(f'<b>Data file</b>: {uploadfile}',unsafe_allow_html=True)
# Sidebar Navigation
st.sidebar.title('Navigation')
options = st.sidebar.radio('Select a page:',
['Home', 'Data Information', 'Data Visualisation',
'Converting to KVL'])
if options == 'Home':
home.home()
elif options == 'Data Information':
raw_data.raw_data(uploadfile,data)
elif options == 'Data Visualisation':
plotting.plot(data)
elif options == 'Converting to KVL':
export_kvl.export_kvl(data)