File size: 4,200 Bytes
052f08d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dfa8b70
052f08d
 
 
 
 
 
dfa8b70
052f08d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import numpy as np
import streamlit as st
import pandas as pd
import os
from ui import *
from mLogsFunctions import *

#Streamlit Dashboard------------------------------------------------------------------------------------------
pagetile = """<center><h1>EXPLORATORY DATA ANALYSIS</h1></center>"""
set_page_config(page='custom')
hide_menu_button()
condense_layout()

logo_site, info_site = st.columns([1.5, 8.5])
with logo_site:
    st.image("https://i.ibb.co/Yd42K98/LogoVPI.png", use_column_width='auto')
with info_site:
    # st.set_option('deprecation.showfileUploaderEncoding', False)
    # st.set_option('maxUploadSize', 200*1024) # 200 MB
    st.markdown(pagetile, unsafe_allow_html=True)
    # Option 1: CSV File Loading
    st.write('You can load your csv file using the file upload or selection from LAS Exploration option below.')
    st.subheader("1. CSV File Loading")
    df = csv_uploader()
    df = tweak_data(df,resample=False, reindex=True)

    # Option 2: CSV from LAS Exploration
    st.subheader("2. CSV from LAS Exploration")
    dir_path = 'data/merged/'
    csv_files = [filename for filename in os.listdir(dir_path) if filename.endswith('.csv')]
    selected_csv_file= st.multiselect('Select a CSV file', csv_files, key = 'st.session_state.selected_well_multi')

    # # Đọc file csv được chọn vào DataFrame
    if selected_csv_file: # Nếu người dùng đã chọn file CSV
        # Đọc file csv được chọn vào DataFrame
        file_path = 'data/merged/'
        merged_data = pd.concat([pd.read_csv(file_path + f) for f in selected_csv_file])
        df = tweak_data(merged_data, resample=False, reindex=True)
    else: # Nếu người dùng không chọn file CSV
        merged_data = df
        df = tweak_data(merged_data, resample=False, reindex=True)
#|CHECK DATA EXISTENCE-----------------------------------------------------------------------------------------
if df is not None:
    curves = columns_list(df, no_depth=True, no_well=True)
    well_names = np.sort(df.WELL.unique())
#|TABS-ESTABLISHING-----------------------------------------------------------------------------------------
    tab1, tab2, tab3, tab4, tab5 = st.tabs(['DataFrame', 
                                      'DataStatistics',
                                      '3D Scatter Points', 
                                      'CurvesView',
                                      'OutliersRemoval'
                                      ])
    #|TABS-1-----------------------------------------------------------------------------------------
    st.write('---')
    with tab1:
        st.dataframe(df, width=1400, height=500)

    #|TABS-2-----------------------------------------------------------------------------------------
    with tab2:
        st.radio('DataVisualizationMethod',
                key='displayTab2',
                options=['DataStatistics', 
                        'Missing Statistic', 
                        'Curve Distribution', 
                        'Histogram Overlay',
                        'Cross-Plot',
                        'PairPlot'],
                horizontal=True)
        if st.session_state.displayTab2 == 'DataStatistics':
            subtab21(df, well_names)
        elif st.session_state.displayTab2 == 'Missing Statistic':
            subtab22(df)
        elif st.session_state.displayTab2 == 'Curve Distribution':
            subtab23(df, curves)
        elif st.session_state.displayTab2 == 'Histogram Overlay':
            subtab24(df, curves)
        elif st.session_state.displayTab2 == 'Cross-Plot':
            subtab25(df, curves)
        elif st.session_state.displayTab2 == 'PairPlot':
            subtab26(df, curves)
        else:
            subtab21(df, well_names)

        #|TABS-3-----------------------------------------------------------------------------------------
    with tab3:
        scatterPoint3D(df)
    #|TABS-4-----------------------------------------------------------------------------------------
    with tab4:
        stViewCurves(df)
    #|TABS-5-----------------------------------------------------------------------------------------
    with tab5:
        rmOutliers(df)