To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit b713fcae authored by holukas's avatar holukas
Browse files

preparing v0.16.0

parent e0706cee
......@@ -16,8 +16,6 @@ from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as Navigatio
from gui import gui_building_blocks, gui_elements
from gui.top_menu import TopMenu
from logger import QTextEditLogger
from modboxes.default.Export import Export_gui as modbox_ex
from modboxes.Extensions._Pipelines import Pipelines_gui as modbox_pn
class Ui_MainWindow(object):
......@@ -246,94 +244,6 @@ class Ui_MainWindow(object):
from gui.gui_timerange_controls import TimeRangeControls
self.obj_time_range_controls = TimeRangeControls(layout=layout)
# def add_modbox_Plots(self):
# self.modbox_plots = modbox_pl.AddControls(grd_Categories=self.grd_categories,
# stk_Options=self.stk_category_options,
# stk_Refinements=self.stk_option_refinements,
# ctx=self.ctx)
def add_modbox_QualityControl(self):
self.modbox_quality_control = \
modbox_qc.AddControls(grd_Categories=self.grd_categories,
stk_Options=self.stk_category_options,
stk_Refinements=self.stk_option_refinements,
ctx=self.ctx)
# Default values: QC
self.modbox_quality_control.DefaultFlagEddyPro.ref_lne_upper_lim.setText('2')
self.modbox_quality_control.DefaultFlagEddyPro.ref_lne_lower_lim.setText('2')
self.modbox_quality_control.SignalStrengthIRGA.ref_lne_upper_lim.setText('100')
self.modbox_quality_control.SignalStrengthIRGA.ref_lne_lower_lim.setText('0')
self.modbox_quality_control.SpectralCorrectionFactor.ref_lne_upper_lim.setText('99999')
self.modbox_quality_control.SpectralCorrectionFactor.ref_lne_lower_lim.setText('2')
self.modbox_quality_control.uStarThresholdConstantManual.ref_lne_upper_lim.setText('0.05')
self.modbox_quality_control.uStarThresholdConstantManual.ref_lne_lower_lim.setText('-9999')
self.modbox_quality_control.StatFlagsRawData.ref_lne_upper_lim.setText('1')
self.modbox_quality_control.StatFlagsRawData.ref_lne_lower_lim.setText('1')
self.modbox_quality_control.StabilityParameter.ref_lne_upper_lim.setText('2')
self.modbox_quality_control.StabilityParameter.ref_lne_lower_lim.setText('-2')
self.modbox_quality_control.AmpQcFlags.ref_lne_upper_lim.setText('99999')
self.modbox_quality_control.AmpQcFlags.ref_lne_lower_lim.setText('2')
# def add_modbox_GapFilling(self):
# """Add GUI elements for ModBox GapFilling to GUI."""
# self.modbox_gapfilling = modbox_gf.AddControls(grd_Categories=self.grd_categories,
# stk_Options=self.stk_category_options,
# stk_Refinements=self.stk_option_refinements,
# ctx=self.ctx)
#
# # Default values: Gap-filling simple running median
# self.modbox_gapfilling.RunningSimple.ref_lne_timewin_len.setText('96')
# self.modbox_gapfilling.RunningSimple.ref_lne_timewin_min_vals.setText('24')
# self.modbox_gapfilling.LinearInterpolationSimple.ref_lne_limit.setText('1')
# def add_modbox_Analyses(self):
# self.modbox_analyses = modbox_an.AddControls(grd_Categories=self.grd_categories,
# stk_Options=self.stk_category_options,
# stk_Refinements=self.stk_option_refinements,
# ctx=self.ctx)
# # Default values
# # self.modbox_analyses.ClassFinder.ref_lne_lower_class_lim.setText('0')
# # self.modbox_analyses.ClassFinder.ref_lne_upper_class_lim.setText('20')
# self.modbox_analyses.RunningLinReg.ref_lne_win_size.setText('480') ## 10 days @30min files
# self.modbox_analyses.RunningLinReg.ref_lne_win_min_vals.setText('321') ## more than 2/3 available
# self.modbox_analyses.RunningLinReg.ref_lne_win_step_size.setText('480')
# self.modbox_analyses.BeforeAfterEvent.ref_lne_win_size.setText('7')
# self.modbox_analyses.BeforeAfterEvent.ref_lne_win_min_vals.setText('72')
# def add_modbox_Modifications(self):
# self.modbox_modifications = modbox_mf.AddControls(grd_Categories=self.grd_categories,
# stk_Options=self.stk_category_options,
# stk_Refinements=self.stk_option_refinements,
# ctx=self.ctx)
# # Default values
# self.modbox_modifications.ResampleToFreq.ref_lne_freq_duration.setText('1')
# self.modbox_modifications.ResampleToFreq.ref_lne_min_vals.setText('1')
def add_modbox_Pipelines(self):
# -----------
# CATEGORY : PIPELINES (ModBox) (in option stack #8)
self.btn_pn_cat_Pipelines_showStack, \
self.pn_ref_PipeQC_stackTab, \
self.btn_pn_opt_PipeQC, \
self.drp_pn_ref_PipeQC_flux, \
self.drp_pn_ref_PipeQC_foundFlag_SSITC, \
self.drp_pn_ref_PipeQC_foundFlag_OutAbsLim, \
self.drp_pn_ref_PipeQC_foundFlag_scf, \
self.btn_pn_ref_PipeQC_generateOverallFlag = \
modbox_pn.AddControls(grd_Categories=self.grd_categories,
stk_Options=self.stk_category_options,
stk_Refinements=self.stk_option_refinements,
ctx=self.ctx).get_handles()
def add_modbox_Export(self):
# -----------
# CATEGORY : EXPORT (ModBox) (in option stack #9)
self.modbox_export = modbox_ex.AddControls(grd_Categories=self.grd_categories,
stk_Options=self.stk_category_options,
stk_Refinements=self.stk_option_refinements,
ctx=self.ctx)
def add_statsboxes(self, layout):
# Adds labels for text and values to the grid lyt
......@@ -377,7 +287,7 @@ class Ui_MainWindow(object):
gui_elements.add_label_pair_to_grid_layout(txt='SD', row=2, **args)
self.lbl_sdmean_val = \
gui_elements.add_label_pair_to_grid_layout(txt='SD / Mean', row=3, **args)
self.lbl_max_val =\
self.lbl_max_val = \
gui_elements.add_label_pair_to_grid_layout(txt='Maximum', row=4, **args)
self.lbl_p95_val = \
gui_elements.add_label_pair_to_grid_layout(txt='Perc 95', row=5, **args)
......@@ -385,7 +295,7 @@ class Ui_MainWindow(object):
gui_elements.add_label_pair_to_grid_layout(txt='Perc 75', row=6, **args)
self.lbl_p25_val = \
gui_elements.add_label_pair_to_grid_layout(txt='Perc 25', row=7, **args)
self.lbl_p05_val =\
self.lbl_p05_val = \
gui_elements.add_label_pair_to_grid_layout(txt='Perc 05', row=8, **args)
self.lbl_min_val = \
gui_elements.add_label_pair_to_grid_layout(txt='Minimum', row=9, **args)
......@@ -401,7 +311,6 @@ class Ui_MainWindow(object):
# header1.setProperty('labelClass', 'lbl_Header2')
# layout.addWidget(header1, 21, 0, 1, 2)
args = dict(col=6, css_ids=css_ids, layout=layout, orientation=orientation)
self.lbl_run_id = gui_elements.add_label_pair_to_grid_layout(
txt='Run ID', row=0, **args)
......
......@@ -2,7 +2,6 @@
General GUI building blocks.
"""
from PyQt5 import QtCore as qtc
from PyQt5 import QtWidgets as qw
from PyQt5.QtGui import QIcon
......@@ -152,4 +151,3 @@ class QCustomTabWidget(qw.QTabWidget):
def get(self):
pass
......@@ -260,8 +260,10 @@ def add_label_linedit_info_triplet_to_grid(txt, css_ids, layout, row, col, orien
def grd_LabelDateEditPair(layout, row, col, css_ids, txt):
lbl_txt = qtw.QLabel(text=txt)
dte_date = qtw.QDateEdit()
# dte_date = qtw.QDateEdit(calendarPopup=True)
lbl_txt.setProperty('labelClass', css_ids[0])
dte_date.setProperty('labelClass', css_ids[1])
dte_date.setAlignment(qtc.Qt.AlignCenter | qtc.Qt.AlignVCenter)
lbl_txt.setAlignment(qtc.Qt.AlignRight | qtc.Qt.AlignVCenter)
layout.addWidget(lbl_txt, row, col, 1, 1)
......@@ -349,7 +351,7 @@ def grd_LabelDropdownPair(txt, css_ids, layout, row, col, orientation, colspan=1
elif orientation == 'vert':
lbl_txt.setAlignment(qtc.Qt.AlignLeft | qtc.Qt.AlignVCenter)
layout.addWidget(lbl_txt, row, col, 1, 1)
layout.addWidget(drp_options, row+1, col, 1,colspan)
layout.addWidget(drp_options, row + 1, col, 1, colspan)
# drp_opt_default_epqc.setAlignment(qtc.Qt.AlignLeft | qtc.Qt.AlignVCenter)
# lyt.addWidget(lbl_txt, row, col, 1, 1)
# lyt.addWidget(drp_opt_default_epqc, row + 1, col, 1, 1)
......@@ -518,6 +520,7 @@ def add_checkbox_to_grid(layout, row, col, rowspan=1, colspan=1):
layout.addWidget(checkbox, row, col, rowspan, colspan)
return checkbox
def add_info_hover_to_grid(layout, txt_info_hover, row, col, rowspan=1, colspan=1):
lbl_info = qtw.QLabel('🛈')
lbl_info.setProperty('labelClass', 'lbl_info_hover')
......@@ -526,7 +529,6 @@ def add_info_hover_to_grid(layout, txt_info_hover, row, col, rowspan=1, colspan=
layout.addWidget(lbl_info, row, col, rowspan, colspan)
def add_header_info_pair_in_grid_row(layout, txt, row, col=0, colspan=1, css_id='lbl_Header2', txt_info_hover=""):
# Header label
lbl = qtw.QLabel(text=txt)
......
......@@ -15,11 +15,14 @@ class TimeRangeControls():
lbl_visible_timerange_start.setProperty('labelClass', 'lbl_info2')
layout.addWidget(lbl_visible_timerange_start, stretch=0)
self.drp_year_start = gui_elements.add_layout_dropdown_pair(label_txt='Year', layout=layout,
max_visible_items=12, css_ids=['lbl_info', 'timerange'])
max_visible_items=12,
css_ids=['lbl_info', 'timerange'])
self.drp_month_start = gui_elements.add_layout_dropdown_pair(label_txt='Month', layout=layout,
max_visible_items=12, css_ids=['lbl_info', 'timerange'])
max_visible_items=12,
css_ids=['lbl_info', 'timerange'])
self.drp_day_start = gui_elements.add_layout_dropdown_pair(label_txt='Day', layout=layout,
max_visible_items=31, css_ids=['lbl_info', 'timerange'])
max_visible_items=31,
css_ids=['lbl_info', 'timerange'])
_spacer = qw.QLabel(' | ')
_spacer.setProperty('labelClass', 'lbl_info')
......@@ -30,11 +33,14 @@ class TimeRangeControls():
lbl_visible_timerange_end.setProperty('labelClass', 'lbl_info2')
layout.addWidget(lbl_visible_timerange_end, stretch=0)
self.drp_year_end = gui_elements.add_layout_dropdown_pair(label_txt='Year', layout=layout,
max_visible_items=12, css_ids=['lbl_info', 'timerange'])
max_visible_items=12,
css_ids=['lbl_info', 'timerange'])
self.drp_month_end = gui_elements.add_layout_dropdown_pair(label_txt='Month', layout=layout,
max_visible_items=12, css_ids=['lbl_info', 'timerange'])
max_visible_items=12,
css_ids=['lbl_info', 'timerange'])
self.drp_day_end = gui_elements.add_layout_dropdown_pair(label_txt='Day', layout=layout,
max_visible_items=31, css_ids=['lbl_info', 'timerange'])
max_visible_items=31,
css_ids=['lbl_info', 'timerange'])
# Buttons
self.btn_apply = gui_elements.add_button_to_layout(txt='Apply', layout=layout, css_id='btn_timerange')
......
......@@ -11,16 +11,33 @@ class buildTab:
Build empty tab
Templates:
4 columns: SPoVPoVPoV
#1 settings (S)
#2 plot area (P) on top of (o) selected variable (V)
#3 plot area (P) on top of (o) selected variable (V)
#4 plot area (P) on top of (o) selected variable (V)
4 columns: SVVP
#1 settings (S)
#2 available variables (V)
#3 selected variables (V)
#4 plot area (P)
4 columns: SVonVP
3 columns: SPoVPoV
#1 settings (S)
#2 plot area (P) on top of (o) selected variable (V)
#3 plot area (P) on top of (o) selected variable (V)
3 columns: SVonVP
#1 settings (S)
#2 available variables (V) on top of selected variables (V)
#3 plot area (P)
4 columns: SVonVPT
#1 settings (S)
#2 available variables (V) on top of selected variables (V)
#3 plot area (P)
#4 text area (T)
3 columns: SVP
#1 settings (S)
......@@ -61,15 +78,62 @@ class buildTab:
splitter = self.template_SVVP()
if tab_template == 'SVonVP':
splitter = self.template_SVonVP()
if tab_template == 'SVonVPT':
splitter = self.template_SVonVPT()
if tab_template == 'SPwT':
splitter = self.template_SPwT()
if tab_template == 'SP':
splitter = self.template_SP()
if tab_template == 'ST':
splitter = self.template_ST()
if tab_template == 'SPoVPoVPoV':
splitter = self.template_SPoVPoVPoV()
lyt_tab_vert.addWidget(splitter, stretch=1) ## add Splitter to tab layout
def template_SPoVPoVPoV(self):
# Column 1
frm_plot_on_varlist_1 = qw.QFrame()
self.lyt_plot_on_varlist_1 = qw.QVBoxLayout() # Make this also as self, to add buttons later
frm_plot_on_varlist_1.setLayout(self.lyt_plot_on_varlist_1)
self.frm_plot_area_1, self.fig_1, self.lyt_plot_area_1 = self.make_plot_area()
self.frm_varlist_selected_1, self.lst_varlist_selected_1 = self.make_varlist(txt_header='Select Variable')
self.lyt_plot_on_varlist_1.addWidget(self.frm_plot_area_1, stretch=3)
self.lyt_plot_on_varlist_1.addWidget(self.frm_varlist_selected_1, stretch=1)
# Column 2
frm_plot_on_varlist_2 = qw.QFrame()
self.lyt_plot_on_varlist_2 = qw.QVBoxLayout() # Make this also as self, to add buttons later
frm_plot_on_varlist_2.setLayout(self.lyt_plot_on_varlist_2)
self.frm_plot_area_2, self.fig_2, self.lyt_plot_area_2 = self.make_plot_area()
self.frm_varlist_selected_2, self.lst_varlist_selected_2 = self.make_varlist(txt_header='Select Variable')
self.lyt_plot_on_varlist_2.addWidget(self.frm_plot_area_2, stretch=3)
self.lyt_plot_on_varlist_2.addWidget(self.frm_varlist_selected_2, stretch=1)
# Column 3
frm_plot_on_varlist_3 = qw.QFrame()
self.lyt_plot_on_varlist_3 = qw.QVBoxLayout() # Make this also as self, to add buttons later
frm_plot_on_varlist_3.setLayout(self.lyt_plot_on_varlist_3)
self.frm_plot_area_3, self.fig_3, self.lyt_plot_area_3 = self.make_plot_area()
self.frm_varlist_selected_3, self.lst_varlist_selected_3 = self.make_varlist(txt_header='Select Option')
self.lyt_plot_on_varlist_3.addWidget(self.frm_plot_area_3, stretch=3)
self.lyt_plot_on_varlist_3.addWidget(self.frm_varlist_selected_3, stretch=1)
# Settings
self.sett_menu, self.sett_layout = self.make_settings_menu()
splitter = qw.QSplitter()
splitter.addWidget(self.sett_menu) # Settings
splitter.addWidget(frm_plot_on_varlist_1) # Plot and varlist
splitter.addWidget(frm_plot_on_varlist_2)
splitter.addWidget(frm_plot_on_varlist_3)
splitter.setStretchFactor(0, 1)
splitter.setStretchFactor(1, 1)
splitter.setStretchFactor(2, 1)
splitter.setStretchFactor(3, 1)
return splitter
def template_SVP(self):
self.sett_menu, self.sett_layout = self.make_settings_menu()
self.frm_varlist_available, self.lst_varlist_available = self.make_varlist(txt_header='Available Variables')
......@@ -102,6 +166,37 @@ class buildTab:
splitter.setStretchFactor(2, 4) # Stretch right more than left
return splitter
def template_SVonVPT(self):
self.sett_menu, self.sett_layout = self.make_settings_menu()
# Make varlists in sub-layout
self.frm_varlist_available, self.lst_varlist_available = self.make_varlist(txt_header='Available Variables')
frm_varlists = qw.QFrame()
self.lyt_varlists = qw.QVBoxLayout() # Make this also as self, to add buttons later
frm_varlists.setLayout(self.lyt_varlists)
self.frm_varlist_selected, self.lst_varlist_selected = self.make_varlist(txt_header='Selected Variables')
self.frm_plot_area, self.fig, self.lyt_plot_area = self.make_plot_area()
self.lyt_varlists.addWidget(self.frm_varlist_available, stretch=2)
self.lyt_varlists.addWidget(self.frm_varlist_selected, stretch=1)
frm_textbox = qw.QFrame()
lyt_textbox = qw.QVBoxLayout()
frm_textbox.setLayout(lyt_textbox)
self.txe_textbox = qw.QTextEdit()
lyt_textbox.addWidget(self.txe_textbox)
# Add to Splitter
splitter = qw.QSplitter()
splitter.addWidget(self.sett_menu) # Settings menu (left)
splitter.addWidget(frm_varlists) # Lists of vars
splitter.addWidget(self.frm_plot_area) # List of vars
splitter.addWidget(frm_textbox) # Text area
splitter.setStretchFactor(0, 2)
splitter.setStretchFactor(1, 2)
splitter.setStretchFactor(2, 4) # Stretch more than others
splitter.setStretchFactor(3, 2)
return splitter
def template_SVVP(self):
self.sett_menu, self.sett_layout = self.make_settings_menu()
self.frm_varlist_available, self.lst_varlist_available = self.make_varlist(txt_header='Available Variables')
......@@ -269,6 +364,18 @@ class buildTab:
obj.lst_varlist_available.addItem(item) # add column name to list
list_cols.append(colname_tuple)
@staticmethod
def populate_multiple_variable_lists(obj, lists):
for list in lists:
list.clear()
# list_cols = []
# Add all variables to var list
for ix, colname_tuple in enumerate(obj.tab_data_df.columns):
for list in lists:
item = qw.QListWidgetItem(obj.col_list_pretty[ix])
list.addItem(item) # add column name to list
# list_cols.append(colname_tuple)
@staticmethod
def update_btn_status(obj, target=True, marker=True, export=True):
if target:
......
......@@ -20,13 +20,14 @@ class TopMenu:
# Outlier detection
self.btn_outlierDetDouble_Diff, self.btn_outlierDetIQR, self.btn_outlierRunning, \
self.btn_outlierDetAbsLim = \
self.btn_outlierDetAbsLim, self.btn_outlierSTL = \
self.outlier_detection()
# Analyses
self.btn_analysesAggregator, self.btn_analysesClassFinder, self.btn_analysesGapFinder, \
self.btn_analysesRunLinReg, self.btn_analysesBeforeAfterEvent, \
self.btn_analysesNetGHGBalance, self.btn_analysesUstarDetection = \
self.btn_analysesNetGHGBalance, self.btn_analysesUstarDetection, \
self.btn_analysesExtrEventsFinder = \
self.analyses()
# self.btn_analysesUstarDetectionAuto, self.btn_analysesAggregator, self.btn_analysesNetGHGBalance = \
# self.analyses()
......@@ -40,12 +41,12 @@ class TopMenu:
# Modifications
self.btn_modificationsLimitDatasetTimeRange, self.btn_modificationsConvertUnits, \
self.btn_modificationsRenameVar = \
self.btn_modificationsRenameVar, self.btn_modificationsSetToMissing = \
self.modifications()
# Create variable
self.btn_createVariableDefineSeasons, self.btn_createVariableAddNewEvent, \
self.btn_createVariableTimeSince, self.btn_createVariableFlag = \
self.btn_createVariableTimeSince, self.btn_createVariableFlag, self.btn_createVariableCombineColumns = \
self.create_variable()
# Eddy covariance quality control
......@@ -63,10 +64,9 @@ class TopMenu:
def ec_quality_control(self):
menu = self.mainMenu.addMenu('EC QC')
btn_pipelinesECQC = gui_elements.menu_action(txt='ECQualityControl', menu=menu,
icon=self.ctx.icon_open_in_new_tab)
icon=self.ctx.icon_open_in_new_tab)
return btn_pipelinesECQC
def pipelines(self):
menu = self.mainMenu.addMenu('Pipelines')
btn_pipelinesEthFluxQc = gui_elements.menu_action(txt='ETH Flux QC', menu=menu,
......@@ -127,6 +127,8 @@ class TopMenu:
btn_analysesBeforeAfterEvent.setDisabled(True)
btn_analysesClassFinder = gui_elements.menu_action(txt='Class Finder', menu=menu,
icon=self.ctx.icon_open_in_new_tab)
btn_analysesExtrEventsFinder = gui_elements.menu_action(txt='Extreme Events Finder', menu=menu,
icon=self.ctx.icon_open_in_new_tab)
btn_analysesGapFinder = gui_elements.menu_action(txt='Gap Finder', menu=menu,
icon=self.ctx.icon_open_in_new_tab)
btn_analysesNetGHGBalance = gui_elements.menu_action(txt='Net GHG Balance', menu=menu,
......@@ -142,7 +144,8 @@ class TopMenu:
# btn_analysesUstarDetectionAuto = gui_elements.menu_action(txt='Ustar Threshold Detection', menu=menu,
# icon=self.ctx.icon_open_in_new_tab)
return btn_analysesAggregator, btn_analysesClassFinder, btn_analysesGapFinder, btn_analysesRunLinReg, \
btn_analysesBeforeAfterEvent, btn_analysesNetGHGBalance, btn_analysesUstarDetection
btn_analysesBeforeAfterEvent, btn_analysesNetGHGBalance, btn_analysesUstarDetection, \
btn_analysesExtrEventsFinder
# return btn_analysesUstarDetectionAuto, btn_analysesAggregator, btn_analysesNetGHGBalance
def gap_filling(self):
......@@ -174,12 +177,18 @@ class TopMenu:
menu=menu, icon=self.ctx.icon_open_in_new_tab)
btn_modificationsRenameVar = gui_elements.menu_action(txt='Rename Variables',
menu=menu, icon=self.ctx.icon_open_in_new_tab)
return btn_modificationsLimitDatasetTimeRange, btn_modificationsConvertUnits, btn_modificationsRenameVar
btn_modificationsSetToMissing = gui_elements.menu_action(txt='Set To Missing',
menu=menu, icon=self.ctx.icon_open_in_new_tab)
return btn_modificationsLimitDatasetTimeRange, btn_modificationsConvertUnits, btn_modificationsRenameVar, \
btn_modificationsSetToMissing
def create_variable(self):
menu = self.mainMenu.addMenu('Create Variable')
btn_modificationsAddNewEvent = gui_elements.menu_action(txt='Add New Event',
menu=menu, icon=self.ctx.icon_btn_new_window)
btn_createVariableCombineColumns = gui_elements.menu_action(txt='Combine Columns',
menu=menu,
icon=self.ctx.icon_open_in_new_tab)
btn_createVariableDefineSeasons = gui_elements.menu_action(txt='Define Seasons',
menu=menu,
icon=self.ctx.icon_open_in_new_tab)
......@@ -191,7 +200,7 @@ class TopMenu:
icon=self.ctx.icon_open_in_new_tab)
btn_createVariableFlag.setDisabled(True)
return btn_createVariableDefineSeasons, btn_modificationsAddNewEvent, btn_createVariableTimeSince, \
btn_createVariableFlag
btn_createVariableFlag, btn_createVariableCombineColumns
def export(self):
menu = self.mainMenu.addMenu('Export')
......@@ -205,16 +214,21 @@ class TopMenu:
btn_outlierDetAbsLim = gui_elements.menu_action(txt='Absolute Limits',
menu=menu,
icon=self.ctx.icon_open_in_new_tab)
btn_outlierDetDouble_Diff = gui_elements.menu_action(txt='Double-differenced Time Series',
menu=menu,
icon=self.ctx.icon_open_in_new_tab)
btn_outlierDetIQR = gui_elements.menu_action(txt='Interquartile Range',
menu=menu,
icon=self.ctx.icon_open_in_new_tab)
btn_outlierSTL = gui_elements.menu_action(txt='Seasonal-Trend Decomposition (LOESS)',
menu=menu,
icon=self.ctx.icon_open_in_new_tab)
btn_outlierRunning = gui_elements.menu_action(txt='Running',
menu=menu,
icon=self.ctx.icon_open_in_new_tab)
btn_outlierDetDouble_Diff = gui_elements.menu_action(txt='Double-differenced Time Series',
menu=menu,
icon=self.ctx.icon_open_in_new_tab)
return btn_outlierDetDouble_Diff, btn_outlierDetIQR, btn_outlierRunning, btn_outlierDetAbsLim
menu=menu,
icon=self.ctx.icon_open_in_new_tab)
return btn_outlierDetDouble_Diff, btn_outlierDetIQR, btn_outlierRunning, btn_outlierDetAbsLim, \
btn_outlierSTL
# def get(self):
# return self.mainMenu
......@@ -82,3 +82,12 @@ ssitc = \
" Arbeitsergebnisse Nr. 46, Univ. Bayreuth\n" \
" https://epub.uni-bayreuth.de/2130/\n" \
" http://www.bayceer.uni-bayreuth.de/mm/de/software/software/software_dl.php?id_obj=96792"
double_diff = \
"Source:\n" \
" Papale, D. et al. (2006). Towards a standardized processing of Net Ecosystem Exchange\n" \
" measured with eddy covariance technique: algorithms and uncertainty estimation.\n" \
" Biogeosciences, 3(4), 571–583. https://doi.org/10.5194/bg-3-571-2006\n" \
" Sachs, L. (1997). Angewandte Statistik. Springer Berlin Heidelberg.\n" \
" https://doi.org/10.1007/978-3-662-05746-9"
......@@ -147,6 +147,7 @@ def parse_csv_file(filepath, settings_dict):
parsed_index_col = ('index', '[parsed]')
parse_dates = settings_dict['TIMESTAMP_INDEX_COLUMN']
parse_dates = {parsed_index_col: parse_dates}
# date_parser = lambda x: dt.datetime.strptime(x, '%Y %m %d %H %M %S')
date_parser = lambda x: dt.datetime.strptime(x, settings_dict['TIMESTAMP_DATETIME_FORMAT'])
data_df = pd.read_csv(filepath,
......@@ -658,7 +659,7 @@ def generate_freq_str(to_freq):
return freq_str
def resample_df(df, freq_str, agg_method, min_vals, out_timestamp_convention, to_freq_duration, to_freq):
def resample_df(df, freq_str, agg_method, min_vals, to_freq_duration, to_freq):
"""
Resample data to selected frequency, using the selected aggregation method
and while also considering the minimum required values in the aggregation
......@@ -728,15 +729,14 @@ def resample_df(df, freq_str, agg_method, min_vals, out_timestamp_convention, to
# TIMESTAMP CONVENTION
# --------------------
agg_df, timestamp_info_df = timestamp_convention(df=agg_df, out_timestamp_convention=out_timestamp_convention,
timestamp_shows_start=timestamp_shows_start)
agg_df, timestamp_info_df = timestamp_convention(df=agg_df, timestamp_shows_start=timestamp_shows_start)
agg_df.index = pd.to_datetime(agg_df.index)
return agg_df, timestamp_info_df
def timestamp_convention(df, out_timestamp_convention, timestamp_shows_start):
def timestamp_convention(df, timestamp_shows_start):
original_cols = df.columns
df.index = pd.to_datetime(df.index)
......@@ -783,8 +783,8 @@ def timestamp_convention(df, out_timestamp_convention, timestamp_shows_start):
# APPLY
# -----
# according to selected convention
if out_timestamp_convention == 'Middle of Record':
df.index = df[middle]
# if out_timestamp_convention == 'Middle of Record':
# df.index = df[middle]
# elif out_timestamp_convention == 'End of Record':
# df.index = df[end]
# elif out_timestamp_convention == 'Start of Record':
......@@ -925,6 +925,7 @@ def limit_data_range_percentiles(df, col, perc_limits):
df = df[p_filter]
return df
def export_to_main(main_df, export_df, tab_data_df):
"""Rename cols so there is no overlap with other vars"""
mapping_dict = {}
......@@ -940,4 +941,4 @@ def export_to_main(main_df, export_df, tab_data_df):
for newcol in export_df.columns:
main_df[newcol] = np.nan
main_df = main_df.combine_first(export_df)
return main_df
\ No newline at end of file
return main_df
from gui.DialogWindows.SelectFileTypeSettings import SelectFileTypeSettings
def load(file, ctx):
""" Load example files from resources. """
# settings_file_path = Path(root_dir) / 'inout' / 'FileTypes' / f"{file}.filetype"
# settings_file_path = ctx.filetype_AmpCSV_30T
# settings_dict = SelectFileTypeSettings.read_settings_from_file(filepath=settings_file_path)
# SMEAR_II_smeardata_19960101120000.csv
if file == 'AmpCSV_30T':
settings_dict = SelectFileTypeSettings.read_settings_from_file(filepath=ctx.filetype_AmpCSV_30T)
initial_data = ctx.file_AmpCSV_30T
elif file == 'SMEAR_II_30MIN':
settings_dict = SelectFileTypeSettings.read_settings_from_file(filepath=ctx.filetype_SMEAR_II_30MIN)
initial_data = ctx.file_SMEAR_II_30MIN
elif file == 'Custom_AmpCSV_30T_with_secs':
settings_dict = SelectFileTypeSettings.read_settings_from_file(filepath=ctx.Custom_AmpCSV_30T_with_secs)
initial_data = ctx.file_Custom_AmpCSV_30T_with_secs
......