From 223c1c4a5352d9d0e8593f8bb20d34ed181887e7 Mon Sep 17 00:00:00 2001 From: Lazarus Kioko Muthenya Date: Thu, 7 Jun 2018 12:29:42 +0300 Subject: [PATCH 01/18] Setting up Year as Factor option --- instat/dlgClimaticBoxPlot.vb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/instat/dlgClimaticBoxPlot.vb b/instat/dlgClimaticBoxPlot.vb index c471ac2638f..d5f7eb7480b 100644 --- a/instat/dlgClimaticBoxPlot.vb +++ b/instat/dlgClimaticBoxPlot.vb @@ -40,12 +40,14 @@ Public Class dlgClimaticBoxPlot Private clsFilteredDataOperator As New ROperator Private clsFilterElementOperator As New ROperator Private clsFilterElementFunction As New RFunction + Private clsAsFactorFunction As New RFunction Private strFacetRow As String = "Facet Row" Private strFacetCol As String = "Facet Column" Private strXAxis As String = "X Axis" Private strColour As String = "Colour Axis" Private strNone As String = "None" + Private strXasFactor As String = "X Axis Factor" Private bUpdateComboOptions As Boolean = True Private bUpdatingParameters As Boolean = False @@ -97,7 +99,7 @@ Public Class dlgClimaticBoxPlot ucrReceiverStation.AddIncludedMetadataProperty("Climatic_Type", {Chr(34) & "station" & Chr(34)}) ucrReceiverStation.bAutoFill = True ucrReceiverStation.bWithQuotes = False - ucrReceiverWithinYear.SetIncludedDataTypes({"factor"}) + ucrReceiverStation.SetIncludedDataTypes({"factor"}) ucrReceiverStation.strSelectorHeading = "Station Variables" ucrReceiverYear.SetParameterIsString() @@ -106,7 +108,7 @@ Public Class dlgClimaticBoxPlot ucrReceiverYear.AddIncludedMetadataProperty("Climatic_Type", {Chr(34) & "year" & Chr(34)}) ucrReceiverYear.bAutoFill = True ucrReceiverYear.bWithQuotes = False - ucrReceiverYear.SetIncludedDataTypes({"factor"}) + ucrReceiverYear.SetIncludedDataTypes({"numeric"}) ucrReceiverYear.strSelectorHeading = "Year Variables" ucrReceiverWithinYear.SetParameter(New RParameter("x", 1)) @@ -119,7 +121,7 @@ Public Class dlgClimaticBoxPlot ucrReceiverWithinYear.bAddParameterIfEmpty = True ' summary - ucrReceiverElement.SetParameter(New RParameter("y", 1)) + ucrReceiverElement.SetParameter(New RParameter("y", 0)) ucrReceiverElement.SetParameterIsString() ucrReceiverElement.bWithQuotes = False ucrReceiverElement.strSelectorHeading = "Variables" @@ -174,7 +176,7 @@ Public Class dlgClimaticBoxPlot ucrInputStation.SetItems({strXAxis, strColour, strFacetRow, strFacetCol, strNone}) ucrInputStation.SetDropDownStyleAsNonEditable() - ucrInputYear.SetItems({strXAxis, strColour, strFacetRow, strFacetCol, strNone}) + ucrInputYear.SetItems({strXAxis, strXasFactor, strColour, strFacetRow, strFacetCol, strNone}) ucrInputYear.SetDropDownStyleAsNonEditable() ucrInputWithinYear.SetItems({strXAxis, strColour, strFacetRow, strFacetCol, strNone}) @@ -201,6 +203,7 @@ Public Class dlgClimaticBoxPlot clsFilteredDataOperator = New ROperator clsFilterElementOperator = New ROperator clsFilterElementFunction = New RFunction + clsAsFactorFunction = New RFunction clsFacetFunction.SetPackageName("ggplot2") clsFacetFunction.SetRCommand("facet_grid") @@ -252,6 +255,8 @@ Public Class dlgClimaticBoxPlot clsRaesFunction.SetRCommand("aes") clsRaesFunction.AddParameter("x", Chr(34) & Chr(34)) + clsAsFactorFunction.SetRCommand("as.factor") + clsRgeomPlotFunction.SetPackageName("ggplot2") clsRgeomPlotFunction.SetRCommand("geom_boxplot") clsRgeomPlotFunction.AddParameter("varwidth", "FALSE", iPosition:=0) @@ -411,6 +416,11 @@ Public Class dlgClimaticBoxPlot dctComboReceiver(ucrInputTemp).ChangeParameterName("x") dctComboReceiver(ucrInputTemp).SetParameterIncludeArgumentName(True) dctComboReceiver(ucrInputTemp).SetRCode(clsRaesFunction) + ElseIf strTemp = strXasFactor Then + dctComboReceiver(ucrInputTemp).ChangeParameterName("x") + dctComboReceiver(ucrInputTemp).SetParameterIncludeArgumentName(False) + dctComboReceiver(ucrInputTemp).SetRCode(clsAsFactorFunction) + clsRaesFunction.AddParameter("x", clsRFunctionParameter:=clsAsFactorFunction, iPosition:=1) ElseIf strTemp = strColour Then If rdoJitter.Checked Then dctComboReceiver(ucrInputTemp).ChangeParameterName("color") From def96bb77da45377c2fc178b71f9f6a873d8065d Mon Sep 17 00:00:00 2001 From: Lazarus Kioko Muthenya Date: Thu, 7 Jun 2018 20:50:27 +0300 Subject: [PATCH 02/18] Setting up the option of year as a factor --- instat/dlgClimaticBoxPlot.vb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/instat/dlgClimaticBoxPlot.vb b/instat/dlgClimaticBoxPlot.vb index d5f7eb7480b..764caf4b049 100644 --- a/instat/dlgClimaticBoxPlot.vb +++ b/instat/dlgClimaticBoxPlot.vb @@ -388,6 +388,9 @@ Public Class dlgClimaticBoxPlot ucrInputTemp.SetName(strNone) bUpdateComboOptions = True End If + If strChangedText = strXasFactor AndAlso ucrInputTemp.GetText = strXAxis OrElse strChangedText = strXAxis AndAlso ucrInputTemp.GetText = strXasFactor Then + ucrInputTemp.SetName(strNone) + End If Next End If UpdateParameters() From ac403298ce3eb9f56d415ad158f113c00a5cdbfe Mon Sep 17 00:00:00 2001 From: Lazarus Kioko Muthenya Date: Thu, 7 Jun 2018 22:32:53 +0300 Subject: [PATCH 03/18] Including factor as a data type in the year receiver --- instat/dlgClimaticBoxPlot.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgClimaticBoxPlot.vb b/instat/dlgClimaticBoxPlot.vb index 764caf4b049..bf5625401df 100644 --- a/instat/dlgClimaticBoxPlot.vb +++ b/instat/dlgClimaticBoxPlot.vb @@ -108,7 +108,7 @@ Public Class dlgClimaticBoxPlot ucrReceiverYear.AddIncludedMetadataProperty("Climatic_Type", {Chr(34) & "year" & Chr(34)}) ucrReceiverYear.bAutoFill = True ucrReceiverYear.bWithQuotes = False - ucrReceiverYear.SetIncludedDataTypes({"numeric"}) + ucrReceiverYear.SetIncludedDataTypes({"numeric", "factor"}) ucrReceiverYear.strSelectorHeading = "Year Variables" ucrReceiverWithinYear.SetParameter(New RParameter("x", 1)) From 89413c90ea27303e107158a8798d8e2e06852c14 Mon Sep 17 00:00:00 2001 From: Lazarus Kioko Muthenya Date: Fri, 8 Jun 2018 17:38:41 +0300 Subject: [PATCH 04/18] Setting up the facet_wrap option --- instat/dlgClimaticBoxPlot.vb | 43 +++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/instat/dlgClimaticBoxPlot.vb b/instat/dlgClimaticBoxPlot.vb index bf5625401df..ca32fa9c6c3 100644 --- a/instat/dlgClimaticBoxPlot.vb +++ b/instat/dlgClimaticBoxPlot.vb @@ -42,6 +42,7 @@ Public Class dlgClimaticBoxPlot Private clsFilterElementFunction As New RFunction Private clsAsFactorFunction As New RFunction + Private strFacetWrap As String = "Facet Wrap" Private strFacetRow As String = "Facet Row" Private strFacetCol As String = "Facet Column" Private strXAxis As String = "X Axis" @@ -173,13 +174,13 @@ Public Class dlgClimaticBoxPlot ucrChkVerticalXTickMarkers.SetText("Vertical X Tick Markers") ucrChkVerticalXTickMarkers.SetParameter(clsThemeParam, bNewAddRemoveParameter:=True, bNewChangeParameterValue:=False) - ucrInputStation.SetItems({strXAxis, strColour, strFacetRow, strFacetCol, strNone}) + ucrInputStation.SetItems({strXAxis, strColour, strFacetWrap, strFacetRow, strFacetCol, strNone}) ucrInputStation.SetDropDownStyleAsNonEditable() - ucrInputYear.SetItems({strXAxis, strXasFactor, strColour, strFacetRow, strFacetCol, strNone}) + ucrInputYear.SetItems({strXAxis, strXasFactor, strColour, strFacetWrap, strFacetRow, strFacetCol, strNone}) ucrInputYear.SetDropDownStyleAsNonEditable() - ucrInputWithinYear.SetItems({strXAxis, strColour, strFacetRow, strFacetCol, strNone}) + ucrInputWithinYear.SetItems({strXAxis, strColour, strFacetWrap, strFacetRow, strFacetCol, strNone}) ucrInputWithinYear.SetDropDownStyleAsNonEditable() ucrSavePlot.SetPrefix("boxplot") @@ -206,7 +207,6 @@ Public Class dlgClimaticBoxPlot clsAsFactorFunction = New RFunction clsFacetFunction.SetPackageName("ggplot2") - clsFacetFunction.SetRCommand("facet_grid") clsFacetRowOp.SetOperation("+") clsFacetRowOp.bBrackets = False clsFacetColOp.SetOperation("+") @@ -214,8 +214,6 @@ Public Class dlgClimaticBoxPlot clsFacetOp.SetOperation("~") clsFacetOp.bForceIncludeOperation = True clsFacetOp.bBrackets = False - clsFacetOp.AddParameter("left", clsROperatorParameter:=clsFacetRowOp, iPosition:=0) - clsFacetOp.AddParameter("right", clsROperatorParameter:=clsFacetColOp, iPosition:=1) clsFacetFunction.AddParameter("facets", clsROperatorParameter:=clsFacetOp) clsFilterElementOperator.SetOperation(">") @@ -339,6 +337,7 @@ Public Class dlgClimaticBoxPlot End If End If UpdateParameters() + AddRemoveFacets() End Sub Private Sub cmdBoxPlotOptions_Click(sender As Object, e As EventArgs) Handles cmdBoxPlotOptions.Click @@ -391,6 +390,9 @@ Public Class dlgClimaticBoxPlot If strChangedText = strXasFactor AndAlso ucrInputTemp.GetText = strXAxis OrElse strChangedText = strXAxis AndAlso ucrInputTemp.GetText = strXasFactor Then ucrInputTemp.SetName(strNone) End If + If strChangedText = strFacetWrap AndAlso ucrInputTemp.GetText = strFacetRow OrElse strChangedText = strFacetRow AndAlso ucrInputTemp.GetText = strFacetWrap OrElse strChangedText = strFacetWrap AndAlso ucrInputTemp.GetText = strFacetCol OrElse strChangedText = strFacetCol AndAlso ucrInputTemp.GetText = strFacetWrap Then + ucrInputTemp.SetName(strNone) + End If Next End If UpdateParameters() @@ -406,6 +408,7 @@ Public Class dlgClimaticBoxPlot clsRaesFunction.RemoveParameterByName("fill") For Each ucrInputTemp As ucrInputComboBox In dctComboReceiver.Keys + clsFacetOp.RemoveParameterByName("wrap" & ucrInputTemp.Name) clsFacetColOp.RemoveParameterByName("col" & ucrInputTemp.Name) clsFacetRowOp.RemoveParameterByName("row" & ucrInputTemp.Name) Next @@ -433,6 +436,9 @@ Public Class dlgClimaticBoxPlot dctComboReceiver(ucrInputTemp).SetParameterIncludeArgumentName(True) End If dctComboReceiver(ucrInputTemp).SetRCode(clsRaesFunction) + ElseIf strTemp = strFacetWrap Then + dctComboReceiver(ucrInputTemp).ChangeParameterName("wrap" & ucrInputTemp.Name) + dctComboReceiver(ucrInputTemp).SetRCode(clsFacetOp) ElseIf strTemp = strFacetCol Then dctComboReceiver(ucrInputTemp).ChangeParameterName("col" & ucrInputTemp.Name) dctComboReceiver(ucrInputTemp).SetRCode(clsFacetColOp) @@ -457,6 +463,7 @@ Public Class dlgClimaticBoxPlot Private Sub AddRemoveFacets() Dim strText As String + Dim bWrap As Boolean = False Dim bCol As Boolean = False Dim bRow As Boolean = False @@ -464,7 +471,10 @@ Public Class dlgClimaticBoxPlot clsBaseOperator.RemoveParameterByName("facets") For Each kvpTemp As KeyValuePair(Of ucrInputComboBox, ucrReceiverSingle) In dctComboReceiver strText = kvpTemp.Key.GetText() - If strText = strFacetCol OrElse strText = strFacetRow AndAlso Not kvpTemp.Value.IsEmpty Then + If strText = strFacetWrap OrElse strText = strFacetCol OrElse strText = strFacetRow AndAlso Not kvpTemp.Value.IsEmpty Then + If strText = strFacetWrap Then + bWrap = True + End If If strText = strFacetCol Then bCol = True End If @@ -473,18 +483,31 @@ Public Class dlgClimaticBoxPlot End If End If Next - If bRow OrElse bCol Then + If bWrap OrElse bRow OrElse bCol Then clsBaseOperator.AddParameter("facets", clsRFunctionParameter:=clsFacetFunction) End If + If bWrap Then + clsFacetFunction.SetRCommand("facet_wrap") + clsFacetOp.AddParameter("wrap", iPosition:=0) + Else + clsFacetOp.RemoveParameterByName("wrap") + End If + If bRow OrElse bCol Then + clsFacetFunction.SetRCommand("facet_grid") + End If If bRow Then clsFacetOp.AddParameter("left", clsROperatorParameter:=clsFacetRowOp, iPosition:=0) - Else + ElseIf bCol AndAlso bWrap = False Then clsFacetOp.AddParameter("left", ".", iPosition:=0) + Else + clsFacetOp.RemoveParameterByName("left") End If If bCol Then clsFacetOp.AddParameter("right", clsROperatorParameter:=clsFacetColOp, iPosition:=1) - Else + ElseIf bRow AndAlso bWrap = False Then clsFacetOp.AddParameter("right", ".", iPosition:=1) + Else + clsFacetOp.RemoveParameterByName("right") End If End If End Sub From 00d30e415247a143efe64b154a55f0cd63e74ded Mon Sep 17 00:00:00 2001 From: Lazarus Kioko Muthenya Date: Thu, 21 Jun 2018 12:18:07 +0300 Subject: [PATCH 05/18] Setting the element receiver as initial focus --- instat/dlgClimaticBoxPlot.Designer.vb | 176 ++++++------ instat/dlgClimaticBoxPlot.resx | 400 +++++++++++++------------- instat/dlgClimaticBoxPlot.vb | 22 +- 3 files changed, 299 insertions(+), 299 deletions(-) diff --git a/instat/dlgClimaticBoxPlot.Designer.vb b/instat/dlgClimaticBoxPlot.Designer.vb index d949c0bfc93..141d4aec0da 100644 --- a/instat/dlgClimaticBoxPlot.Designer.vb +++ b/instat/dlgClimaticBoxPlot.Designer.vb @@ -33,16 +33,8 @@ Partial Class dlgClimaticBoxPlot Me.lblYear = New System.Windows.Forms.Label() Me.lblDate = New System.Windows.Forms.Label() Me.lblStation = New System.Windows.Forms.Label() - Me.ucrChkOmitBelow = New instat.ucrCheck() - Me.ucrNudOmitBelow = New instat.ucrNud() Me.ucrInputWithinYear = New instat.ucrInputComboBox() Me.ucrInputYear = New instat.ucrInputComboBox() - Me.ucrInputStation = New instat.ucrInputComboBox() - Me.ucrReceiverWithinYear = New instat.ucrReceiverSingle() - Me.ucrReceiverElement = New instat.ucrReceiverSingle() - Me.ucrReceiverYear = New instat.ucrReceiverSingle() - Me.ucrReceiverDate = New instat.ucrReceiverSingle() - Me.ucrReceiverStation = New instat.ucrReceiverSingle() Me.ucrChkVerticalXTickMarkers = New instat.ucrCheck() Me.ucrPnlPlots = New instat.UcrPanel() Me.ucrBase = New instat.ucrButtons() @@ -50,6 +42,14 @@ Partial Class dlgClimaticBoxPlot Me.ucrChkHorizontalBoxplot = New instat.ucrCheck() Me.ucrChkVarWidth = New instat.ucrCheck() Me.ucrSelectorClimaticBoxPlot = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrChkOmitBelow = New instat.ucrCheck() + Me.ucrNudOmitBelow = New instat.ucrNud() + Me.ucrInputStation = New instat.ucrInputComboBox() + Me.ucrReceiverElement = New instat.ucrReceiverSingle() + Me.ucrReceiverStation = New instat.ucrReceiverSingle() + Me.ucrReceiverDate = New instat.ucrReceiverSingle() + Me.ucrReceiverYear = New instat.ucrReceiverSingle() + Me.ucrReceiverWithinYear = New instat.ucrReceiverSingle() Me.SuspendLayout() ' 'cmdBoxPlotOptions @@ -121,22 +121,6 @@ Partial Class dlgClimaticBoxPlot resources.ApplyResources(Me.lblStation, "lblStation") Me.lblStation.Name = "lblStation" ' - 'ucrChkOmitBelow - ' - Me.ucrChkOmitBelow.Checked = False - resources.ApplyResources(Me.ucrChkOmitBelow, "ucrChkOmitBelow") - Me.ucrChkOmitBelow.Name = "ucrChkOmitBelow" - ' - 'ucrNudOmitBelow - ' - Me.ucrNudOmitBelow.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudOmitBelow.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - resources.ApplyResources(Me.ucrNudOmitBelow, "ucrNudOmitBelow") - Me.ucrNudOmitBelow.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudOmitBelow.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudOmitBelow.Name = "ucrNudOmitBelow" - Me.ucrNudOmitBelow.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' 'ucrInputWithinYear ' Me.ucrInputWithinYear.AddQuotesIfUnrecognised = True @@ -151,58 +135,6 @@ Partial Class dlgClimaticBoxPlot resources.ApplyResources(Me.ucrInputYear, "ucrInputYear") Me.ucrInputYear.Name = "ucrInputYear" ' - 'ucrInputStation - ' - Me.ucrInputStation.AddQuotesIfUnrecognised = True - Me.ucrInputStation.IsReadOnly = False - resources.ApplyResources(Me.ucrInputStation, "ucrInputStation") - Me.ucrInputStation.Name = "ucrInputStation" - ' - 'ucrReceiverWithinYear - ' - Me.ucrReceiverWithinYear.frmParent = Me - resources.ApplyResources(Me.ucrReceiverWithinYear, "ucrReceiverWithinYear") - Me.ucrReceiverWithinYear.Name = "ucrReceiverWithinYear" - Me.ucrReceiverWithinYear.Selector = Nothing - Me.ucrReceiverWithinYear.strNcFilePath = "" - Me.ucrReceiverWithinYear.ucrSelector = Nothing - ' - 'ucrReceiverElement - ' - Me.ucrReceiverElement.frmParent = Me - resources.ApplyResources(Me.ucrReceiverElement, "ucrReceiverElement") - Me.ucrReceiverElement.Name = "ucrReceiverElement" - Me.ucrReceiverElement.Selector = Nothing - Me.ucrReceiverElement.strNcFilePath = "" - Me.ucrReceiverElement.ucrSelector = Nothing - ' - 'ucrReceiverYear - ' - Me.ucrReceiverYear.frmParent = Me - resources.ApplyResources(Me.ucrReceiverYear, "ucrReceiverYear") - Me.ucrReceiverYear.Name = "ucrReceiverYear" - Me.ucrReceiverYear.Selector = Nothing - Me.ucrReceiverYear.strNcFilePath = "" - Me.ucrReceiverYear.ucrSelector = Nothing - ' - 'ucrReceiverDate - ' - Me.ucrReceiverDate.frmParent = Me - resources.ApplyResources(Me.ucrReceiverDate, "ucrReceiverDate") - Me.ucrReceiverDate.Name = "ucrReceiverDate" - Me.ucrReceiverDate.Selector = Nothing - Me.ucrReceiverDate.strNcFilePath = "" - Me.ucrReceiverDate.ucrSelector = Nothing - ' - 'ucrReceiverStation - ' - Me.ucrReceiverStation.frmParent = Me - resources.ApplyResources(Me.ucrReceiverStation, "ucrReceiverStation") - Me.ucrReceiverStation.Name = "ucrReceiverStation" - Me.ucrReceiverStation.Selector = Nothing - Me.ucrReceiverStation.strNcFilePath = "" - Me.ucrReceiverStation.ucrSelector = Nothing - ' 'ucrChkVerticalXTickMarkers ' Me.ucrChkVerticalXTickMarkers.Checked = False @@ -238,31 +170,99 @@ Partial Class dlgClimaticBoxPlot ' 'ucrSelectorClimaticBoxPlot ' - 'Me.ucrSelectorClimaticBoxPlot.bDropUnusedFilterLevels = False + Me.ucrSelectorClimaticBoxPlot.bDropUnusedFilterLevels = False Me.ucrSelectorClimaticBoxPlot.bShowHiddenColumns = False Me.ucrSelectorClimaticBoxPlot.bUseCurrentFilter = True resources.ApplyResources(Me.ucrSelectorClimaticBoxPlot, "ucrSelectorClimaticBoxPlot") Me.ucrSelectorClimaticBoxPlot.Name = "ucrSelectorClimaticBoxPlot" ' + 'ucrChkOmitBelow + ' + Me.ucrChkOmitBelow.Checked = False + resources.ApplyResources(Me.ucrChkOmitBelow, "ucrChkOmitBelow") + Me.ucrChkOmitBelow.Name = "ucrChkOmitBelow" + ' + 'ucrNudOmitBelow + ' + Me.ucrNudOmitBelow.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudOmitBelow.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + resources.ApplyResources(Me.ucrNudOmitBelow, "ucrNudOmitBelow") + Me.ucrNudOmitBelow.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudOmitBelow.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudOmitBelow.Name = "ucrNudOmitBelow" + Me.ucrNudOmitBelow.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrInputStation + ' + Me.ucrInputStation.AddQuotesIfUnrecognised = True + Me.ucrInputStation.IsReadOnly = False + resources.ApplyResources(Me.ucrInputStation, "ucrInputStation") + Me.ucrInputStation.Name = "ucrInputStation" + ' + 'ucrReceiverElement + ' + Me.ucrReceiverElement.frmParent = Me + resources.ApplyResources(Me.ucrReceiverElement, "ucrReceiverElement") + Me.ucrReceiverElement.Name = "ucrReceiverElement" + Me.ucrReceiverElement.Selector = Nothing + Me.ucrReceiverElement.strNcFilePath = "" + Me.ucrReceiverElement.ucrSelector = Nothing + ' + 'ucrReceiverStation + ' + Me.ucrReceiverStation.frmParent = Me + resources.ApplyResources(Me.ucrReceiverStation, "ucrReceiverStation") + Me.ucrReceiverStation.Name = "ucrReceiverStation" + Me.ucrReceiverStation.Selector = Nothing + Me.ucrReceiverStation.strNcFilePath = "" + Me.ucrReceiverStation.ucrSelector = Nothing + ' + 'ucrReceiverDate + ' + Me.ucrReceiverDate.frmParent = Me + resources.ApplyResources(Me.ucrReceiverDate, "ucrReceiverDate") + Me.ucrReceiverDate.Name = "ucrReceiverDate" + Me.ucrReceiverDate.Selector = Nothing + Me.ucrReceiverDate.strNcFilePath = "" + Me.ucrReceiverDate.ucrSelector = Nothing + ' + 'ucrReceiverYear + ' + Me.ucrReceiverYear.frmParent = Me + resources.ApplyResources(Me.ucrReceiverYear, "ucrReceiverYear") + Me.ucrReceiverYear.Name = "ucrReceiverYear" + Me.ucrReceiverYear.Selector = Nothing + Me.ucrReceiverYear.strNcFilePath = "" + Me.ucrReceiverYear.ucrSelector = Nothing + ' + 'ucrReceiverWithinYear + ' + Me.ucrReceiverWithinYear.frmParent = Me + resources.ApplyResources(Me.ucrReceiverWithinYear, "ucrReceiverWithinYear") + Me.ucrReceiverWithinYear.Name = "ucrReceiverWithinYear" + Me.ucrReceiverWithinYear.Selector = Nothing + Me.ucrReceiverWithinYear.strNcFilePath = "" + Me.ucrReceiverWithinYear.ucrSelector = Nothing + ' 'dlgClimaticBoxPlot ' resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrReceiverWithinYear) + Me.Controls.Add(Me.ucrReceiverYear) + Me.Controls.Add(Me.ucrReceiverDate) + Me.Controls.Add(Me.ucrReceiverStation) + Me.Controls.Add(Me.ucrReceiverElement) Me.Controls.Add(Me.ucrChkOmitBelow) Me.Controls.Add(Me.ucrNudOmitBelow) Me.Controls.Add(Me.ucrInputWithinYear) Me.Controls.Add(Me.ucrInputYear) Me.Controls.Add(Me.ucrInputStation) - Me.Controls.Add(Me.ucrReceiverWithinYear) Me.Controls.Add(Me.lblWithinYear) Me.Controls.Add(Me.lblElement) Me.Controls.Add(Me.lblYear) Me.Controls.Add(Me.lblDate) Me.Controls.Add(Me.lblStation) - Me.Controls.Add(Me.ucrReceiverElement) - Me.Controls.Add(Me.ucrReceiverYear) - Me.Controls.Add(Me.ucrReceiverDate) - Me.Controls.Add(Me.ucrReceiverStation) Me.Controls.Add(Me.ucrChkVerticalXTickMarkers) Me.Controls.Add(Me.rdoViolin) Me.Controls.Add(Me.rdoJitter) @@ -295,19 +295,19 @@ Partial Class dlgClimaticBoxPlot Friend WithEvents rdoBoxplot As RadioButton Friend WithEvents ucrPnlPlots As UcrPanel Friend WithEvents ucrChkVerticalXTickMarkers As ucrCheck - Friend WithEvents ucrReceiverWithinYear As ucrReceiverSingle Friend WithEvents lblWithinYear As Label Friend WithEvents lblElement As Label Friend WithEvents lblYear As Label Friend WithEvents lblDate As Label Friend WithEvents lblStation As Label - Friend WithEvents ucrReceiverElement As ucrReceiverSingle - Friend WithEvents ucrReceiverYear As ucrReceiverSingle - Friend WithEvents ucrReceiverDate As ucrReceiverSingle - Friend WithEvents ucrReceiverStation As ucrReceiverSingle Friend WithEvents ucrInputWithinYear As ucrInputComboBox Friend WithEvents ucrInputYear As ucrInputComboBox - Friend WithEvents ucrInputStation As ucrInputComboBox Friend WithEvents ucrChkOmitBelow As ucrCheck Friend WithEvents ucrNudOmitBelow As ucrNud + Friend WithEvents ucrInputStation As ucrInputComboBox + Friend WithEvents ucrReceiverElement As ucrReceiverSingle + Friend WithEvents ucrReceiverWithinYear As ucrReceiverSingle + Friend WithEvents ucrReceiverYear As ucrReceiverSingle + Friend WithEvents ucrReceiverDate As ucrReceiverSingle + Friend WithEvents ucrReceiverStation As ucrReceiverSingle End Class diff --git a/instat/dlgClimaticBoxPlot.resx b/instat/dlgClimaticBoxPlot.resx index 774c120e9db..ea43420f50c 100644 --- a/instat/dlgClimaticBoxPlot.resx +++ b/instat/dlgClimaticBoxPlot.resx @@ -130,7 +130,7 @@ - 9 + 20 Boxplot Options @@ -157,7 +157,7 @@ 120, 25 - 10 + 21 Plot Options @@ -295,7 +295,7 @@ 65, 13 - 27 + 17 Within Year: @@ -310,7 +310,7 @@ $this - 6 + 10 True @@ -325,7 +325,7 @@ 48, 13 - 21 + 10 Element: @@ -340,7 +340,7 @@ $this - 7 + 11 True @@ -355,7 +355,7 @@ 32, 13 - 23 + 14 Year: @@ -370,7 +370,7 @@ $this - 8 + 12 True @@ -385,7 +385,7 @@ 33, 13 - 19 + 8 Date: @@ -400,7 +400,7 @@ $this - 9 + 13 True @@ -415,7 +415,7 @@ 43, 13 - 17 + 5 Station: @@ -430,49 +430,7 @@ $this - 10 - - - 245, 186 - - - 100, 20 - - - 33 - - - ucrChkOmitBelow - - - instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 0 - - - 367, 186 - - - 48, 20 - - - 32 - - - ucrNudOmitBelow - - - instat.ucrNud, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 1 + 14 367, 285 @@ -481,7 +439,7 @@ 82, 21 - 31 + 19 ucrInputWithinYear @@ -493,7 +451,7 @@ $this - 2 + 7 367, 242 @@ -502,7 +460,7 @@ 82, 21 - 30 + 16 ucrInputYear @@ -514,133 +472,7 @@ $this - 3 - - - 367, 80 - - - 82, 21 - - - 29 - - - ucrInputStation - - - instat.ucrInputComboBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 4 - - - True - - - 6, 13 - - - 475, 469 - - - 242, 163 - - - 0, 0, 0, 0 - - - 120, 20 - - - 22 - - - ucrReceiverElement - - - instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 11 - - - 242, 243 - - - 0, 0, 0, 0 - - - 120, 20 - - - 24 - - - ucrReceiverYear - - - instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 12 - - - 242, 122 - - - 0, 0, 0, 0 - - - 120, 20 - - - 20 - - - ucrReceiverDate - - - instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 13 - - - 242, 81 - - - 0, 0, 0, 0 - - - 120, 20 - - - 18 - - - ucrReceiverStation - - - instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 14 + 8 10, 362 @@ -649,7 +481,7 @@ 210, 20 - 14 + 24 ucrChkVerticalXTickMarkers @@ -691,7 +523,7 @@ 405, 52 - 16 + 26 ucrBase @@ -712,7 +544,7 @@ 255, 24 - 15 + 25 ucrSavePlot @@ -733,7 +565,7 @@ 210, 20 - 13 + 23 ucrChkHorizontalBoxplot @@ -754,7 +586,7 @@ 210, 20 - 12 + 22 ucrChkVarWidth @@ -792,20 +624,80 @@ 26 - - CenterScreen + + 245, 186 - - Climatic Boxplot + + 100, 20 - - dlgClimaticBoxPlot + + 12 - - System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ucrChkOmitBelow + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 5 + + + 367, 186 + + + 48, 20 + + + 13 + + + ucrNudOmitBelow + + + instat.ucrNud, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 6 + + + 367, 80 + + + 82, 21 + + + 7 + + + ucrInputStation + + + instat.ucrInputComboBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 9 + + + True + + + 6, 13 + + + 475, 469 - 242, 286 + 245, 285 0, 0, 0, 0 @@ -814,7 +706,7 @@ 120, 20 - 28 + 18 ucrReceiverWithinYear @@ -826,6 +718,114 @@ $this - 5 + 0 + + + 245, 242 + + + 0, 0, 0, 0 + + + 120, 20 + + + 15 + + + ucrReceiverYear + + + instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 1 + + + 245, 120 + + + 0, 0, 0, 0 + + + 120, 20 + + + 9 + + + ucrReceiverDate + + + instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 2 + + + 245, 80 + + + 0, 0, 0, 0 + + + 120, 20 + + + 6 + + + ucrReceiverStation + + + instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 3 + + + CenterScreen + + + Climatic Boxplot + + + dlgClimaticBoxPlot + + + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 245, 160 + + + 0, 0, 0, 0 + + + 120, 20 + + + 11 + + + ucrReceiverElement + + + instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 4 \ No newline at end of file diff --git a/instat/dlgClimaticBoxPlot.vb b/instat/dlgClimaticBoxPlot.vb index ca32fa9c6c3..e560768d487 100644 --- a/instat/dlgClimaticBoxPlot.vb +++ b/instat/dlgClimaticBoxPlot.vb @@ -121,10 +121,19 @@ Public Class dlgClimaticBoxPlot ucrReceiverWithinYear.SetValuesToIgnore({Chr(34) & Chr(34)}) ucrReceiverWithinYear.bAddParameterIfEmpty = True + ' others + ucrReceiverDate.SetParameter(New RParameter("date", 1)) + ucrReceiverDate.SetParameterIsString() + ucrReceiverDate.Selector = ucrSelectorClimaticBoxPlot + ucrReceiverDate.AddIncludedMetadataProperty("Climatic_Type", {Chr(34) & "date" & Chr(34)}) + ucrReceiverDate.bAutoFill = True + ucrReceiverDate.strSelectorHeading = "Date Variables" + ' summary ucrReceiverElement.SetParameter(New RParameter("y", 0)) ucrReceiverElement.SetParameterIsString() ucrReceiverElement.bWithQuotes = False + ucrReceiverElement.bAutoFill = True ucrReceiverElement.strSelectorHeading = "Variables" ucrReceiverElement.Selector = ucrSelectorClimaticBoxPlot ucrReceiverElement.SetIncludedDataTypes({"numeric"}) @@ -142,15 +151,6 @@ Public Class dlgClimaticBoxPlot ucrNudOmitBelow.Increment = 0.1 ucrChkOmitBelow.AddToLinkedControls(ucrNudOmitBelow, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=0.85) - ' others - ucrReceiverDate.SetParameter(New RParameter("date", 1)) - ucrReceiverDate.SetParameterIsString() - ucrReceiverDate.Selector = ucrSelectorClimaticBoxPlot - ucrReceiverDate.AddIncludedMetadataProperty("Climatic_Type", {Chr(34) & "date" & Chr(34)}) - ucrReceiverDate.bAutoFill = True - ucrReceiverDate.strSelectorHeading = "Date Variables" - - ucrChkVarWidth.SetParameter(New RParameter("varwidth", 0)) ucrChkVarWidth.SetText("Variable Width") ucrChkVarWidth.SetValuesCheckedAndUnchecked("TRUE", "FALSE") @@ -232,7 +232,7 @@ Public Class dlgClimaticBoxPlot sdgPlots.Reset() bResetSubdialog = True bResetBoxLayerSubdialog = True - ucrReceiverStation.SetMeAsReceiver() + ucrReceiverElement.SetMeAsReceiver() ucrInputStation.SetText(strNone) ucrInputStation.bUpdateRCodeFromControl = True @@ -457,7 +457,7 @@ Public Class dlgClimaticBoxPlot AutoFill() End Sub - Private Sub CoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSavePlot.ControlContentsChanged, ucrReceiverElement.ControlContentsChanged + Private Sub CoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverElement.ControlContentsChanged, ucrSavePlot.ControlContentsChanged TestOKEnabled() End Sub From 59312ca4eb2b98c359db2557deba910d8559732b Mon Sep 17 00:00:00 2001 From: Lazarus Kioko Muthenya Date: Tue, 26 Jun 2018 09:30:43 +0300 Subject: [PATCH 06/18] Setting up the as.factor for the x parameter --- instat/dlgClimaticBoxPlot.vb | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/instat/dlgClimaticBoxPlot.vb b/instat/dlgClimaticBoxPlot.vb index e560768d487..cebb34a2bb4 100644 --- a/instat/dlgClimaticBoxPlot.vb +++ b/instat/dlgClimaticBoxPlot.vb @@ -48,7 +48,6 @@ Public Class dlgClimaticBoxPlot Private strXAxis As String = "X Axis" Private strColour As String = "Colour Axis" Private strNone As String = "None" - Private strXasFactor As String = "X Axis Factor" Private bUpdateComboOptions As Boolean = True Private bUpdatingParameters As Boolean = False @@ -177,7 +176,7 @@ Public Class dlgClimaticBoxPlot ucrInputStation.SetItems({strXAxis, strColour, strFacetWrap, strFacetRow, strFacetCol, strNone}) ucrInputStation.SetDropDownStyleAsNonEditable() - ucrInputYear.SetItems({strXAxis, strXasFactor, strColour, strFacetWrap, strFacetRow, strFacetCol, strNone}) + ucrInputYear.SetItems({strXAxis, strColour, strFacetWrap, strFacetRow, strFacetCol, strNone}) ucrInputYear.SetDropDownStyleAsNonEditable() ucrInputWithinYear.SetItems({strXAxis, strColour, strFacetWrap, strFacetRow, strFacetCol, strNone}) @@ -387,9 +386,6 @@ Public Class dlgClimaticBoxPlot ucrInputTemp.SetName(strNone) bUpdateComboOptions = True End If - If strChangedText = strXasFactor AndAlso ucrInputTemp.GetText = strXAxis OrElse strChangedText = strXAxis AndAlso ucrInputTemp.GetText = strXasFactor Then - ucrInputTemp.SetName(strNone) - End If If strChangedText = strFacetWrap AndAlso ucrInputTemp.GetText = strFacetRow OrElse strChangedText = strFacetRow AndAlso ucrInputTemp.GetText = strFacetWrap OrElse strChangedText = strFacetWrap AndAlso ucrInputTemp.GetText = strFacetCol OrElse strChangedText = strFacetCol AndAlso ucrInputTemp.GetText = strFacetWrap Then ucrInputTemp.SetName(strNone) End If @@ -406,6 +402,7 @@ Public Class dlgClimaticBoxPlot clsRaesFunction.RemoveParameterByName("x") clsRaesFunction.RemoveParameterByName("color") clsRaesFunction.RemoveParameterByName("fill") + clsAsFactorFunction.RemoveParameterByName("x") For Each ucrInputTemp As ucrInputComboBox In dctComboReceiver.Keys clsFacetOp.RemoveParameterByName("wrap" & ucrInputTemp.Name) @@ -419,14 +416,10 @@ Public Class dlgClimaticBoxPlot strTemp = ucrInputTemp.GetText() dctComboReceiver(ucrInputTemp).SetRCode(Nothing) If strTemp = strXAxis Then - dctComboReceiver(ucrInputTemp).ChangeParameterName("x") - dctComboReceiver(ucrInputTemp).SetParameterIncludeArgumentName(True) - dctComboReceiver(ucrInputTemp).SetRCode(clsRaesFunction) - ElseIf strTemp = strXasFactor Then dctComboReceiver(ucrInputTemp).ChangeParameterName("x") dctComboReceiver(ucrInputTemp).SetParameterIncludeArgumentName(False) dctComboReceiver(ucrInputTemp).SetRCode(clsAsFactorFunction) - clsRaesFunction.AddParameter("x", clsRFunctionParameter:=clsAsFactorFunction, iPosition:=1) + clsRaesFunction.AddParameter("x", clsRFunctionParameter:=clsAsFactorFunction) ElseIf strTemp = strColour Then If rdoJitter.Checked Then dctComboReceiver(ucrInputTemp).ChangeParameterName("color") From e6e62c0f722e6de9f00d575d28c701f4d024c25a Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Tue, 26 Jun 2018 11:03:03 +0300 Subject: [PATCH 07/18] adding calculated columns for outliers --- instat/dlgClimaticCheckDataTemperature.vb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/instat/dlgClimaticCheckDataTemperature.vb b/instat/dlgClimaticCheckDataTemperature.vb index 69d4187fa57..6c5ad33d740 100644 --- a/instat/dlgClimaticCheckDataTemperature.vb +++ b/instat/dlgClimaticCheckDataTemperature.vb @@ -331,6 +331,7 @@ Public Class dlgClimaticCheckDataTemperature 'Outlier limits combined clsOutlierCombinedOperator.SetOperation("|") + clsOutlierCombinedOperator.bBrackets = False 'Main calculation filter clsCalcFilterFunc.SetRCommand("instat_calculation$new") @@ -410,6 +411,12 @@ Public Class dlgClimaticCheckDataTemperature ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsQCDifferenceRCode.clsDiffCalcFunction, New RParameter("save"), iAdditionalPairNo:=4) + ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutlierLimitUpperCalc, New RParameter("save"), iAdditionalPairNo:=5) + ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutlierLimitLowerCalc, New RParameter("save"), iAdditionalPairNo:=6) + + ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutlierLimitUpperCalcTmin, New RParameter("save"), iAdditionalPairNo:=7) + ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutlierLimitLowerCalcTmin, New RParameter("save"), iAdditionalPairNo:=8) + ucrNudJump.AddAdditionalCodeParameterPair(clsJumpCodeElement2.clsGreaterJumpOperator, (New RParameter("n", 1, bNewIncludeArgumentName:=False))) ucrNudSame.AddAdditionalCodeParameterPair(clsSameCodeElement2.clsSameGreaterOperator, (New RParameter("n", 1, bNewIncludeArgumentName:=False))) From 3504b7581908b45c3163ecf1271e576f6ccf1bda Mon Sep 17 00:00:00 2001 From: Lazarus Kioko Muthenya Date: Tue, 26 Jun 2018 12:21:29 +0300 Subject: [PATCH 08/18] Changing defaults for the theme and label on the X Axis --- instat/dlgClimaticBoxPlot.vb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/instat/dlgClimaticBoxPlot.vb b/instat/dlgClimaticBoxPlot.vb index cebb34a2bb4..8f3f85d60fe 100644 --- a/instat/dlgClimaticBoxPlot.vb +++ b/instat/dlgClimaticBoxPlot.vb @@ -23,6 +23,7 @@ Public Class dlgClimaticBoxPlot Private clsRaesFunction As New RFunction Private clsBaseOperator As New ROperator Private clsLocalRaesFunction As New RFunction + Private clsXTitleFunction As New RFunction Private clsLabsFunction As New RFunction Private clsXlabsFunction As New RFunction Private clsYlabFunction As New RFunction @@ -32,7 +33,9 @@ Public Class dlgClimaticBoxPlot Private clsFacetOp As New ROperator Private clsFacetRowOp As New ROperator Private clsFacetColOp As New ROperator + Private clsThemeParam As New RParameter Private clsThemeFunction As New RFunction + Private clsThemeFunc As New RFunction Private dctThemeFunctions As Dictionary(Of String, RFunction) Private bResetSubdialog As Boolean = True Private bResetBoxLayerSubdialog As Boolean = True @@ -73,9 +76,7 @@ Public Class dlgClimaticBoxPlot Private Sub InitialiseDialog() Dim clsCoordFlipFunc As New RFunction Dim clsCoordFlipParam As New RParameter - Dim clsThemeFunc As New RFunction Dim clsTextElementFunc As New RFunction - Dim clsThemeParam As New RParameter ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False 'ucrBase.iHelpTopicID = "" @@ -268,6 +269,11 @@ Public Class dlgClimaticBoxPlot dctThemeFunctions = New Dictionary(Of String, RFunction)(GgplotDefaults.dctThemeFunctions) clsLocalRaesFunction = GgplotDefaults.clsAesFunction.Clone() + clsBaseOperator.AddParameter("theme", clsRFunctionParameter:=clsThemeFunc, bIncludeArgumentName:=False) + + clsXlabsFunction.AddParameter("label", Chr(34) & "" & Chr(34), bIncludeArgumentName:=False) + clsBaseOperator.AddParameter("xlab", clsRFunctionParameter:=clsXlabsFunction, bIncludeArgumentName:=False) + clsBaseOperator.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorClimaticBoxPlot.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") ucrBase.clsRsyntax.SetBaseROperator(clsBaseOperator) TestOKEnabled() From 690ae65217bad52790d97405bff0a25cad9c1d8a Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Tue, 26 Jun 2018 18:23:19 +0300 Subject: [PATCH 09/18] implementing calculated columns for outliers --- instat/clsQualityControl.vb | 87 +++++++++ instat/dlgClimaticCheckDataTemperature.vb | 215 +++++++++++----------- 2 files changed, 198 insertions(+), 104 deletions(-) diff --git a/instat/clsQualityControl.vb b/instat/clsQualityControl.vb index 4241c47e91f..1bd14238e92 100644 --- a/instat/clsQualityControl.vb +++ b/instat/clsQualityControl.vb @@ -236,3 +236,90 @@ Public Class clsQCAcceptableRange End Sub End Class +Public Class clsQcOutliers + Public clsOutlierUpperLimitCalc, clsOutlierLowerLimitCalc As New RFunction + Public clsOutlierUpperLimitFunc, clsOutlierLowerLimitFunc As New RFunction + Public clsOutlierUpperOperator, clsOutlierLowerOperator As New ROperator + Private clsOutlierLowerList As New RFunction + Private clsOutlierUpperList As New RFunction + Public clsOutlierLowerLimitTestCalc As New RFunction + Public clsOutlierUpperLimitTestCalc As New RFunction + Public strUpperTestName As String + Public strLowerTestName As String + Public strUpperCalcName As String + Public strLowerCalcName As String + + Public Sub SetDefaults(strElementName As String) + Dim strUpper_Outlier_Limit As String = "upper_outlier_limit_" & strElementName + Dim strLower_Outlier_Limit As String = "lower_outlier_limit_" & strElementName + Dim strOutlierUpperTestCalcName As String = "upper_outlier_limit_test" & strElementName + Dim strOutlierLowerTestCalcName As String = "lower_outlier_limit_test" & strElementName + + clsOutlierUpperOperator.Clear() + clsOutlierLowerOperator.Clear() + clsOutlierUpperList.Clear() + clsOutlierLowerList.Clear() + + strUpperCalcName = strUpper_Outlier_Limit + strLowerCalcName = strLower_Outlier_Limit + + strUpperTestName = strOutlierUpperTestCalcName + strLowerTestName = strOutlierLowerTestCalcName + + clsOutlierUpperLimitCalc.SetRCommand("instat_calculation$new") + clsOutlierUpperLimitCalc.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) + clsOutlierUpperLimitCalc.AddParameter("function_exp", clsRFunctionParameter:=clsOutlierUpperLimitFunc, iPosition:=1) + clsOutlierUpperLimitCalc.AddParameter("result_name", Chr(34) & strUpperCalcName & Chr(34), iPosition:=4) + clsOutlierUpperLimitCalc.SetAssignTo("upper_outlier_limit" & strElementName) + + clsOutlierUpperLimitFunc.AddParameter("bupperlimit", "TRUE") + clsOutlierUpperLimitFunc.SetRCommand("summary_outlier_limit") + clsOutlierUpperLimitFunc.bToScriptAsRString = True + + clsOutlierLowerLimitCalc.SetRCommand("instat_calculation$new") + clsOutlierLowerLimitCalc.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) + clsOutlierLowerLimitCalc.AddParameter("function_exp", clsRFunctionParameter:=clsOutlierLowerLimitFunc, iPosition:=1) + clsOutlierLowerLimitCalc.AddParameter("result_name", Chr(34) & strLowerCalcName & Chr(34), iPosition:=4) + clsOutlierLowerLimitCalc.SetAssignTo("lower_outlier_limit" & strElementName) + + clsOutlierLowerLimitFunc.AddParameter("bupperlimit", "FALSE") + clsOutlierLowerLimitFunc.SetRCommand("summary_outlier_limit") + clsOutlierLowerLimitFunc.bToScriptAsRString = True + + clsOutlierLowerLimitTestCalc.SetRCommand("instat_calculation$new") + clsOutlierLowerLimitTestCalc.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) + clsOutlierLowerLimitTestCalc.AddParameter("function_exp", clsROperatorParameter:=clsOutlierLowerOperator, iPosition:=1) + clsOutlierLowerLimitTestCalc.AddParameter("sub_calculations", clsRFunctionParameter:=clsOutlierLowerList, iPosition:=2) + clsOutlierLowerLimitTestCalc.AddParameter("result_name", Chr(34) & strOutlierLowerTestCalcName & Chr(34), iPosition:=4) + clsOutlierLowerLimitTestCalc.SetAssignTo("lower_outlier_limit_test_calculation" & strElementName) + + clsOutlierLowerList.SetRCommand("list") + clsOutlierLowerList.AddParameter("sub1", clsRFunctionParameter:=clsOutlierLowerLimitCalc, bIncludeArgumentName:=False) + + clsOutlierLowerOperator.SetOperation("<") + clsOutlierLowerOperator.bToScriptAsRString = True + clsOutlierLowerOperator.AddParameter("right", strLowerCalcName, iPosition:=1) + + clsOutlierUpperLimitTestCalc.SetRCommand("instat_calculation$new") + clsOutlierUpperLimitTestCalc.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) + clsOutlierUpperLimitTestCalc.AddParameter("function_exp", clsROperatorParameter:=clsOutlierUpperOperator, iPosition:=1) + clsOutlierUpperLimitTestCalc.AddParameter("sub_calculations", clsRFunctionParameter:=clsOutlierUpperList, iPosition:=2) + clsOutlierUpperLimitTestCalc.AddParameter("result_name", Chr(34) & strOutlierUpperTestCalcName & Chr(34), iPosition:=4) + clsOutlierUpperLimitTestCalc.SetAssignTo("upper_outlier_limit_test_calculation" & strElementName) + + clsOutlierUpperOperator.SetOperation(">") + clsOutlierUpperOperator.bToScriptAsRString = True + clsOutlierUpperOperator.AddParameter("right", strUpperCalcName, iPosition:=1) + + clsOutlierUpperList.SetRCommand("list") + clsOutlierUpperList.AddParameter("sub1", clsRFunctionParameter:=clsOutlierUpperLimitCalc, bIncludeArgumentName:=False) + End Sub + + Public Sub SetElementParameters(ucrNewControl As ucrCore, iAdditionalPairNo As Integer, iAdditionalPairNo1 As Integer, iAdditionalPairNo2 As Integer, iAdditionalPairNo3 As Integer) + ucrNewControl.AddAdditionalCodeParameterPair(clsOutlierUpperLimitFunc, New RParameter("Temp", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=iAdditionalPairNo) + ucrNewControl.AddAdditionalCodeParameterPair(clsOutlierLowerLimitFunc, New RParameter("Temp", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=iAdditionalPairNo1) + ucrNewControl.AddAdditionalCodeParameterPair(clsOutlierUpperOperator, New RParameter("Temp", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=iAdditionalPairNo2) + ucrNewControl.AddAdditionalCodeParameterPair(clsOutlierLowerOperator, New RParameter("Temp", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=iAdditionalPairNo3) + End Sub +End Class + diff --git a/instat/dlgClimaticCheckDataTemperature.vb b/instat/dlgClimaticCheckDataTemperature.vb index 6c5ad33d740..89b664ed915 100644 --- a/instat/dlgClimaticCheckDataTemperature.vb +++ b/instat/dlgClimaticCheckDataTemperature.vb @@ -38,10 +38,13 @@ Public Class dlgClimaticCheckDataTemperature Private clsOrOperator As New ROperator Private clsListSubCalc As New RFunction 'outliers - Private clsGroupByMonth, clsListForOutlierManipulations, clsOutlierLimitUpperFunc, clsOutlierLimitUpperCalc, clsOutlierLimitLowerFunc, clsOutlierLimitLowerCalc As New RFunction - Private clsOutlierLimitUpperFuncTmin, clsOutlierLimitUpperCalcTmin, clsOutlierLimitLowerFuncTmin, clsOutlierLimitLowerCalcTmin As New RFunction - Private clsOutlierUpperOperator, clsOutlierLowerOperator, clsOutlierListSubCalc As New ROperator - Private clsOutlierUpperOperatorTmin, clsOutlierLowerOperatorTmin As New ROperator + Private clsOutliersElement1, clsOutliersElement2 As New clsQcOutliers + + + + Private clsGroupByMonth, clsListForOutlierManipulations As New RFunction + Private clsOutlierListSubCalc As New ROperator + 'Private clsOutlierUpperOperatorTmin, clsOutlierLowerOperatorTmin As New ROperator Private clsOutlierCombinedOperator As New ROperator Private Sub dlgClimaticCheckDataTemperature_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -198,10 +201,7 @@ Public Class dlgClimaticCheckDataTemperature End Sub Private Sub SetDefaults() - Dim strUpper_Outlier_Limit_Tmax As String = "upper_outlier_limit_Tmax" - Dim strLower_Outlier_Limit_Tmax As String = "lower_outlier_limit_Tmax" - Dim strUpper_Outlier_Limit_Tmin As String = "upper_outlier_limit_Tmin" - Dim strLower_Outlier_Limit_Tmin As String = "lower_outlier_limit_Tmin" + clsGroupByFunc = New RFunction clsGroupingListFunc = New RFunction @@ -212,10 +212,8 @@ Public Class dlgClimaticCheckDataTemperature clsOrOperator = New ROperator - clsOutlierUpperOperator.Clear() - clsOutlierLowerOperator.Clear() - clsOutlierUpperOperatorTmin.Clear() - clsOutlierLowerOperatorTmin.Clear() + 'clsOutlierUpperOperatorTmin.Clear() + 'clsOutlierLowerOperatorTmin.Clear() ucrSelectorTemperature.Reset() ucrReceiverStation.SetMeAsReceiver() @@ -259,59 +257,46 @@ Public Class dlgClimaticCheckDataTemperature clsListForOutlierManipulations.SetRCommand("list") clsListForOutlierManipulations.AddParameter("sub1", clsRFunctionParameter:=clsGroupByMonth, bIncludeArgumentName:=False, iPosition:=0) - 'Tmax - 'Upper Outlier Limit function and calc - clsOutlierLimitUpperCalc.SetRCommand("instat_calculation$new") - clsOutlierLimitUpperCalc.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) - clsOutlierLimitUpperCalc.AddParameter("function_exp", clsRFunctionParameter:=clsOutlierLimitUpperFunc, iPosition:=1) - clsOutlierLimitUpperCalc.AddParameter("result_name", Chr(34) & strUpper_Outlier_Limit_Tmax & Chr(34), iPosition:=4) - clsOutlierLimitUpperCalc.AddParameter("save", "0", iPosition:=5) - clsOutlierLimitUpperCalc.SetAssignTo("upper_outlier_limit_Tmax") - clsOutlierLimitUpperFunc.AddParameter("bupperlimit", "TRUE") - clsOutlierLimitUpperFunc.SetRCommand("summary_outlier_limit") - clsOutlierLimitUpperFunc.bToScriptAsRString = True + 'Outliers + clsOutliersElement1.SetDefaults("_tmax") + clsOutliersElement2.SetDefaults("_tmin") + + clsOutlierCombinedOperator.SetOperation("|") + clsOutlierCombinedOperator.bBrackets = False + 'Lower outlier limit Function and Calc - clsOutlierLimitLowerCalc.SetRCommand("instat_calculation$new") - clsOutlierLimitLowerCalc.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) - clsOutlierLimitLowerCalc.AddParameter("function_exp", clsRFunctionParameter:=clsOutlierLimitLowerFunc, iPosition:=1) - clsOutlierLimitLowerCalc.AddParameter("result_name", Chr(34) & strLower_Outlier_Limit_Tmax & Chr(34), iPosition:=4) - clsOutlierLimitLowerCalc.AddParameter("save", "0", iPosition:=5) - clsOutlierLimitLowerCalc.SetAssignTo("lower_outlier_limit_Tmax") - clsOutlierLimitLowerFunc.AddParameter("bupperlimit", "FALSE") - clsOutlierLimitLowerFunc.SetRCommand("summary_outlier_limit") - clsOutlierLimitLowerFunc.bToScriptAsRString = True + + 'Upper Outlier Operator - clsOutlierUpperOperator.SetOperation(">") - clsOutlierUpperOperator.AddParameter("right", strUpper_Outlier_Limit_Tmax, iPosition:=1) + 'Lower Outlier Operator - clsOutlierLowerOperator.SetOperation("<") - clsOutlierLowerOperator.AddParameter("right", strLower_Outlier_Limit_Tmax, iPosition:=1) + 'Tmin 'Upper Outlier Limit function and calc - clsOutlierLimitUpperCalcTmin.SetRCommand("instat_calculation$new") - clsOutlierLimitUpperCalcTmin.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) - clsOutlierLimitUpperCalcTmin.AddParameter("function_exp", clsRFunctionParameter:=clsOutlierLimitUpperFuncTmin, iPosition:=1) - clsOutlierLimitUpperCalcTmin.AddParameter("result_name", Chr(34) & strUpper_Outlier_Limit_Tmin & Chr(34), iPosition:=4) - clsOutlierLimitUpperCalcTmin.AddParameter("save", "0", iPosition:=5) - clsOutlierLimitUpperCalcTmin.SetAssignTo("upper_outlier_limit_Tmin") - clsOutlierLimitUpperFuncTmin.AddParameter("bupperlimit", "TRUE") - clsOutlierLimitUpperFuncTmin.SetRCommand("summary_outlier_limit") - clsOutlierLimitUpperFuncTmin.bToScriptAsRString = True + 'clsOutlierLimitUpperCalcTmin.SetRCommand("instat_calculation$new") + 'clsOutlierLimitUpperCalcTmin.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) + 'clsOutlierLimitUpperCalcTmin.AddParameter("function_exp", clsRFunctionParameter:=clsOutlierLimitUpperFuncTmin, iPosition:=1) + 'clsOutlierLimitUpperCalcTmin.AddParameter("result_name", Chr(34) & strUpper_Outlier_Limit_Tmin & Chr(34), iPosition:=4) + 'clsOutlierLimitUpperCalcTmin.AddParameter("save", "0", iPosition:=5) + 'clsOutlierLimitUpperCalcTmin.SetAssignTo("upper_outlier_limit_Tmin") + 'clsOutlierLimitUpperFuncTmin.AddParameter("bupperlimit", "TRUE") + 'clsOutlierLimitUpperFuncTmin.SetRCommand("summary_outlier_limit") + 'clsOutlierLimitUpperFuncTmin.bToScriptAsRString = True 'Lower outlier limit Function and Calc - clsOutlierLimitLowerCalcTmin.SetRCommand("instat_calculation$new") - clsOutlierLimitLowerCalcTmin.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) - clsOutlierLimitLowerCalcTmin.AddParameter("function_exp", clsRFunctionParameter:=clsOutlierLimitLowerFuncTmin, iPosition:=1) - clsOutlierLimitLowerCalcTmin.AddParameter("result_name", Chr(34) & strLower_Outlier_Limit_Tmin & Chr(34), iPosition:=4) - clsOutlierLimitLowerCalcTmin.AddParameter("save", "0", iPosition:=5) - clsOutlierLimitLowerCalcTmin.SetAssignTo("lower_outlier_limit_Tmin") - clsOutlierLimitLowerFuncTmin.AddParameter("bupperlimit", "FALSE") - clsOutlierLimitLowerFuncTmin.SetRCommand("summary_outlier_limit") - clsOutlierLimitLowerFuncTmin.bToScriptAsRString = True + 'clsOutlierLimitLowerCalcTmin.SetRCommand("instat_calculation$new") + 'clsOutlierLimitLowerCalcTmin.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) + 'clsOutlierLimitLowerCalcTmin.AddParameter("function_exp", clsRFunctionParameter:=clsOutlierLimitLowerFuncTmin, iPosition:=1) + 'clsOutlierLimitLowerCalcTmin.AddParameter("result_name", Chr(34) & strLower_Outlier_Limit_Tmin & Chr(34), iPosition:=4) + 'clsOutlierLimitLowerCalcTmin.AddParameter("save", "0", iPosition:=5) + 'clsOutlierLimitLowerCalcTmin.SetAssignTo("lower_outlier_limit_Tmin") + 'clsOutlierLimitLowerFuncTmin.AddParameter("bupperlimit", "FALSE") + 'clsOutlierLimitLowerFuncTmin.SetRCommand("summary_outlier_limit") + 'clsOutlierLimitLowerFuncTmin.bToScriptAsRString = True 'Sub Calculations List for temp_filter clsListSubCalc.SetRCommand("list") @@ -322,16 +307,13 @@ Public Class dlgClimaticCheckDataTemperature clsDiffListSubCalc.SetOperation(",") 'Upper Outlier Operator - clsOutlierUpperOperatorTmin.SetOperation(">") - clsOutlierUpperOperatorTmin.AddParameter("right", strUpper_Outlier_Limit_Tmin, iPosition:=1) + 'clsOutlierUpperOperatorTmin.SetOperation(">") + 'clsOutlierUpperOperatorTmin.AddParameter("right", strUpper_Outlier_Limit_Tmin, iPosition:=1) 'Lower Outlier Operator - clsOutlierLowerOperatorTmin.SetOperation("<") - clsOutlierLowerOperatorTmin.AddParameter("right", strLower_Outlier_Limit_Tmin, iPosition:=1) + 'clsOutlierLowerOperatorTmin.SetOperation("<") + 'clsOutlierLowerOperatorTmin.AddParameter("right", strLower_Outlier_Limit_Tmin, iPosition:=1) - 'Outlier limits combined - clsOutlierCombinedOperator.SetOperation("|") - clsOutlierCombinedOperator.bBrackets = False 'Main calculation filter clsCalcFilterFunc.SetRCommand("instat_calculation$new") @@ -368,20 +350,31 @@ Public Class dlgClimaticCheckDataTemperature clsQCAcceptableRangeElement1.SetElementParameters(ucrReceiverElement1, iAdditionalPairNo:=1) clsQCDifferenceRCode.SetElementParameters(ucrReceiverElement1, iAdditionalPairNo:=2) clsSameCodeElement1.SetElementParameters(ucrReceiverElement1, iAdditionalPairNo:=3) - ucrReceiverElement1.AddAdditionalCodeParameterPair(clsOutlierUpperOperator, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=4) - ucrReceiverElement1.AddAdditionalCodeParameterPair(clsOutlierLowerOperator, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=5) - ucrReceiverElement1.AddAdditionalCodeParameterPair(clsOutlierLimitUpperFunc, New RParameter("x", 0), iAdditionalPairNo:=6) - ucrReceiverElement1.AddAdditionalCodeParameterPair(clsOutlierLimitLowerFunc, New RParameter("x", 0), iAdditionalPairNo:=7) + clsOutliersElement1.SetElementParameters(ucrReceiverElement1, iAdditionalPairNo:=4, iAdditionalPairNo1:=5, iAdditionalPairNo2:=6, iAdditionalPairNo3:=7) + + 'clsOutliersElement2.SetElementParameters(ucrReceiverElement2, iAdditionalPairNo:=12) + + 'ucrReceiverElement1.AddAdditionalCodeParameterPair(clsOutlierUpperOperator, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=4) + 'ucrReceiverElement1.AddAdditionalCodeParameterPair(clsOutlierLowerOperator, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=5) + 'ucrReceiverElement1.AddAdditionalCodeParameterPair(clsOutlierLimitUpperFunc, New RParameter("x", 0), iAdditionalPairNo:=6) + 'ucrReceiverElement1.AddAdditionalCodeParameterPair(clsOutlierLimitLowerFunc, New RParameter("x", 0), iAdditionalPairNo:=7) clsJumpCodeElement1.SetElementParameters(ucrReceiverElement1, iAdditionalPairNo1:=8, iAdditionalPairNo2:=9, iAdditionalPairNo3:=10, iAdditionalPairNo4:=11) clsQCAcceptableRangeElement2.SetElementParameters(ucrReceiverElement2, iAdditionalPairNo:=1) - ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutlierUpperOperatorTmin, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=2) - ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutlierLowerOperatorTmin, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=3) - ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutlierLimitUpperFuncTmin, New RParameter("x", 0), iAdditionalPairNo:=4) - ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutlierLimitLowerFuncTmin, New RParameter("x", 0), iAdditionalPairNo:=5) - clsSameCodeElement2.SetElementParameters(ucrReceiverElement2, iAdditionalPairNo:=6) - clsJumpCodeElement2.SetElementParameters(ucrReceiverElement2, iAdditionalPairNo1:=7, iAdditionalPairNo2:=8, iAdditionalPairNo3:=9, iAdditionalPairNo4:=10) - ucrReceiverElement2.AddAdditionalCodeParameterPair(clsQCAcceptableRangeElement2.clsLessEqualToOperator, New RParameter("x", 0), iAdditionalPairNo:=11) + 'ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutlierUpperOperatorTmin, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=2) + 'ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutlierLowerOperatorTmin, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=3) + + clsSameCodeElement2.SetElementParameters(ucrReceiverElement2, iAdditionalPairNo:=2) + clsJumpCodeElement2.SetElementParameters(ucrReceiverElement2, iAdditionalPairNo1:=3, iAdditionalPairNo2:=4, iAdditionalPairNo3:=5, iAdditionalPairNo4:=6) + ucrReceiverElement2.AddAdditionalCodeParameterPair(clsQCAcceptableRangeElement2.clsLessEqualToOperator, New RParameter("x", 0), iAdditionalPairNo:=7) + ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierLowerLimitFunc, New RParameter("x", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=8) + ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierUpperLimitFunc, New RParameter("x", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=9) + ' clsOutliersElement2.SetElementParameters(ucrReceiverElement2,) + + ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierUpperOperator, New RParameter("x", 0), iAdditionalPairNo:=10) + ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierLowerOperator, New RParameter("x", 0), iAdditionalPairNo:=11) + + 'clsOutliersElement2.SetElementParameters(ucrReceiverElement2, iAdditionalPairNo:=10, iAdditionalPairNo1:=11, iAdditionalPairNo2:=12, iAdditionalPairNo3:=13) ucrChkRangeElement1.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("range1", strParamValue:=clsQCAcceptableRangeElement1.clsAcceptableRangeTestFunc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) ucrChkRangeElement2.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("range2", strParamValue:=clsQCAcceptableRangeElement2.clsAcceptableRangeTestFunc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) @@ -389,9 +382,13 @@ Public Class dlgClimaticCheckDataTemperature ucrChkJump.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("jump", strParamValue:=clsJumpListSubCalc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) ucrChkSame.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("same", strParamValue:=clsSameListSubCalc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) ucrChkDifference.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("diff", strParamValue:=clsQCDifferenceRCode.clsDiffTestFunction, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) - ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutlierLimitLowerFunc, New RParameter("coeff"), iAdditionalPairNo:=1) - ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutlierLimitLowerFuncTmin, New RParameter("coeff"), iAdditionalPairNo:=2) - ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutlierLimitUpperFuncTmin, New RParameter("coeff"), iAdditionalPairNo:=3) + + ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierLowerLimitFunc, New RParameter("coeff"), iAdditionalPairNo:=1) + ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierLowerLimitFunc, New RParameter("coeff"), iAdditionalPairNo:=2) + ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierUpperLimitFunc, New RParameter("coeff"), iAdditionalPairNo:=3) + ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierUpperLimitFunc, New RParameter("coeff"), iAdditionalPairNo:=3) + 'ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutlierLimitLowerFuncTmin, New RParameter("coeff"), iAdditionalPairNo:=4) + 'ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutlierLimitUpperFuncTmin, New RParameter("coeff"), iAdditionalPairNo:=5) ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsJumpCodeElement1.clsJumpTestFunction, New RParameter("save"), iAdditionalPairNo:=1) ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsJumpCodeElement2.clsJumpTestFunction, New RParameter("save"), iAdditionalPairNo:=2) @@ -411,11 +408,14 @@ Public Class dlgClimaticCheckDataTemperature ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsQCDifferenceRCode.clsDiffCalcFunction, New RParameter("save"), iAdditionalPairNo:=4) - ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutlierLimitUpperCalc, New RParameter("save"), iAdditionalPairNo:=5) - ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutlierLimitLowerCalc, New RParameter("save"), iAdditionalPairNo:=6) + ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierUpperLimitCalc, New RParameter("save"), iAdditionalPairNo:=5) + ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierLowerLimitCalc, New RParameter("save"), iAdditionalPairNo:=6) - ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutlierLimitUpperCalcTmin, New RParameter("save"), iAdditionalPairNo:=7) - ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutlierLimitLowerCalcTmin, New RParameter("save"), iAdditionalPairNo:=8) + ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierUpperLimitCalc, New RParameter("save"), iAdditionalPairNo:=7) + ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierLowerLimitCalc, New RParameter("save"), iAdditionalPairNo:=8) + + 'ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutlierLimitUpperCalcTmin, New RParameter("save"), iAdditionalPairNo:=7) + 'ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutlierLimitLowerCalcTmin, New RParameter("save"), iAdditionalPairNo:=8) ucrNudJump.AddAdditionalCodeParameterPair(clsJumpCodeElement2.clsGreaterJumpOperator, (New RParameter("n", 1, bNewIncludeArgumentName:=False))) ucrNudSame.AddAdditionalCodeParameterPair(clsSameCodeElement2.clsSameGreaterOperator, (New RParameter("n", 1, bNewIncludeArgumentName:=False))) @@ -437,7 +437,7 @@ Public Class dlgClimaticCheckDataTemperature ucrChkIncludeLogicalColumns.SetRCode(clsCalcFilterFunc, bReset) ucrChkIncludeCalculatedColumns.SetRCode(clsJumpCodeElement1.clsJumpCalcFunction, bReset) ucrChkOutlier.SetRCode(clsOrOperator, bReset) - ucrNudCoeff.SetRCode(clsOutlierLimitUpperFunc) + ucrNudCoeff.SetRCode(clsOutliersElement1.clsOutlierUpperLimitFunc) End Sub Private Sub TestOkEnabled() @@ -533,24 +533,29 @@ Public Class dlgClimaticCheckDataTemperature If Not ucrReceiverMonth.IsEmpty Then clsGroupByMonth.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverMonth.GetVariableNames & ")", iPosition:=1) If Not ucrReceiverElement1.IsEmpty() Then - clsOutlierLimitUpperCalc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) - clsOutlierLimitLowerCalc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) + clsOutliersElement1.clsOutlierUpperLimitCalc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) + 'clsOutlierLimitLowerCalcTmax.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) ElseIf ucrReceiverElement1.IsEmpty() Then - clsOutlierLimitUpperCalc.RemoveParameterByName("manipulations") - clsOutlierLimitLowerCalc.RemoveParameterByName("manipulations") + clsOutliersElement1.clsOutlierUpperLimitCalc.RemoveParameterByName("manipulations") + 'clsOutlierLimitUpperCalcTmax.RemoveParameterByName("manipulations") + 'clsOutlierLimitLowerCalcTmax.RemoveParameterByName("manipulations") End If If Not ucrReceiverElement2.IsEmpty() Then - clsOutlierLimitUpperCalcTmin.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) - clsOutlierLimitLowerCalcTmin.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) + clsOutliersElement2.clsOutlierUpperLimitCalc.RemoveParameterByName("manipulations") + 'clsOutlierLimitUpperCalcTmin.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) + 'clsOutlierLimitLowerCalcTmin.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) ElseIf ucrReceiverElement2.IsEmpty Then - clsOutlierLimitUpperCalcTmin.RemoveParameterByName("manipulations") - clsOutlierLimitLowerCalcTmin.RemoveParameterByName("manipulations") + clsOutliersElement2.clsOutlierUpperLimitCalc.RemoveParameterByName("manipulations") + 'clsOutlierLimitUpperCalcTmin.RemoveParameterByName("manipulations") + ' clsOutlierLimitLowerCalcTmin.RemoveParameterByName("manipulations") End If Else - clsOutlierLimitUpperCalc.RemoveParameterByName("manipulations") - clsOutlierLimitLowerCalc.RemoveParameterByName("manipulations") - clsOutlierLimitUpperCalcTmin.RemoveParameterByName("manipulations") - clsOutlierLimitLowerCalcTmin.RemoveParameterByName("manipulations") + clsOutliersElement1.clsOutlierUpperLimitCalc.RemoveParameterByName("manipulations") + clsOutliersElement2.clsOutlierUpperLimitCalc.RemoveParameterByName("manipulations") + 'clsOutlierLimitUpperCalcTmax.RemoveParameterByName("manipulations") + 'clsOutlierLimitLowerCalcTmax.RemoveParameterByName("manipulations") + ' clsOutlierLimitUpperCalcTmin.RemoveParameterByName("manipulations") + ' clsOutlierLimitLowerCalcTmin.RemoveParameterByName("manipulations") End If End Sub @@ -563,11 +568,12 @@ Public Class dlgClimaticCheckDataTemperature clsRangeOrOp.AddParameter("range1", strParameterValue:=clsQCAcceptableRangeElement1.strTestName, bIncludeArgumentName:=False) clsJumpListSubCalc.AddParameter("sub1", clsRFunctionParameter:=clsJumpCodeElement1.clsJumpTestFunction, bIncludeArgumentName:=False) clsRangeListSubCalc.AddParameter("sub1", clsROperatorParameter:=clsQCAcceptableRangeElement1.clsRangeOrOperator, bIncludeArgumentName:=False) - clsOutlierLimitUpperCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) - clsOutlierLimitLowerCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) - clsOutlierListSubCalc.AddParameter("sub1", clsRFunctionParameter:=clsOutlierLimitUpperCalc, bIncludeArgumentName:=False, iPosition:=0) - clsOutlierListSubCalc.AddParameter("sub2", clsRFunctionParameter:=clsOutlierLimitLowerCalc, bIncludeArgumentName:=False, iPosition:=1) - clsOutlierCombinedOperator.AddParameter("sub1", clsROperatorParameter:=clsOutlierUpperOperator, bIncludeArgumentName:=False) + clsOutliersElement1.clsOutlierUpperLimitCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) + clsOutliersElement1.clsOutlierLowerLimitCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) + clsOutlierListSubCalc.AddParameter("sub1", clsRFunctionParameter:=clsOutliersElement1.clsOutlierUpperLimitTestCalc, bIncludeArgumentName:=False, iPosition:=0) + 'clsOutlierListSubCalc.AddParameter("sub2", clsRFunctionParameter:=clsOutliersElement2.clsOutlierLowerLimitTestCalc, bIncludeArgumentName:=False, iPosition:=3) + clsOutlierCombinedOperator.AddParameter("sub1", strParameterValue:=clsOutliersElement1.strUpperTestName, bIncludeArgumentName:=False, iPosition:=0) + clsOutlierCombinedOperator.AddParameter("sub2", strParameterValue:=clsOutliersElement1.strLowerTestName, bIncludeArgumentName:=False, iPosition:=1) Else clsSameOp.RemoveParameterByName("same1") clsSameListSubCalc.RemoveParameterByName("sub1") @@ -587,12 +593,13 @@ Public Class dlgClimaticCheckDataTemperature clsRange2OrOp.AddParameter("range2", strParameterValue:=clsQCAcceptableRangeElement2.strTestName, bIncludeArgumentName:=False) clsJumpListSubCalc.AddParameter("sub2", clsRFunctionParameter:=clsJumpCodeElement2.clsJumpTestFunction, bIncludeArgumentName:=False) clsRangeListSubCalc.AddParameter("sub2", clsROperatorParameter:=clsQCAcceptableRangeElement2.clsRangeOrOperator, bIncludeArgumentName:=False) - clsOutlierLimitUpperCalcTmin.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) - clsOutlierLimitLowerCalcTmin.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) - clsOutlierListSubCalc.AddParameter("sub3", clsRFunctionParameter:=clsOutlierLimitUpperCalcTmin, bIncludeArgumentName:=False, iPosition:=2) - clsOutlierListSubCalc.AddParameter("sub4", clsRFunctionParameter:=clsOutlierLimitLowerCalcTmin, bIncludeArgumentName:=False, iPosition:=3) - clsOutlierCombinedOperator.AddParameter("sub3", clsROperatorParameter:=clsOutlierUpperOperatorTmin, bIncludeArgumentName:=False) - clsOutlierCombinedOperator.AddParameter("sub4", clsROperatorParameter:=clsOutlierLowerOperatorTmin, bIncludeArgumentName:=False) + clsOutliersElement2.clsOutlierUpperLimitCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) + clsOutliersElement2.clsOutlierLowerLimitCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) + 'clsOutlierListSubCalc.AddParameter("sub3", clsRFunctionParameter:=clsOutliersElement1.clsOutlierLowerLimitTestCalc, bIncludeArgumentName:=False, iPosition:=1) + clsOutlierListSubCalc.AddParameter("sub4", clsRFunctionParameter:=clsOutliersElement2.clsOutlierUpperLimitTestCalc, bIncludeArgumentName:=False, iPosition:=4) + clsOutlierCombinedOperator.AddParameter("sub2", clsOutliersElement2.strUpperTestName, bIncludeArgumentName:=False, iPosition:=2) + clsOutlierCombinedOperator.AddParameter("sub3", clsOutliersElement2.strLowerTestName, bIncludeArgumentName:=False, iPosition:=3) + 'clsOutlierCombinedOperator.AddParameter("sub4", clsROperatorParameter:=clsOutlierLowerOperatorTmin, bIncludeArgumentName:=False) Else clsSameOp.RemoveParameterByName("same2") clsSameListSubCalc.RemoveParameterByName("sub2") @@ -602,8 +609,8 @@ Public Class dlgClimaticCheckDataTemperature clsRangeListSubCalc.RemoveParameterByName("sub2") clsOutlierListSubCalc.RemoveParameterByName("sub3") clsOutlierListSubCalc.RemoveParameterByName("sub4") + clsOutlierCombinedOperator.RemoveParameterByName("sub2") clsOutlierCombinedOperator.RemoveParameterByName("sub3") - clsOutlierCombinedOperator.RemoveParameterByName("sub4") End If If Not ucrReceiverElement1.IsEmpty AndAlso Not ucrReceiverElement2.IsEmpty Then From c2dcc3eafc671e225ad6055e531dcfdc32f6e5e0 Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Wed, 27 Jun 2018 11:07:57 +0300 Subject: [PATCH 10/18] Bug fixes --- instat/clsQualityControl.vb | 4 +- instat/dlgClimaticCheckDataTemperature.vb | 146 ++++++---------------- 2 files changed, 41 insertions(+), 109 deletions(-) diff --git a/instat/clsQualityControl.vb b/instat/clsQualityControl.vb index 1bd14238e92..4cead9201ab 100644 --- a/instat/clsQualityControl.vb +++ b/instat/clsQualityControl.vb @@ -272,8 +272,8 @@ Public Class clsQcOutliers clsOutlierUpperLimitCalc.AddParameter("result_name", Chr(34) & strUpperCalcName & Chr(34), iPosition:=4) clsOutlierUpperLimitCalc.SetAssignTo("upper_outlier_limit" & strElementName) - clsOutlierUpperLimitFunc.AddParameter("bupperlimit", "TRUE") clsOutlierUpperLimitFunc.SetRCommand("summary_outlier_limit") + clsOutlierUpperLimitFunc.AddParameter("bupperlimit", "TRUE") clsOutlierUpperLimitFunc.bToScriptAsRString = True clsOutlierLowerLimitCalc.SetRCommand("instat_calculation$new") @@ -282,8 +282,8 @@ Public Class clsQcOutliers clsOutlierLowerLimitCalc.AddParameter("result_name", Chr(34) & strLowerCalcName & Chr(34), iPosition:=4) clsOutlierLowerLimitCalc.SetAssignTo("lower_outlier_limit" & strElementName) - clsOutlierLowerLimitFunc.AddParameter("bupperlimit", "FALSE") clsOutlierLowerLimitFunc.SetRCommand("summary_outlier_limit") + clsOutlierLowerLimitFunc.AddParameter("bupperlimit", "FALSE") clsOutlierLowerLimitFunc.bToScriptAsRString = True clsOutlierLowerLimitTestCalc.SetRCommand("instat_calculation$new") diff --git a/instat/dlgClimaticCheckDataTemperature.vb b/instat/dlgClimaticCheckDataTemperature.vb index 89b664ed915..a53844ef2ce 100644 --- a/instat/dlgClimaticCheckDataTemperature.vb +++ b/instat/dlgClimaticCheckDataTemperature.vb @@ -39,13 +39,8 @@ Public Class dlgClimaticCheckDataTemperature Private clsListSubCalc As New RFunction 'outliers Private clsOutliersElement1, clsOutliersElement2 As New clsQcOutliers - - - Private clsGroupByMonth, clsListForOutlierManipulations As New RFunction - Private clsOutlierListSubCalc As New ROperator - 'Private clsOutlierUpperOperatorTmin, clsOutlierLowerOperatorTmin As New ROperator - Private clsOutlierCombinedOperator As New ROperator + Private clsOutlierListSubCalc, clsOutlierCombinedOperator As New ROperator Private Sub dlgClimaticCheckDataTemperature_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstload Then @@ -82,7 +77,6 @@ Public Class dlgClimaticCheckDataTemperature 'Date Receiver ucrReceiverDate.Selector = ucrSelectorTemperature ucrReceiverDate.SetClimaticType("date") - ucrReceiverDate.SetMeAsReceiver() ucrReceiverDate.bAutoFill = True ucrReceiverDate.strSelectorHeading = "Date Variables" @@ -201,8 +195,6 @@ Public Class dlgClimaticCheckDataTemperature End Sub Private Sub SetDefaults() - - clsGroupByFunc = New RFunction clsGroupingListFunc = New RFunction clsCalcFilterFunc = New RFunction @@ -212,11 +204,8 @@ Public Class dlgClimaticCheckDataTemperature clsOrOperator = New ROperator - 'clsOutlierUpperOperatorTmin.Clear() - 'clsOutlierLowerOperatorTmin.Clear() - ucrSelectorTemperature.Reset() - ucrReceiverStation.SetMeAsReceiver() + ucrReceiverElement1.SetMeAsReceiver() 'GroupBy clsGroupByFunc.SetRCommand("instat_calculation$new") @@ -264,40 +253,6 @@ Public Class dlgClimaticCheckDataTemperature clsOutlierCombinedOperator.SetOperation("|") clsOutlierCombinedOperator.bBrackets = False - - 'Lower outlier limit Function and Calc - - - - 'Upper Outlier Operator - - - 'Lower Outlier Operator - - - 'Tmin - 'Upper Outlier Limit function and calc - 'clsOutlierLimitUpperCalcTmin.SetRCommand("instat_calculation$new") - 'clsOutlierLimitUpperCalcTmin.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) - 'clsOutlierLimitUpperCalcTmin.AddParameter("function_exp", clsRFunctionParameter:=clsOutlierLimitUpperFuncTmin, iPosition:=1) - 'clsOutlierLimitUpperCalcTmin.AddParameter("result_name", Chr(34) & strUpper_Outlier_Limit_Tmin & Chr(34), iPosition:=4) - 'clsOutlierLimitUpperCalcTmin.AddParameter("save", "0", iPosition:=5) - 'clsOutlierLimitUpperCalcTmin.SetAssignTo("upper_outlier_limit_Tmin") - 'clsOutlierLimitUpperFuncTmin.AddParameter("bupperlimit", "TRUE") - 'clsOutlierLimitUpperFuncTmin.SetRCommand("summary_outlier_limit") - 'clsOutlierLimitUpperFuncTmin.bToScriptAsRString = True - - 'Lower outlier limit Function and Calc - 'clsOutlierLimitLowerCalcTmin.SetRCommand("instat_calculation$new") - 'clsOutlierLimitLowerCalcTmin.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) - 'clsOutlierLimitLowerCalcTmin.AddParameter("function_exp", clsRFunctionParameter:=clsOutlierLimitLowerFuncTmin, iPosition:=1) - 'clsOutlierLimitLowerCalcTmin.AddParameter("result_name", Chr(34) & strLower_Outlier_Limit_Tmin & Chr(34), iPosition:=4) - 'clsOutlierLimitLowerCalcTmin.AddParameter("save", "0", iPosition:=5) - 'clsOutlierLimitLowerCalcTmin.SetAssignTo("lower_outlier_limit_Tmin") - 'clsOutlierLimitLowerFuncTmin.AddParameter("bupperlimit", "FALSE") - 'clsOutlierLimitLowerFuncTmin.SetRCommand("summary_outlier_limit") - 'clsOutlierLimitLowerFuncTmin.bToScriptAsRString = True - 'Sub Calculations List for temp_filter clsListSubCalc.SetRCommand("list") clsOutlierListSubCalc.SetOperation(",") @@ -306,14 +261,6 @@ Public Class dlgClimaticCheckDataTemperature clsSameListSubCalc.SetOperation(",") clsDiffListSubCalc.SetOperation(",") - 'Upper Outlier Operator - 'clsOutlierUpperOperatorTmin.SetOperation(">") - 'clsOutlierUpperOperatorTmin.AddParameter("right", strUpper_Outlier_Limit_Tmin, iPosition:=1) - - 'Lower Outlier Operator - 'clsOutlierLowerOperatorTmin.SetOperation("<") - 'clsOutlierLowerOperatorTmin.AddParameter("right", strLower_Outlier_Limit_Tmin, iPosition:=1) - 'Main calculation filter clsCalcFilterFunc.SetRCommand("instat_calculation$new") @@ -351,31 +298,17 @@ Public Class dlgClimaticCheckDataTemperature clsQCDifferenceRCode.SetElementParameters(ucrReceiverElement1, iAdditionalPairNo:=2) clsSameCodeElement1.SetElementParameters(ucrReceiverElement1, iAdditionalPairNo:=3) clsOutliersElement1.SetElementParameters(ucrReceiverElement1, iAdditionalPairNo:=4, iAdditionalPairNo1:=5, iAdditionalPairNo2:=6, iAdditionalPairNo3:=7) - - 'clsOutliersElement2.SetElementParameters(ucrReceiverElement2, iAdditionalPairNo:=12) - - 'ucrReceiverElement1.AddAdditionalCodeParameterPair(clsOutlierUpperOperator, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=4) - 'ucrReceiverElement1.AddAdditionalCodeParameterPair(clsOutlierLowerOperator, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=5) - 'ucrReceiverElement1.AddAdditionalCodeParameterPair(clsOutlierLimitUpperFunc, New RParameter("x", 0), iAdditionalPairNo:=6) - 'ucrReceiverElement1.AddAdditionalCodeParameterPair(clsOutlierLimitLowerFunc, New RParameter("x", 0), iAdditionalPairNo:=7) clsJumpCodeElement1.SetElementParameters(ucrReceiverElement1, iAdditionalPairNo1:=8, iAdditionalPairNo2:=9, iAdditionalPairNo3:=10, iAdditionalPairNo4:=11) clsQCAcceptableRangeElement2.SetElementParameters(ucrReceiverElement2, iAdditionalPairNo:=1) - 'ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutlierUpperOperatorTmin, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=2) - 'ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutlierLowerOperatorTmin, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=3) - clsSameCodeElement2.SetElementParameters(ucrReceiverElement2, iAdditionalPairNo:=2) clsJumpCodeElement2.SetElementParameters(ucrReceiverElement2, iAdditionalPairNo1:=3, iAdditionalPairNo2:=4, iAdditionalPairNo3:=5, iAdditionalPairNo4:=6) ucrReceiverElement2.AddAdditionalCodeParameterPair(clsQCAcceptableRangeElement2.clsLessEqualToOperator, New RParameter("x", 0), iAdditionalPairNo:=7) ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierLowerLimitFunc, New RParameter("x", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=8) ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierUpperLimitFunc, New RParameter("x", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=9) - ' clsOutliersElement2.SetElementParameters(ucrReceiverElement2,) - ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierUpperOperator, New RParameter("x", 0), iAdditionalPairNo:=10) ucrReceiverElement2.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierLowerOperator, New RParameter("x", 0), iAdditionalPairNo:=11) - 'clsOutliersElement2.SetElementParameters(ucrReceiverElement2, iAdditionalPairNo:=10, iAdditionalPairNo1:=11, iAdditionalPairNo2:=12, iAdditionalPairNo3:=13) - ucrChkRangeElement1.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("range1", strParamValue:=clsQCAcceptableRangeElement1.clsAcceptableRangeTestFunc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) ucrChkRangeElement2.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("range2", strParamValue:=clsQCAcceptableRangeElement2.clsAcceptableRangeTestFunc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) ucrChkOutlier.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("outliers", strParamValue:=clsOutlierListSubCalc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) @@ -387,8 +320,6 @@ Public Class dlgClimaticCheckDataTemperature ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierLowerLimitFunc, New RParameter("coeff"), iAdditionalPairNo:=2) ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierUpperLimitFunc, New RParameter("coeff"), iAdditionalPairNo:=3) ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierUpperLimitFunc, New RParameter("coeff"), iAdditionalPairNo:=3) - 'ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutlierLimitLowerFuncTmin, New RParameter("coeff"), iAdditionalPairNo:=4) - 'ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutlierLimitUpperFuncTmin, New RParameter("coeff"), iAdditionalPairNo:=5) ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsJumpCodeElement1.clsJumpTestFunction, New RParameter("save"), iAdditionalPairNo:=1) ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsJumpCodeElement2.clsJumpTestFunction, New RParameter("save"), iAdditionalPairNo:=2) @@ -401,6 +332,12 @@ Public Class dlgClimaticCheckDataTemperature ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsQCAcceptableRangeElement1.clsAcceptableRangeTestFunc, New RParameter("save"), iAdditionalPairNo:=6) ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsQCAcceptableRangeElement2.clsAcceptableRangeTestFunc, New RParameter("save"), iAdditionalPairNo:=7) + ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierUpperLimitTestCalc, New RParameter("save"), iAdditionalPairNo:=6) + ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierLowerLimitTestCalc, New RParameter("save"), iAdditionalPairNo:=7) + + ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierUpperLimitTestCalc, New RParameter("save"), iAdditionalPairNo:=8) + ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierLowerLimitTestCalc, New RParameter("save"), iAdditionalPairNo:=9) + ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsJumpCodeElement2.clsJumpCalcFunction, New RParameter("save"), iAdditionalPairNo:=1) ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsSameCodeElement1.clsSameCalcFunction, New RParameter("save"), iAdditionalPairNo:=2) @@ -414,9 +351,6 @@ Public Class dlgClimaticCheckDataTemperature ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierUpperLimitCalc, New RParameter("save"), iAdditionalPairNo:=7) ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierLowerLimitCalc, New RParameter("save"), iAdditionalPairNo:=8) - 'ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutlierLimitUpperCalcTmin, New RParameter("save"), iAdditionalPairNo:=7) - 'ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsOutlierLimitLowerCalcTmin, New RParameter("save"), iAdditionalPairNo:=8) - ucrNudJump.AddAdditionalCodeParameterPair(clsJumpCodeElement2.clsGreaterJumpOperator, (New RParameter("n", 1, bNewIncludeArgumentName:=False))) ucrNudSame.AddAdditionalCodeParameterPair(clsSameCodeElement2.clsSameGreaterOperator, (New RParameter("n", 1, bNewIncludeArgumentName:=False))) @@ -560,57 +494,51 @@ Public Class dlgClimaticCheckDataTemperature End Sub Private Sub FilterFunc() - If Not ucrReceiverElement1.IsEmpty Then clsSameOp.AddParameter("same1", strParameterValue:=clsSameCodeElement1.strTestName, bIncludeArgumentName:=False) - clsSameListSubCalc.AddParameter("sub1", clsRFunctionParameter:=clsSameCodeElement1.clsSameTestFunction, bIncludeArgumentName:=False) + clsSameListSubCalc.AddParameter("same1", clsRFunctionParameter:=clsSameCodeElement1.clsSameTestFunction, bIncludeArgumentName:=False) clsJumpOp.AddParameter("jump1", strParameterValue:=clsJumpCodeElement1.strTestName, bIncludeArgumentName:=False) + clsJumpListSubCalc.AddParameter("jump1", clsRFunctionParameter:=clsJumpCodeElement1.clsJumpTestFunction, bIncludeArgumentName:=False) clsRangeOrOp.AddParameter("range1", strParameterValue:=clsQCAcceptableRangeElement1.strTestName, bIncludeArgumentName:=False) - clsJumpListSubCalc.AddParameter("sub1", clsRFunctionParameter:=clsJumpCodeElement1.clsJumpTestFunction, bIncludeArgumentName:=False) - clsRangeListSubCalc.AddParameter("sub1", clsROperatorParameter:=clsQCAcceptableRangeElement1.clsRangeOrOperator, bIncludeArgumentName:=False) - clsOutliersElement1.clsOutlierUpperLimitCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) - clsOutliersElement1.clsOutlierLowerLimitCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) - clsOutlierListSubCalc.AddParameter("sub1", clsRFunctionParameter:=clsOutliersElement1.clsOutlierUpperLimitTestCalc, bIncludeArgumentName:=False, iPosition:=0) - 'clsOutlierListSubCalc.AddParameter("sub2", clsRFunctionParameter:=clsOutliersElement2.clsOutlierLowerLimitTestCalc, bIncludeArgumentName:=False, iPosition:=3) - clsOutlierCombinedOperator.AddParameter("sub1", strParameterValue:=clsOutliersElement1.strUpperTestName, bIncludeArgumentName:=False, iPosition:=0) - clsOutlierCombinedOperator.AddParameter("sub2", strParameterValue:=clsOutliersElement1.strLowerTestName, bIncludeArgumentName:=False, iPosition:=1) + clsRangeListSubCalc.AddParameter("range1", clsROperatorParameter:=clsQCAcceptableRangeElement1.clsRangeOrOperator, bIncludeArgumentName:=False) + clsOutlierListSubCalc.AddParameter("upperOutlierCalc1", clsRFunctionParameter:=clsOutliersElement1.clsOutlierUpperLimitTestCalc, bIncludeArgumentName:=False, iPosition:=0) + clsOutlierListSubCalc.AddParameter("lowerOutlierCalc1", clsRFunctionParameter:=clsOutliersElement1.clsOutlierLowerLimitTestCalc, bIncludeArgumentName:=False, iPosition:=3) + clsOutlierCombinedOperator.AddParameter("upperOutlierTest1", strParameterValue:=clsOutliersElement1.strUpperTestName, bIncludeArgumentName:=False, iPosition:=0) + clsOutlierCombinedOperator.AddParameter("lowerOutlierTest1", strParameterValue:=clsOutliersElement1.strLowerTestName, bIncludeArgumentName:=False, iPosition:=1) Else clsSameOp.RemoveParameterByName("same1") - clsSameListSubCalc.RemoveParameterByName("sub1") + clsSameListSubCalc.RemoveParameterByName("same1") clsJumpOp.RemoveParameterByName("jump1") + clsJumpListSubCalc.RemoveParameterByName("jump1") clsRangeOrOp.RemoveParameterByName("range1") - clsJumpListSubCalc.RemoveParameterByName("sub1") clsRangeListSubCalc.RemoveParameterByName("sub1") - clsOutlierListSubCalc.RemoveParameterByName("sub1") - clsOutlierListSubCalc.RemoveParameterByName("sub2") - clsOutlierCombinedOperator.RemoveParameterByName("sub1") - clsOutlierCombinedOperator.RemoveParameterByName("sub2") + clsOutlierListSubCalc.RemoveParameterByName("upperOutlierCalc1") + clsOutlierListSubCalc.RemoveParameterByName("lowerOutlierCalc1") + clsOutlierCombinedOperator.RemoveParameterByName("upperOutlierTest1") + clsOutlierCombinedOperator.RemoveParameterByName("lowerOutlierTest1") End If If Not ucrReceiverElement2.IsEmpty Then clsSameOp.AddParameter("same2", strParameterValue:=clsSameCodeElement2.strTestName, bIncludeArgumentName:=False) - clsSameListSubCalc.AddParameter("sub2", clsRFunctionParameter:=clsSameCodeElement2.clsSameTestFunction, bIncludeArgumentName:=False) + clsSameListSubCalc.AddParameter("same2", clsRFunctionParameter:=clsSameCodeElement2.clsSameTestFunction, bIncludeArgumentName:=False) clsJumpOp.AddParameter("jump2", strParameterValue:=clsJumpCodeElement2.strTestName, bIncludeArgumentName:=False) + clsJumpListSubCalc.AddParameter("jump2", clsRFunctionParameter:=clsJumpCodeElement2.clsJumpTestFunction, bIncludeArgumentName:=False) clsRange2OrOp.AddParameter("range2", strParameterValue:=clsQCAcceptableRangeElement2.strTestName, bIncludeArgumentName:=False) - clsJumpListSubCalc.AddParameter("sub2", clsRFunctionParameter:=clsJumpCodeElement2.clsJumpTestFunction, bIncludeArgumentName:=False) - clsRangeListSubCalc.AddParameter("sub2", clsROperatorParameter:=clsQCAcceptableRangeElement2.clsRangeOrOperator, bIncludeArgumentName:=False) - clsOutliersElement2.clsOutlierUpperLimitCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) - clsOutliersElement2.clsOutlierLowerLimitCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) - 'clsOutlierListSubCalc.AddParameter("sub3", clsRFunctionParameter:=clsOutliersElement1.clsOutlierLowerLimitTestCalc, bIncludeArgumentName:=False, iPosition:=1) - clsOutlierListSubCalc.AddParameter("sub4", clsRFunctionParameter:=clsOutliersElement2.clsOutlierUpperLimitTestCalc, bIncludeArgumentName:=False, iPosition:=4) - clsOutlierCombinedOperator.AddParameter("sub2", clsOutliersElement2.strUpperTestName, bIncludeArgumentName:=False, iPosition:=2) - clsOutlierCombinedOperator.AddParameter("sub3", clsOutliersElement2.strLowerTestName, bIncludeArgumentName:=False, iPosition:=3) - 'clsOutlierCombinedOperator.AddParameter("sub4", clsROperatorParameter:=clsOutlierLowerOperatorTmin, bIncludeArgumentName:=False) + clsRangeListSubCalc.AddParameter("range2", clsROperatorParameter:=clsQCAcceptableRangeElement2.clsRangeOrOperator, bIncludeArgumentName:=False) + clsOutlierListSubCalc.AddParameter("lowerOutlierCalc2", clsRFunctionParameter:=clsOutliersElement2.clsOutlierLowerLimitTestCalc, bIncludeArgumentName:=False, iPosition:=1) + clsOutlierListSubCalc.AddParameter("upperOutlierCalc2", clsRFunctionParameter:=clsOutliersElement2.clsOutlierUpperLimitTestCalc, bIncludeArgumentName:=False, iPosition:=4) + clsOutlierCombinedOperator.AddParameter("upperOutlierTest2", clsOutliersElement2.strUpperTestName, bIncludeArgumentName:=False, iPosition:=2) + clsOutlierCombinedOperator.AddParameter("lowerOutlierTest2", clsOutliersElement2.strLowerTestName, bIncludeArgumentName:=False, iPosition:=3) Else clsSameOp.RemoveParameterByName("same2") - clsSameListSubCalc.RemoveParameterByName("sub2") + clsSameListSubCalc.RemoveParameterByName("same2") clsJumpOp.RemoveParameterByName("jump2") + clsJumpListSubCalc.RemoveParameterByName("jump2") clsRange2OrOp.RemoveParameterByName("range2") - clsJumpListSubCalc.RemoveParameterByName("sub2") - clsRangeListSubCalc.RemoveParameterByName("sub2") - clsOutlierListSubCalc.RemoveParameterByName("sub3") - clsOutlierListSubCalc.RemoveParameterByName("sub4") - clsOutlierCombinedOperator.RemoveParameterByName("sub2") - clsOutlierCombinedOperator.RemoveParameterByName("sub3") + clsRangeListSubCalc.RemoveParameterByName("range2") + clsOutlierListSubCalc.RemoveParameterByName("lowerOutlierCalc2") + clsOutlierListSubCalc.RemoveParameterByName("upperOutlierCalc2") + clsOutlierCombinedOperator.RemoveParameterByName("upperOutlierTest2") + clsOutlierCombinedOperator.RemoveParameterByName("lowerOutlierTest2") End If If Not ucrReceiverElement1.IsEmpty AndAlso Not ucrReceiverElement2.IsEmpty Then @@ -633,6 +561,8 @@ Public Class dlgClimaticCheckDataTemperature clsSameCodeElement2.clsSameCalcFunction.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) clsQCAcceptableRangeElement1.clsAcceptableRangeTestFunc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) clsQCAcceptableRangeElement2.clsAcceptableRangeTestFunc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) + clsOutliersElement1.clsOutlierUpperLimitCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) + clsOutliersElement1.clsOutlierLowerLimitCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) ElseIf Not ucrReceiverElement2.IsEmpty Then clsCalcFilterFunc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) clsFilterFunc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) @@ -642,6 +572,8 @@ Public Class dlgClimaticCheckDataTemperature clsSameCodeElement2.clsSameCalcFunction.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) clsQCAcceptableRangeElement1.clsAcceptableRangeTestFunc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) clsQCAcceptableRangeElement2.clsAcceptableRangeTestFunc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) + clsOutliersElement2.clsOutlierUpperLimitCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) + clsOutliersElement2.clsOutlierLowerLimitCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) End If End Sub From 60cbd9be69ef524ed842b43f61ee244e499f9682 Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Wed, 27 Jun 2018 11:37:15 +0300 Subject: [PATCH 11/18] grouping by month for outliers --- instat/dlgClimaticCheckDataTemperature.vb | 30 ++++++++++++++--------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/instat/dlgClimaticCheckDataTemperature.vb b/instat/dlgClimaticCheckDataTemperature.vb index a53844ef2ce..2a63cabce41 100644 --- a/instat/dlgClimaticCheckDataTemperature.vb +++ b/instat/dlgClimaticCheckDataTemperature.vb @@ -468,28 +468,36 @@ Public Class dlgClimaticCheckDataTemperature clsGroupByMonth.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverMonth.GetVariableNames & ")", iPosition:=1) If Not ucrReceiverElement1.IsEmpty() Then clsOutliersElement1.clsOutlierUpperLimitCalc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) - 'clsOutlierLimitLowerCalcTmax.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) + clsOutliersElement1.clsOutlierUpperLimitTestCalc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) + clsOutliersElement1.clsOutlierLowerLimitCalc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) + clsOutliersElement1.clsOutlierLowerLimitTestCalc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) ElseIf ucrReceiverElement1.IsEmpty() Then clsOutliersElement1.clsOutlierUpperLimitCalc.RemoveParameterByName("manipulations") - 'clsOutlierLimitUpperCalcTmax.RemoveParameterByName("manipulations") - 'clsOutlierLimitLowerCalcTmax.RemoveParameterByName("manipulations") + clsOutliersElement1.clsOutlierUpperLimitTestCalc.RemoveParameterByName("manipulations") + clsOutliersElement1.clsOutlierLowerLimitCalc.RemoveParameterByName("manipulations") + clsOutliersElement1.clsOutlierLowerLimitTestCalc.RemoveParameterByName("manipulations") End If If Not ucrReceiverElement2.IsEmpty() Then clsOutliersElement2.clsOutlierUpperLimitCalc.RemoveParameterByName("manipulations") - 'clsOutlierLimitUpperCalcTmin.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) - 'clsOutlierLimitLowerCalcTmin.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) + clsOutliersElement2.clsOutlierUpperLimitCalc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) + clsOutliersElement2.clsOutlierUpperLimitTestCalc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) + clsOutliersElement2.clsOutlierLowerLimitCalc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) + clsOutliersElement2.clsOutlierLowerLimitTestCalc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) ElseIf ucrReceiverElement2.IsEmpty Then clsOutliersElement2.clsOutlierUpperLimitCalc.RemoveParameterByName("manipulations") - 'clsOutlierLimitUpperCalcTmin.RemoveParameterByName("manipulations") - ' clsOutlierLimitLowerCalcTmin.RemoveParameterByName("manipulations") + clsOutliersElement2.clsOutlierUpperLimitTestCalc.RemoveParameterByName("manipulations") + clsOutliersElement2.clsOutlierLowerLimitCalc.RemoveParameterByName("manipulations") + clsOutliersElement2.clsOutlierLowerLimitTestCalc.RemoveParameterByName("manipulations") End If Else clsOutliersElement1.clsOutlierUpperLimitCalc.RemoveParameterByName("manipulations") clsOutliersElement2.clsOutlierUpperLimitCalc.RemoveParameterByName("manipulations") - 'clsOutlierLimitUpperCalcTmax.RemoveParameterByName("manipulations") - 'clsOutlierLimitLowerCalcTmax.RemoveParameterByName("manipulations") - ' clsOutlierLimitUpperCalcTmin.RemoveParameterByName("manipulations") - ' clsOutlierLimitLowerCalcTmin.RemoveParameterByName("manipulations") + clsOutliersElement1.clsOutlierUpperLimitTestCalc.RemoveParameterByName("manipulations") + clsOutliersElement2.clsOutlierUpperLimitTestCalc.RemoveParameterByName("manipulations") + clsOutliersElement1.clsOutlierLowerLimitCalc.RemoveParameterByName("manipulations") + clsOutliersElement2.clsOutlierLowerLimitCalc.RemoveParameterByName("manipulations") + clsOutliersElement1.clsOutlierLowerLimitTestCalc.RemoveParameterByName("manipulations") + clsOutliersElement2.clsOutlierLowerLimitTestCalc.RemoveParameterByName("manipulations") End If End Sub From 6f96f12fdc70d4125873fea81813655f6ca433f6 Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Wed, 27 Jun 2018 12:13:19 +0300 Subject: [PATCH 12/18] saving calculated column for outliers --- instat/dlgClimaticCheckDataRain.vb | 1 + 1 file changed, 1 insertion(+) diff --git a/instat/dlgClimaticCheckDataRain.vb b/instat/dlgClimaticCheckDataRain.vb index e7eebcc101f..739c61beddd 100644 --- a/instat/dlgClimaticCheckDataRain.vb +++ b/instat/dlgClimaticCheckDataRain.vb @@ -374,6 +374,7 @@ Public Class dlgClimaticCheckDataRain ucrChkWetDays.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("wet_days", strParamValue:=clsCumulativeTestFunc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) ucrChkOutlier.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("outlier", strParamValue:=clsOutlierlimitTestFunc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) ucrChkCalculatedColumns.AddAdditionalCodeParameterPair(clsCumulativeCalcFunc, New RParameter("save"), iAdditionalPairNo:=1) + ucrChkCalculatedColumns.AddAdditionalCodeParameterPair(clsOutlierLimitValueCalcFunc, New RParameter("save"), iAdditionalPairNo:=2) ucrChkLogicalColumns.AddAdditionalCodeParameterPair(clsSameTestFunc, New RParameter("save"), iAdditionalPairNo:=1) ucrChkLogicalColumns.AddAdditionalCodeParameterPair(clsCumulativeTestFunc, New RParameter("save"), iAdditionalPairNo:=2) From f2129c38fa09316a898ac8c61203cc5efc8f81cc Mon Sep 17 00:00:00 2001 From: Lazarus Kioko Muthenya Date: Wed, 27 Jun 2018 12:35:54 +0300 Subject: [PATCH 13/18] Edits on Boxplot and Climatic Boxplot --- instat/dlgBoxPlot.vb | 15 --------------- instat/dlgClimaticBoxPlot.vb | 17 ++++++++++++++--- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/instat/dlgBoxPlot.vb b/instat/dlgBoxPlot.vb index ddbf9a03437..a792f9c1feb 100644 --- a/instat/dlgBoxPlot.vb +++ b/instat/dlgBoxPlot.vb @@ -264,7 +264,6 @@ Public Class dlgBoxplot ucrSaveBoxplot.SetPrefix("boxplot") ucrSecondFactorReceiver.ChangeParameterName("fill") - SetOptionsButtonText() ElseIf rdoJitter.Checked Then clsRgeomPlotFunction.SetRCommand("geom_jitter") @@ -274,7 +273,6 @@ Public Class dlgBoxplot ucrSaveBoxplot.SetPrefix("jitter") ucrSecondFactorReceiver.ChangeParameterName("colour") - SetOptionsButtonText() Else clsRgeomPlotFunction.SetRCommand("geom_violin") @@ -295,22 +293,9 @@ Public Class dlgBoxplot cmdBoxPlotOptions.Text = "Jitter Options" Else cmdBoxPlotOptions.Text = "Violin Options" - - SetOptionsButtonText() - End If End Sub - - Private Sub SetOptionsButtonText() - If rdoBoxplot.Checked Then - cmdBoxPlotOptions.Text = "Boxplot Options" - ElseIf rdoJitter.Checked Then - cmdBoxPlotOptions.Text = "Jitter Options" - Else - cmdBoxPlotOptions.Text = "Violin Options" - End If - End Sub Private Sub TempOptionsDisabledInMultipleVariablesCase() If ucrVariablesAsFactorForBoxplot.bSingleVariable Then cmdBoxPlotOptions.Enabled = True diff --git a/instat/dlgClimaticBoxPlot.vb b/instat/dlgClimaticBoxPlot.vb index 8f3f85d60fe..46f668c491f 100644 --- a/instat/dlgClimaticBoxPlot.vb +++ b/instat/dlgClimaticBoxPlot.vb @@ -71,6 +71,8 @@ Public Class dlgClimaticBoxPlot bReset = False autoTranslate(Me) TestOKEnabled() + + SetOptionsButtonstext() End Sub Private Sub InitialiseDialog() @@ -308,6 +310,7 @@ Public Class dlgClimaticBoxPlot SetDefaults() SetRCodeForControls(True) AutoFill() + UpdateParameters() TestOKEnabled() End Sub @@ -324,25 +327,33 @@ Public Class dlgClimaticBoxPlot Private Sub ucrPnlPlots_ControlValueChanged() Handles ucrPnlPlots.ControlValueChanged If rdoBoxplot.Checked Then clsRgeomPlotFunction.SetRCommand("geom_boxplot") - cmdBoxPlotOptions.Text = "Boxplot Options" If Not ucrSavePlot.bUserTyped Then ucrSavePlot.SetPrefix("boxplot") End If ElseIf rdoJitter.Checked Then clsRgeomPlotFunction.SetRCommand("geom_jitter") - cmdBoxPlotOptions.Text = "Jitter Options" If Not ucrSavePlot.bUserTyped Then ucrSavePlot.SetPrefix("jitter") End If Else clsRgeomPlotFunction.SetRCommand("geom_violin") - cmdBoxPlotOptions.Text = "Violin Options" If Not ucrSavePlot.bUserTyped Then ucrSavePlot.SetPrefix("violin") End If End If UpdateParameters() AddRemoveFacets() + SetOptionsButtonstext() + End Sub + + Private Sub SetOptionsButtonstext() + If rdoBoxplot.Checked Then + cmdBoxPlotOptions.Text = "Boxplot Options" + ElseIf rdoJitter.Checked Then + cmdBoxPlotOptions.Text = "Jitter Options" + Else + cmdBoxPlotOptions.Text = "Violin Options" + End If End Sub Private Sub cmdBoxPlotOptions_Click(sender As Object, e As EventArgs) Handles cmdBoxPlotOptions.Click From e245e28d24bc6dd9a1a6167e538120a4425908d2 Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Wed, 27 Jun 2018 15:03:30 +0300 Subject: [PATCH 14/18] lower limit for outliers --- instat/dlgClimaticCheckDataRain.vb | 136 +++++++++++++++++++---------- 1 file changed, 89 insertions(+), 47 deletions(-) diff --git a/instat/dlgClimaticCheckDataRain.vb b/instat/dlgClimaticCheckDataRain.vb index 739c61beddd..f5abde050f3 100644 --- a/instat/dlgClimaticCheckDataRain.vb +++ b/instat/dlgClimaticCheckDataRain.vb @@ -23,7 +23,7 @@ Public Class dlgClimaticCheckDataRain Private clsGroupByFunc, clsRainFilterFunc, clsRunCalcFunc, clsListFunc, clsGroupByMonth As New RFunction 'Large Private clsLargeTestCalcFunc As New RFunction - Private clsLargeOperator, clsOrLargeOperator, clsLargeLessOperator, clsOutlierOperator, clsRainyDaysOperator As New ROperator + Private clsLargeOperator, clsOrLargeOperator, clsLargeLessOperator, clsRainyDaysOperator As New ROperator Private clsManipList As New RFunction Private strLargeTest As String = "Large" 'Same @@ -44,8 +44,13 @@ Public Class dlgClimaticCheckDataRain Private clsOrOperator As New ROperator Private clsListSubCalc As New RFunction 'Outlier - Private clsListForOutlierManipulations, clsRainyDaysFunc, clsOutlierLimitFunc, clsOutlierLimitValueCalcFunc, clsOutlierlimitTestFunc, clsListOutlier As New RFunction - Private strOutlierTest As String = "Outlier" + Private clsListForOutlierManipulations, clsRainyDaysFunc, clsUpperOutlierLimitFunc, clsUpperOutlierLimitValueCalcFunc, clsUpperOutlierlimitTestFunc, clsUpperListOutlier As New RFunction + Private clsUpperOutlierOperator As New ROperator + Private strUpperOutlierTest As String = "upper_outlier" + Private clsLowerOutlierLimitValueCalcFunc, clsLowerOutlierlimitTestFunc, clsLowerListOutlier, clsLowerOutlierLimitFunc As New RFunction + Private clsLowerOutlierOperator As New ROperator + Private strLowerOutlierTest As String = "lower_outlier" + Private clsOutliersOperator As New ROperator Private Sub dlgRain_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstload Then @@ -73,7 +78,6 @@ Public Class dlgClimaticCheckDataRain ucrChkDryMonth.Enabled = False ucrChkOmitZero.Checked = True - ucrReceiverStation.Selector = ucrSelectorRain ucrReceiverStation.SetClimaticType("station") ucrReceiverStation.bAutoFill = True @@ -114,7 +118,7 @@ Public Class dlgClimaticCheckDataRain ucrNudSame.SetParameter(New RParameter("right", 1, bNewIncludeArgumentName:=False)) ucrNudWetDays.SetParameter(New RParameter("right", 1, bNewIncludeArgumentName:=False)) - ucrChkOutlier.SetParameter(New RParameter("outlier.limit", strOutlierTest, 1), bNewChangeParameterValue:=False) + ucrChkOutlier.SetParameter(New RParameter("outlier.limit", strUpperOutlierTest, 1), bNewChangeParameterValue:=False) ucrChkOutlier.SetText("Outlier") ucrNudCoeff.SetParameter(New RParameter("coeff", 1)) @@ -155,7 +159,8 @@ Public Class dlgClimaticCheckDataRain Private Sub SetDefaults() Dim strLengths As String = "lengths" - Dim strOutlier_Limit As String = "outlier_limit" + Dim strUpperOutlierLimit As String = "outlier_upper_limit" + Dim strLowerOutlierLimit As String = "outlier_lower_limit" clsRleFunc = New RFunction clsRepFunc = New RFunction clsAsNumericFunc = New RFunction @@ -167,7 +172,7 @@ Public Class dlgClimaticCheckDataRain clsLargeLessOperator = New ROperator clsRainyDaysOperator.Clear() - clsOutlierOperator.Clear() + clsUpperOutlierOperator.Clear() clsOrLargeOperator.Clear() clsGreaterSameOperator.Clear() clsGreatOperator.Clear() @@ -178,8 +183,7 @@ Public Class dlgClimaticCheckDataRain clsCumulativeTestFunc.Clear() clsSameTestFunc.Clear() clsCumulativeCalcFunc.Clear() - clsOutlierlimitTestFunc.Clear() - 'clsOutlierLimitValueCalcFunc.Cleear() + clsUpperOutlierlimitTestFunc.Clear() ucrSelectorRain.Reset() ucrReceiverStation.SetMeAsReceiver() @@ -300,6 +304,7 @@ Public Class dlgClimaticCheckDataRain clsCumulativeList.SetRCommand("list") clsCumulativeList.AddParameter("sub1", clsRFunctionParameter:=clsCumulativeCalcFunc, bIncludeArgumentName:=False) + 'Group By Month clsGroupByMonth.SetRCommand("instat_calculation$new") clsGroupByMonth.AddParameter("type", Chr(34) & "by" & Chr(34), iPosition:=0) @@ -321,32 +326,62 @@ Public Class dlgClimaticCheckDataRain clsRainyDaysFunc.AddParameter("function_exp", clsROperatorParameter:=clsRainyDaysOperator, iPosition:=0) clsRainyDaysFunc.SetAssignTo("rainydays_filter") - 'Outlier Limit function - clsOutlierLimitValueCalcFunc.SetRCommand("instat_calculation$new") - clsOutlierLimitValueCalcFunc.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) - clsOutlierLimitValueCalcFunc.AddParameter("function_exp", clsRFunctionParameter:=clsOutlierLimitFunc, iPosition:=1) - clsOutlierLimitValueCalcFunc.AddParameter("result_name", Chr(34) & strOutlier_Limit & Chr(34), iPosition:=4) - clsOutlierLimitValueCalcFunc.AddParameter("save", "0", iPosition:=5) - clsOutlierLimitValueCalcFunc.SetAssignTo("outlier_limit") - clsOutlierLimitFunc.SetRCommand("summary_outlier_limit") - clsOutlierLimitFunc.bToScriptAsRString = True - clsOutlierLimitFunc.AddParameter("bskewedcalc", "TRUE") + 'upper Outlier Limit function + clsUpperOutlierLimitValueCalcFunc.SetRCommand("instat_calculation$new") + clsUpperOutlierLimitValueCalcFunc.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) + clsUpperOutlierLimitValueCalcFunc.AddParameter("function_exp", clsRFunctionParameter:=clsUpperOutlierLimitFunc, iPosition:=1) + clsUpperOutlierLimitValueCalcFunc.AddParameter("result_name", Chr(34) & strUpperOutlierLimit & Chr(34), iPosition:=4) + clsUpperOutlierLimitValueCalcFunc.SetAssignTo("outlier_upper_limit") + clsUpperOutlierLimitFunc.SetRCommand("summary_outlier_limit") + clsUpperOutlierLimitFunc.bToScriptAsRString = True + clsUpperOutlierLimitFunc.AddParameter("bskewedcalc", "TRUE") + + 'Outlier Operator + clsUpperOutlierOperator.SetOperation(">") + clsUpperOutlierOperator.AddParameter("right", strUpperOutlierLimit, iPosition:=1) + clsUpperOutlierOperator.bBrackets = False + clsUpperOutlierOperator.bToScriptAsRString = True + + clsUpperOutlierlimitTestFunc.SetRCommand("instat_calculation$new") + clsUpperOutlierlimitTestFunc.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) + clsUpperOutlierlimitTestFunc.AddParameter("function_exp", clsROperatorParameter:=clsUpperOutlierOperator, iPosition:=1) + clsUpperOutlierlimitTestFunc.AddParameter("result_name", Chr(34) & strUpperOutlierTest & Chr(34)) + clsUpperOutlierlimitTestFunc.AddParameter("sub_calculations", clsRFunctionParameter:=clsUpperListOutlier) + clsUpperOutlierlimitTestFunc.SetAssignTo("outlier_upper_test_calculation") + + clsUpperListOutlier.SetRCommand("list") + clsUpperListOutlier.AddParameter("sub1", clsRFunctionParameter:=clsUpperOutlierLimitValueCalcFunc, bIncludeArgumentName:=False) + + 'lower Outlier Limit function + clsLowerOutlierLimitValueCalcFunc.SetRCommand("instat_calculation$new") + clsLowerOutlierLimitValueCalcFunc.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) + clsLowerOutlierLimitValueCalcFunc.AddParameter("function_exp", clsRFunctionParameter:=clsLowerOutlierLimitFunc, iPosition:=1) + clsLowerOutlierLimitValueCalcFunc.AddParameter("result_name", Chr(34) & strLowerOutlierLimit & Chr(34), iPosition:=4) + clsLowerOutlierLimitValueCalcFunc.SetAssignTo("outlier_lower_limit") + + clsLowerOutlierLimitFunc.SetRCommand("summary_outlier_limit") + clsLowerOutlierLimitFunc.bToScriptAsRString = True + clsLowerOutlierLimitFunc.AddParameter("bskewedcalc", "FALSE") 'Outlier Operator - clsOutlierOperator.SetOperation(">") - clsOutlierOperator.AddParameter("right", strOutlier_Limit, iPosition:=1) - clsOutlierOperator.bBrackets = False - clsOutlierOperator.bToScriptAsRString = True + clsLowerOutlierOperator.SetOperation("<") + clsLowerOutlierOperator.AddParameter("right", strLowerOutlierLimit, iPosition:=1) + clsLowerOutlierOperator.bBrackets = False + clsLowerOutlierOperator.bToScriptAsRString = True - clsOutlierlimitTestFunc.SetRCommand("instat_calculation$new") - clsOutlierlimitTestFunc.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) - clsOutlierlimitTestFunc.AddParameter("function_exp", clsROperatorParameter:=clsOutlierOperator, iPosition:=1) - clsOutlierlimitTestFunc.AddParameter("result_name", Chr(34) & strOutlierTest & Chr(34)) - clsOutlierlimitTestFunc.AddParameter("sub_calculations", clsRFunctionParameter:=clsListOutlier) - clsOutlierlimitTestFunc.SetAssignTo("outlier_test_calculation") + clsLowerOutlierlimitTestFunc.SetRCommand("instat_calculation$new") + clsLowerOutlierlimitTestFunc.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) + clsLowerOutlierlimitTestFunc.AddParameter("function_exp", clsROperatorParameter:=clsLowerOutlierOperator, iPosition:=1) + clsLowerOutlierlimitTestFunc.AddParameter("result_name", Chr(34) & strLowerOutlierTest & Chr(34)) + clsLowerOutlierlimitTestFunc.AddParameter("sub_calculations", clsRFunctionParameter:=clsLowerListOutlier) + clsLowerOutlierlimitTestFunc.SetAssignTo("outlier_lower_test_calculation") - clsListOutlier.SetRCommand("list") - clsListOutlier.AddParameter("sub1", clsRFunctionParameter:=clsOutlierLimitValueCalcFunc, bIncludeArgumentName:=False) + clsLowerListOutlier.SetRCommand("list") + clsLowerListOutlier.AddParameter("sub1", clsRFunctionParameter:=clsLowerOutlierLimitValueCalcFunc, bIncludeArgumentName:=False) + + clsOutliersOperator.SetOperation(",") + clsOutliersOperator.AddParameter("sub1", clsRFunctionParameter:=clsUpperOutlierlimitTestFunc, bIncludeArgumentName:=False) + clsOutliersOperator.AddParameter("sub2", clsRFunctionParameter:=clsLowerOutlierlimitTestFunc, bIncludeArgumentName:=False) 'Combined filters clsOrOperator.SetOperation("|") @@ -361,25 +396,29 @@ Public Class dlgClimaticCheckDataRain End Sub Private Sub setRcodeForControls(bReset) - ucrReceiverElement.AddAdditionalCodeParameterPair(clsGreaterOperator, New RParameter("left", 0), iAdditionalPairNo:=1) - ucrReceiverElement.AddAdditionalCodeParameterPair(clsAsNumericFunc, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=2) - ucrReceiverElement.AddAdditionalCodeParameterPair(clsLargeLessOperator, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=3) - ucrReceiverElement.AddAdditionalCodeParameterPair(clsOutlierOperator, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=4) - ucrReceiverElement.AddAdditionalCodeParameterPair(clsOutlierLimitFunc, New RParameter("x", 0), iAdditionalPairNo:=5) - ucrReceiverElement.AddAdditionalCodeParameterPair(clsRainyDaysOperator, New RParameter("left", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=6) - ucrReceiverElement.SetRCode(clsLargeOperator, bReset) + ucrReceiverElement.AddAdditionalCodeParameterPair(clsGreaterOperator, New RParameter("rain", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) + ucrReceiverElement.AddAdditionalCodeParameterPair(clsAsNumericFunc, New RParameter("rain", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=2) + ucrReceiverElement.AddAdditionalCodeParameterPair(clsLargeLessOperator, New RParameter("rain", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=3) + ucrReceiverElement.AddAdditionalCodeParameterPair(clsUpperOutlierOperator, New RParameter("rain", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=4) + ucrReceiverElement.AddAdditionalCodeParameterPair(clsUpperOutlierLimitFunc, New RParameter("rain", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=5) + ucrReceiverElement.AddAdditionalCodeParameterPair(clsRainyDaysOperator, New RParameter("rain", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=6) + ucrReceiverElement.AddAdditionalCodeParameterPair(clsLowerOutlierLimitFunc, New RParameter("rain", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=7) + ucrReceiverElement.AddAdditionalCodeParameterPair(clsLowerOutlierOperator, New RParameter("rain", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=8) ucrChkLarge.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("large", strParamValue:=clsLargeTestCalcFunc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) ucrChkSame.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("same", strParamValue:=clsSameTestFunc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) ucrChkWetDays.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("wet_days", strParamValue:=clsCumulativeTestFunc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) - ucrChkOutlier.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("outlier", strParamValue:=clsOutlierlimitTestFunc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) + ucrChkOutlier.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("outlier", clsOutliersOperator, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) ucrChkCalculatedColumns.AddAdditionalCodeParameterPair(clsCumulativeCalcFunc, New RParameter("save"), iAdditionalPairNo:=1) - ucrChkCalculatedColumns.AddAdditionalCodeParameterPair(clsOutlierLimitValueCalcFunc, New RParameter("save"), iAdditionalPairNo:=2) + ucrChkCalculatedColumns.AddAdditionalCodeParameterPair(clsUpperOutlierLimitValueCalcFunc, New RParameter("save"), iAdditionalPairNo:=2) + ucrChkCalculatedColumns.AddAdditionalCodeParameterPair(clsLowerOutlierLimitValueCalcFunc, New RParameter("save"), iAdditionalPairNo:=3) ucrChkLogicalColumns.AddAdditionalCodeParameterPair(clsSameTestFunc, New RParameter("save"), iAdditionalPairNo:=1) ucrChkLogicalColumns.AddAdditionalCodeParameterPair(clsCumulativeTestFunc, New RParameter("save"), iAdditionalPairNo:=2) - ucrChkLogicalColumns.AddAdditionalCodeParameterPair(clsOutlierlimitTestFunc, New RParameter("save"), iAdditionalPairNo:=3) + ucrChkLogicalColumns.AddAdditionalCodeParameterPair(clsUpperOutlierlimitTestFunc, New RParameter("save"), iAdditionalPairNo:=3) + ucrChkLogicalColumns.AddAdditionalCodeParameterPair(clsLowerOutlierlimitTestFunc, New RParameter("save"), iAdditionalPairNo:=4) + ucrReceiverElement.SetRCode(clsLargeOperator, bReset) ucrNudLarge.SetRCode(clsLargeOperator, bReset) ucrNudSame.SetRCode(clsGreaterSameOperator, bReset) ucrNudWetDays.SetRCode(clsGreatOperator, bReset) @@ -388,10 +427,10 @@ Public Class dlgClimaticCheckDataRain ucrChkSame.SetRCode(clsOrOperator, bReset) ucrChkWetDays.SetRCode(clsOrOperator, bReset) ucrChkOmitZero.SetRCode(clsRainyDaysFunc) - ucrNudCoeff.SetRCode(clsOutlierLimitFunc, bReset) + ucrNudCoeff.SetRCode(clsUpperOutlierLimitFunc, bReset) ucrChkOutlier.SetRCode(clsOrOperator, bReset) - ucrNudSkewnessWeight.SetRCode(clsOutlierLimitFunc, bReset) + ucrNudSkewnessWeight.SetRCode(clsUpperOutlierLimitFunc, bReset) ucrChkLogicalColumns.SetRCode(clsLargeTestCalcFunc, bReset) ucrChkCalculatedColumns.SetRCode(clsSameCalcFunc, bReset) @@ -420,7 +459,10 @@ Public Class dlgClimaticCheckDataRain clsLargeTestCalcFunc.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverElement.GetVariableNames & ")", iPosition:=2) clsSameCalcFunc.AddParameter("calculated_from", "list(" & strCurrDataName & "= " & ucrReceiverElement.GetVariableNames & ")", iPosition:=2) clsCumulativeCalcFunc.AddParameter("calculated_from", "list(" & strCurrDataName & "= " & ucrReceiverElement.GetVariableNames & ")", iPosition:=2) - clsOutlierlimitTestFunc.AddParameter("calculated_from", "list(" & strCurrDataName & "= " & ucrReceiverElement.GetVariableNames & ")", iPosition:=2) + clsUpperOutlierlimitTestFunc.AddParameter("calculated_from", "list(" & strCurrDataName & "= " & ucrReceiverElement.GetVariableNames & ")", iPosition:=2) + clsLowerOutlierlimitTestFunc.AddParameter("calculated_from", "list(" & strCurrDataName & "= " & ucrReceiverElement.GetVariableNames & ")", iPosition:=2) + clsLowerOutlierLimitValueCalcFunc.AddParameter("calculated_from", "list(" & strCurrDataName & "= " & ucrReceiverElement.GetVariableNames & ")", iPosition:=2) + End Sub Private Sub GroupByOptions() @@ -435,9 +477,9 @@ Public Class dlgClimaticCheckDataRain Private Sub GroupByMonth() If Not ucrReceiverMonth.IsEmpty Then clsGroupByMonth.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverMonth.GetVariableNames & ")", iPosition:=1) - clsOutlierLimitValueCalcFunc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) + clsUpperOutlierLimitValueCalcFunc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) Else - clsOutlierLimitValueCalcFunc.RemoveParameterByName("manipulations") + clsUpperOutlierLimitValueCalcFunc.RemoveParameterByName("manipulations") End If End Sub @@ -446,7 +488,7 @@ Public Class dlgClimaticCheckDataRain End Sub Private Sub OutlierLimitCalc() - clsOutlierLimitValueCalcFunc.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverElement.GetVariableNames & ")", iPosition:=2) + clsUpperOutlierLimitValueCalcFunc.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverElement.GetVariableNames & ")", iPosition:=2) End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset From 8720625d2366d83ea0fec8fe5f147e711f260fde Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Wed, 27 Jun 2018 15:26:45 +0300 Subject: [PATCH 15/18] grouping by month --- instat/dlgClimaticCheckDataRain.vb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/instat/dlgClimaticCheckDataRain.vb b/instat/dlgClimaticCheckDataRain.vb index f5abde050f3..2b961799da3 100644 --- a/instat/dlgClimaticCheckDataRain.vb +++ b/instat/dlgClimaticCheckDataRain.vb @@ -184,6 +184,7 @@ Public Class dlgClimaticCheckDataRain clsSameTestFunc.Clear() clsCumulativeCalcFunc.Clear() clsUpperOutlierlimitTestFunc.Clear() + clsListForOutlierManipulations.Clear() ucrSelectorRain.Reset() ucrReceiverStation.SetMeAsReceiver() @@ -312,7 +313,7 @@ Public Class dlgClimaticCheckDataRain clsListForOutlierManipulations.SetRCommand("list") clsListForOutlierManipulations.AddParameter("sub1", clsRFunctionParameter:=clsGroupByMonth, bIncludeArgumentName:=False, iPosition:=0) - clsListForOutlierManipulations.AddParameter("sub2", clsRFunctionParameter:=clsRainyDaysFunc, bIncludeArgumentName:=False, iPosition:=1) + 'clsListForOutlierManipulations.AddParameter("sub2", clsRFunctionParameter:=clsRainyDaysFunc, bIncludeArgumentName:=False, iPosition:=1) 'Rainy Days Operator clsRainyDaysOperator.SetOperation(">") @@ -478,8 +479,10 @@ Public Class dlgClimaticCheckDataRain If Not ucrReceiverMonth.IsEmpty Then clsGroupByMonth.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverMonth.GetVariableNames & ")", iPosition:=1) clsUpperOutlierLimitValueCalcFunc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) + clsLowerOutlierLimitValueCalcFunc.AddParameter("manipulations", clsRFunctionParameter:=clsListForOutlierManipulations, iPosition:=3) Else clsUpperOutlierLimitValueCalcFunc.RemoveParameterByName("manipulations") + clsLowerOutlierLimitValueCalcFunc.RemoveParameterByName("manipulations") End If End Sub From fc6dc0bcb42420e05f0224b39661adcaee7be8e6 Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Wed, 27 Jun 2018 16:43:09 +0300 Subject: [PATCH 16/18] commented out lower limits calculation. --- instat/dlgClimaticCheckDataRain.vb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/instat/dlgClimaticCheckDataRain.vb b/instat/dlgClimaticCheckDataRain.vb index 2b961799da3..da587a4e784 100644 --- a/instat/dlgClimaticCheckDataRain.vb +++ b/instat/dlgClimaticCheckDataRain.vb @@ -47,6 +47,7 @@ Public Class dlgClimaticCheckDataRain Private clsListForOutlierManipulations, clsRainyDaysFunc, clsUpperOutlierLimitFunc, clsUpperOutlierLimitValueCalcFunc, clsUpperOutlierlimitTestFunc, clsUpperListOutlier As New RFunction Private clsUpperOutlierOperator As New ROperator Private strUpperOutlierTest As String = "upper_outlier" + Private clsLowerOutlierLimitValueCalcFunc, clsLowerOutlierlimitTestFunc, clsLowerListOutlier, clsLowerOutlierLimitFunc As New RFunction Private clsLowerOutlierOperator As New ROperator Private strLowerOutlierTest As String = "lower_outlier" @@ -187,7 +188,7 @@ Public Class dlgClimaticCheckDataRain clsListForOutlierManipulations.Clear() ucrSelectorRain.Reset() - ucrReceiverStation.SetMeAsReceiver() + ucrReceiverElement.SetMeAsReceiver() 'Group Function clsGroupByFunc.SetRCommand("instat_calculation$new") @@ -382,7 +383,9 @@ Public Class dlgClimaticCheckDataRain clsOutliersOperator.SetOperation(",") clsOutliersOperator.AddParameter("sub1", clsRFunctionParameter:=clsUpperOutlierlimitTestFunc, bIncludeArgumentName:=False) - clsOutliersOperator.AddParameter("sub2", clsRFunctionParameter:=clsLowerOutlierlimitTestFunc, bIncludeArgumentName:=False) + + 'Removed this sub_claculation because lower limit is not of interest for rainfall data. + 'clsOutliersOperator.AddParameter("sub2", clsRFunctionParameter:=clsLowerOutlierlimitTestFunc, bIncludeArgumentName:=False) 'Combined filters clsOrOperator.SetOperation("|") @@ -410,9 +413,9 @@ Public Class dlgClimaticCheckDataRain ucrChkSame.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("same", strParamValue:=clsSameTestFunc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) ucrChkWetDays.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("wet_days", strParamValue:=clsCumulativeTestFunc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) ucrChkOutlier.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("outlier", clsOutliersOperator, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) - ucrChkCalculatedColumns.AddAdditionalCodeParameterPair(clsCumulativeCalcFunc, New RParameter("save"), iAdditionalPairNo:=1) - ucrChkCalculatedColumns.AddAdditionalCodeParameterPair(clsUpperOutlierLimitValueCalcFunc, New RParameter("save"), iAdditionalPairNo:=2) - ucrChkCalculatedColumns.AddAdditionalCodeParameterPair(clsLowerOutlierLimitValueCalcFunc, New RParameter("save"), iAdditionalPairNo:=3) + 'ucrChkCalculatedColumns.AddAdditionalCodeParameterPair(, New RParameter("save"), iAdditionalPairNo:=1) + ucrChkCalculatedColumns.AddAdditionalCodeParameterPair(clsUpperOutlierLimitValueCalcFunc, New RParameter("save"), iAdditionalPairNo:=1) + ucrChkCalculatedColumns.AddAdditionalCodeParameterPair(clsLowerOutlierLimitValueCalcFunc, New RParameter("save"), iAdditionalPairNo:=2) ucrChkLogicalColumns.AddAdditionalCodeParameterPair(clsSameTestFunc, New RParameter("save"), iAdditionalPairNo:=1) ucrChkLogicalColumns.AddAdditionalCodeParameterPair(clsCumulativeTestFunc, New RParameter("save"), iAdditionalPairNo:=2) @@ -434,7 +437,7 @@ Public Class dlgClimaticCheckDataRain ucrNudSkewnessWeight.SetRCode(clsUpperOutlierLimitFunc, bReset) ucrChkLogicalColumns.SetRCode(clsLargeTestCalcFunc, bReset) - ucrChkCalculatedColumns.SetRCode(clsSameCalcFunc, bReset) + ucrChkCalculatedColumns.SetRCode(clsCumulativeCalcFunc, bReset) End Sub Private Sub TestOkEnabled() From f98878dce65b72f85e0c85957f41b6b8da345cab Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Wed, 27 Jun 2018 17:22:05 +0300 Subject: [PATCH 17/18] Bug Fix --- instat/dlgClimaticCheckDataRain.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgClimaticCheckDataRain.vb b/instat/dlgClimaticCheckDataRain.vb index da587a4e784..9aa3211483a 100644 --- a/instat/dlgClimaticCheckDataRain.vb +++ b/instat/dlgClimaticCheckDataRain.vb @@ -122,7 +122,7 @@ Public Class dlgClimaticCheckDataRain ucrChkOutlier.SetParameter(New RParameter("outlier.limit", strUpperOutlierTest, 1), bNewChangeParameterValue:=False) ucrChkOutlier.SetText("Outlier") - ucrNudCoeff.SetParameter(New RParameter("coeff", 1)) + ucrNudCoeff.SetParameter(New RParameter("coef", 1)) ucrNudCoeff.DecimalPlaces = 1 ucrNudCoeff.Increment = 0.1 ucrNudCoeff.SetRDefault("1.5") From 90dcae05f0a9791b880836a99e1fd34a04d3a1d8 Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Wed, 27 Jun 2018 17:28:02 +0300 Subject: [PATCH 18/18] Bug fix --- instat/dlgClimaticCheckDataTemperature.vb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/instat/dlgClimaticCheckDataTemperature.vb b/instat/dlgClimaticCheckDataTemperature.vb index 2a63cabce41..1012e6e5991 100644 --- a/instat/dlgClimaticCheckDataTemperature.vb +++ b/instat/dlgClimaticCheckDataTemperature.vb @@ -147,7 +147,7 @@ Public Class dlgClimaticCheckDataTemperature ucrChkOutlier.SetParameter(New RParameter("Combined_outlier", clsOutlierCombinedOperator, 1), bNewChangeParameterValue:=False) ucrChkOutlier.SetText("Outlier") - ucrNudCoeff.SetParameter(New RParameter("coeff")) + ucrNudCoeff.SetParameter(New RParameter("coef")) ucrNudCoeff.DecimalPlaces = 1 ucrNudCoeff.Increment = 0.1 @@ -316,10 +316,10 @@ Public Class dlgClimaticCheckDataTemperature ucrChkSame.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("same", strParamValue:=clsSameListSubCalc, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) ucrChkDifference.AddAdditionalCodeParameterPair(clsListSubCalc, New RParameter("diff", strParamValue:=clsQCDifferenceRCode.clsDiffTestFunction, bNewIncludeArgumentName:=False), iAdditionalPairNo:=1) - ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierLowerLimitFunc, New RParameter("coeff"), iAdditionalPairNo:=1) - ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierLowerLimitFunc, New RParameter("coeff"), iAdditionalPairNo:=2) - ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierUpperLimitFunc, New RParameter("coeff"), iAdditionalPairNo:=3) - ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierUpperLimitFunc, New RParameter("coeff"), iAdditionalPairNo:=3) + ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierLowerLimitFunc, New RParameter("coef"), iAdditionalPairNo:=1) + ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierLowerLimitFunc, New RParameter("coef"), iAdditionalPairNo:=2) + ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierUpperLimitFunc, New RParameter("coef"), iAdditionalPairNo:=3) + ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierUpperLimitFunc, New RParameter("coef"), iAdditionalPairNo:=3) ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsJumpCodeElement1.clsJumpTestFunction, New RParameter("save"), iAdditionalPairNo:=1) ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsJumpCodeElement2.clsJumpTestFunction, New RParameter("save"), iAdditionalPairNo:=2)