From 6f96f12fdc70d4125873fea81813655f6ca433f6 Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Wed, 27 Jun 2018 12:13:19 +0300 Subject: [PATCH 1/5] 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 e245e28d24bc6dd9a1a6167e538120a4425908d2 Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Wed, 27 Jun 2018 15:03:30 +0300 Subject: [PATCH 2/5] 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 3/5] 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 4/5] 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 5/5] 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")