From 477d89f9aca4817c8db172759f0e61d7af90e359 Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Mon, 21 Oct 2024 10:00:03 +0100 Subject: [PATCH 01/11] Change made --- instat/instat.vbproj | 9 ++ instat/sdgAdditionalCondition.Designer.vb | 41 ++++++++ instat/sdgAdditionalCondition.resx | 120 ++++++++++++++++++++++ instat/sdgAdditionalCondition.vb | 3 + 4 files changed, 173 insertions(+) create mode 100644 instat/sdgAdditionalCondition.Designer.vb create mode 100644 instat/sdgAdditionalCondition.resx create mode 100644 instat/sdgAdditionalCondition.vb diff --git a/instat/instat.vbproj b/instat/instat.vbproj index 02ca60eef9b..8f72bfeb211 100644 --- a/instat/instat.vbproj +++ b/instat/instat.vbproj @@ -325,6 +325,12 @@ + + sdgAdditionalCondition.vb + + + Form + sdgClimsoft.vb @@ -3405,6 +3411,9 @@ dlgThreeVariablePivotTable.vb + + sdgAdditionalCondition.vb + sdgClimsoft.vb diff --git a/instat/sdgAdditionalCondition.Designer.vb b/instat/sdgAdditionalCondition.Designer.vb new file mode 100644 index 00000000000..158a324dc4c --- /dev/null +++ b/instat/sdgAdditionalCondition.Designer.vb @@ -0,0 +1,41 @@ + _ +Partial Class sdgAdditionalCondition + Inherits System.Windows.Forms.Form + + 'Form remplace la méthode Dispose pour nettoyer la liste des composants. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Requise par le Concepteur Windows Form + Private components As System.ComponentModel.IContainer + + 'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form + 'Elle peut être modifiée à l'aide du Concepteur Windows Form. + 'Ne la modifiez pas à l'aide de l'éditeur de code. + _ + Private Sub InitializeComponent() + Me.SuspendLayout() + ' + 'sdgAdditionalCondition + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(470, 179) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "sdgAdditionalCondition" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Additional Condition" + Me.ResumeLayout(False) + + End Sub +End Class diff --git a/instat/sdgAdditionalCondition.resx b/instat/sdgAdditionalCondition.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/sdgAdditionalCondition.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/instat/sdgAdditionalCondition.vb b/instat/sdgAdditionalCondition.vb new file mode 100644 index 00000000000..c1ed2cd129d --- /dev/null +++ b/instat/sdgAdditionalCondition.vb @@ -0,0 +1,3 @@ +Public Class sdgAdditionalCondition + +End Class \ No newline at end of file From 350b437293556a8b1b609d37f14b29af6df5fe38 Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Mon, 21 Oct 2024 10:02:06 +0100 Subject: [PATCH 02/11] Change made --- instat/sdgAdditionalCondition.Designer.vb | 245 ++++++++++++++++++++++ instat/sdgAdditionalCondition.vb | 153 +++++++++++++- 2 files changed, 397 insertions(+), 1 deletion(-) diff --git a/instat/sdgAdditionalCondition.Designer.vb b/instat/sdgAdditionalCondition.Designer.vb index 158a324dc4c..65c12bbc860 100644 --- a/instat/sdgAdditionalCondition.Designer.vb +++ b/instat/sdgAdditionalCondition.Designer.vb @@ -22,13 +22,238 @@ Partial Class sdgAdditionalCondition 'Ne la modifiez pas à l'aide de l'éditeur de code. _ Private Sub InitializeComponent() + Me.ucrChkNumberOfRainyDays = New instat.ucrCheck() + Me.ucrSdgButtons = New instat.ucrButtonsSubdialogue() + Me.ucrNudDPOverallInterval = New instat.ucrNud() + Me.ucrNudDSMaximumDays = New instat.ucrNud() + Me.ucrNudDSLengthOfTime = New instat.ucrNud() + Me.lblDPOverallInterval = New System.Windows.Forms.Label() + Me.ucrNudRDMinimumDays = New instat.ucrNud() + Me.ucrNudDPRainPeriod = New instat.ucrNud() + Me.lblDPLength = New System.Windows.Forms.Label() + Me.ucrChkDryPeriod = New instat.ucrCheck() + Me.lblDSLengthofTime = New System.Windows.Forms.Label() + Me.lblDPMaxRain = New System.Windows.Forms.Label() + Me.ucrNudRDOutOfDays = New instat.ucrNud() + Me.ucrNudDPMaxRain = New instat.ucrNud() + Me.ucrChkDrySpell = New instat.ucrCheck() + Me.lblDSMaximumDays = New System.Windows.Forms.Label() + Me.lblRDMinimum = New System.Windows.Forms.Label() + Me.lblRDWidth = New System.Windows.Forms.Label() Me.SuspendLayout() ' + 'ucrChkNumberOfRainyDays + ' + Me.ucrChkNumberOfRainyDays.AutoSize = True + Me.ucrChkNumberOfRainyDays.Checked = False + Me.ucrChkNumberOfRainyDays.Location = New System.Drawing.Point(14, 12) + Me.ucrChkNumberOfRainyDays.Name = "ucrChkNumberOfRainyDays" + Me.ucrChkNumberOfRainyDays.Size = New System.Drawing.Size(161, 23) + Me.ucrChkNumberOfRainyDays.TabIndex = 81 + ' + 'ucrSdgButtons + ' + Me.ucrSdgButtons.AutoSize = True + Me.ucrSdgButtons.Location = New System.Drawing.Point(108, 138) + Me.ucrSdgButtons.Name = "ucrSdgButtons" + Me.ucrSdgButtons.Size = New System.Drawing.Size(259, 29) + Me.ucrSdgButtons.TabIndex = 80 + ' + 'ucrNudDPOverallInterval + ' + Me.ucrNudDPOverallInterval.AutoSize = True + Me.ucrNudDPOverallInterval.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudDPOverallInterval.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudDPOverallInterval.Location = New System.Drawing.Point(249, 104) + Me.ucrNudDPOverallInterval.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudDPOverallInterval.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudDPOverallInterval.Name = "ucrNudDPOverallInterval" + Me.ucrNudDPOverallInterval.Size = New System.Drawing.Size(42, 20) + Me.ucrNudDPOverallInterval.TabIndex = 79 + Me.ucrNudDPOverallInterval.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudDSMaximumDays + ' + Me.ucrNudDSMaximumDays.AutoSize = True + Me.ucrNudDSMaximumDays.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudDSMaximumDays.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudDSMaximumDays.Location = New System.Drawing.Point(249, 44) + Me.ucrNudDSMaximumDays.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudDSMaximumDays.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudDSMaximumDays.Name = "ucrNudDSMaximumDays" + Me.ucrNudDSMaximumDays.Size = New System.Drawing.Size(42, 20) + Me.ucrNudDSMaximumDays.TabIndex = 70 + Me.ucrNudDSMaximumDays.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudDSLengthOfTime + ' + Me.ucrNudDSLengthOfTime.AutoSize = True + Me.ucrNudDSLengthOfTime.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudDSLengthOfTime.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudDSLengthOfTime.Location = New System.Drawing.Point(415, 44) + Me.ucrNudDSLengthOfTime.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudDSLengthOfTime.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudDSLengthOfTime.Name = "ucrNudDSLengthOfTime" + Me.ucrNudDSLengthOfTime.Size = New System.Drawing.Size(42, 20) + Me.ucrNudDSLengthOfTime.TabIndex = 72 + Me.ucrNudDSLengthOfTime.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'lblDPOverallInterval + ' + Me.lblDPOverallInterval.AutoSize = True + Me.lblDPOverallInterval.Location = New System.Drawing.Point(128, 107) + Me.lblDPOverallInterval.Name = "lblDPOverallInterval" + Me.lblDPOverallInterval.Size = New System.Drawing.Size(117, 13) + Me.lblDPOverallInterval.TabIndex = 78 + Me.lblDPOverallInterval.Text = "Overall Interval Length:" + ' + 'ucrNudRDMinimumDays + ' + Me.ucrNudRDMinimumDays.AutoSize = True + Me.ucrNudRDMinimumDays.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudRDMinimumDays.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudRDMinimumDays.Location = New System.Drawing.Point(249, 12) + Me.ucrNudRDMinimumDays.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudRDMinimumDays.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudRDMinimumDays.Name = "ucrNudRDMinimumDays" + Me.ucrNudRDMinimumDays.Size = New System.Drawing.Size(42, 20) + Me.ucrNudRDMinimumDays.TabIndex = 65 + Me.ucrNudRDMinimumDays.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudDPRainPeriod + ' + Me.ucrNudDPRainPeriod.AutoSize = True + Me.ucrNudDPRainPeriod.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudDPRainPeriod.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudDPRainPeriod.Location = New System.Drawing.Point(415, 77) + Me.ucrNudDPRainPeriod.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudDPRainPeriod.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudDPRainPeriod.Name = "ucrNudDPRainPeriod" + Me.ucrNudDPRainPeriod.Size = New System.Drawing.Size(42, 20) + Me.ucrNudDPRainPeriod.TabIndex = 77 + Me.ucrNudDPRainPeriod.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'lblDPLength + ' + Me.lblDPLength.AutoSize = True + Me.lblDPLength.Location = New System.Drawing.Point(313, 77) + Me.lblDPLength.Name = "lblDPLength" + Me.lblDPLength.Size = New System.Drawing.Size(100, 13) + Me.lblDPLength.TabIndex = 76 + Me.lblDPLength.Text = "Maximum Dry Days:" + ' + 'ucrChkDryPeriod + ' + Me.ucrChkDryPeriod.AutoSize = True + Me.ucrChkDryPeriod.Checked = False + Me.ucrChkDryPeriod.Location = New System.Drawing.Point(14, 77) + Me.ucrChkDryPeriod.Name = "ucrChkDryPeriod" + Me.ucrChkDryPeriod.Size = New System.Drawing.Size(138, 55) + Me.ucrChkDryPeriod.TabIndex = 73 + ' + 'lblDSLengthofTime + ' + Me.lblDSLengthofTime.AutoSize = True + Me.lblDSLengthofTime.Location = New System.Drawing.Point(296, 48) + Me.lblDSLengthofTime.Name = "lblDSLengthofTime" + Me.lblDSLengthofTime.Size = New System.Drawing.Size(117, 13) + Me.lblDSLengthofTime.TabIndex = 71 + Me.lblDSLengthofTime.Text = "Overall Interval Length:" + ' + 'lblDPMaxRain + ' + Me.lblDPMaxRain.AutoSize = True + Me.lblDPMaxRain.Location = New System.Drawing.Point(164, 79) + Me.lblDPMaxRain.Name = "lblDPMaxRain" + Me.lblDPMaxRain.Size = New System.Drawing.Size(79, 13) + Me.lblDPMaxRain.TabIndex = 74 + Me.lblDPMaxRain.Text = "Maximum Rain:" + ' + 'ucrNudRDOutOfDays + ' + Me.ucrNudRDOutOfDays.AutoSize = True + Me.ucrNudRDOutOfDays.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudRDOutOfDays.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudRDOutOfDays.Location = New System.Drawing.Point(415, 12) + Me.ucrNudRDOutOfDays.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudRDOutOfDays.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudRDOutOfDays.Name = "ucrNudRDOutOfDays" + Me.ucrNudRDOutOfDays.Size = New System.Drawing.Size(42, 20) + Me.ucrNudRDOutOfDays.TabIndex = 67 + Me.ucrNudRDOutOfDays.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudDPMaxRain + ' + Me.ucrNudDPMaxRain.AutoSize = True + Me.ucrNudDPMaxRain.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudDPMaxRain.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudDPMaxRain.Location = New System.Drawing.Point(249, 76) + Me.ucrNudDPMaxRain.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudDPMaxRain.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudDPMaxRain.Name = "ucrNudDPMaxRain" + Me.ucrNudDPMaxRain.Size = New System.Drawing.Size(42, 20) + Me.ucrNudDPMaxRain.TabIndex = 75 + Me.ucrNudDPMaxRain.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrChkDrySpell + ' + Me.ucrChkDrySpell.AutoSize = True + Me.ucrChkDrySpell.Checked = False + Me.ucrChkDrySpell.Location = New System.Drawing.Point(14, 44) + Me.ucrChkDrySpell.Name = "ucrChkDrySpell" + Me.ucrChkDrySpell.Size = New System.Drawing.Size(126, 23) + Me.ucrChkDrySpell.TabIndex = 68 + ' + 'lblDSMaximumDays + ' + Me.lblDSMaximumDays.AutoSize = True + Me.lblDSMaximumDays.Location = New System.Drawing.Point(143, 48) + Me.lblDSMaximumDays.Name = "lblDSMaximumDays" + Me.lblDSMaximumDays.Size = New System.Drawing.Size(100, 13) + Me.lblDSMaximumDays.TabIndex = 69 + Me.lblDSMaximumDays.Text = "Maximum Dry Days:" + ' + 'lblRDMinimum + ' + Me.lblRDMinimum.AutoSize = True + Me.lblRDMinimum.Location = New System.Drawing.Point(192, 15) + Me.lblRDMinimum.Name = "lblRDMinimum" + Me.lblRDMinimum.Size = New System.Drawing.Size(51, 13) + Me.lblRDMinimum.TabIndex = 64 + Me.lblRDMinimum.Text = "Minimum:" + ' + 'lblRDWidth + ' + Me.lblRDWidth.AutoSize = True + Me.lblRDWidth.Location = New System.Drawing.Point(347, 12) + Me.lblRDWidth.Name = "lblRDWidth" + Me.lblRDWidth.Size = New System.Drawing.Size(66, 13) + Me.lblRDWidth.TabIndex = 66 + Me.lblRDWidth.Text = "Out of Days:" + ' 'sdgAdditionalCondition ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(470, 179) + Me.Controls.Add(Me.ucrChkNumberOfRainyDays) + Me.Controls.Add(Me.ucrSdgButtons) + Me.Controls.Add(Me.ucrNudDPOverallInterval) + Me.Controls.Add(Me.ucrNudDSMaximumDays) + Me.Controls.Add(Me.ucrNudDSLengthOfTime) + Me.Controls.Add(Me.lblDPOverallInterval) + Me.Controls.Add(Me.ucrNudRDMinimumDays) + Me.Controls.Add(Me.ucrNudDPRainPeriod) + Me.Controls.Add(Me.lblDPLength) + Me.Controls.Add(Me.ucrChkDryPeriod) + Me.Controls.Add(Me.lblDSLengthofTime) + Me.Controls.Add(Me.lblDPMaxRain) + Me.Controls.Add(Me.ucrNudRDOutOfDays) + Me.Controls.Add(Me.ucrNudDPMaxRain) + Me.Controls.Add(Me.ucrChkDrySpell) + Me.Controls.Add(Me.lblDSMaximumDays) + Me.Controls.Add(Me.lblRDMinimum) + Me.Controls.Add(Me.lblRDWidth) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -36,6 +261,26 @@ Partial Class sdgAdditionalCondition Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Additional Condition" Me.ResumeLayout(False) + Me.PerformLayout() End Sub + + Friend WithEvents ucrChkNumberOfRainyDays As ucrCheck + Friend WithEvents ucrSdgButtons As ucrButtonsSubdialogue + Friend WithEvents ucrNudDPOverallInterval As ucrNud + Friend WithEvents ucrNudDSMaximumDays As ucrNud + Friend WithEvents ucrNudDSLengthOfTime As ucrNud + Friend WithEvents lblDPOverallInterval As Label + Friend WithEvents ucrNudRDMinimumDays As ucrNud + Friend WithEvents ucrNudDPRainPeriod As ucrNud + Friend WithEvents lblDPLength As Label + Friend WithEvents ucrChkDryPeriod As ucrCheck + Friend WithEvents lblDSLengthofTime As Label + Friend WithEvents lblDPMaxRain As Label + Friend WithEvents ucrNudRDOutOfDays As ucrNud + Friend WithEvents ucrNudDPMaxRain As ucrNud + Friend WithEvents ucrChkDrySpell As ucrCheck + Friend WithEvents lblDSMaximumDays As Label + Friend WithEvents lblRDMinimum As Label + Friend WithEvents lblRDWidth As Label End Class diff --git a/instat/sdgAdditionalCondition.vb b/instat/sdgAdditionalCondition.vb index c1ed2cd129d..69fea212509 100644 --- a/instat/sdgAdditionalCondition.vb +++ b/instat/sdgAdditionalCondition.vb @@ -1,3 +1,154 @@ -Public Class sdgAdditionalCondition +' R- Instat +' Copyright (C) 2015-2017 +' +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License +' along with this program. If not, see . +Imports instat.Translations +Public Class sdgAdditionalCondition + Public bFirstLoad As Boolean = True + Public bControlsInitialised As Boolean = False + Private clsCombinedList, clsCalcDrySpellRollMax, clsIsNaFirstDryPeriod, clsIsNaFirstDrySpell, clsIsNaDryPeriod, clsIsNaDrySpell, clsRainDayRollingSumFunction, clsIsNaRollSumRainDay, clsIsNaFirstRollSumRainDay, clsDrySpellPeriodRollMaxFunction, clsRollingSumRainDryPeriodFunction, clsCalcRainDayRollingSum, clsCalcRollSumNumberDryPeriod As RFunction + Private clsConditionsAndOperator, clsIsNaOperatorStartDOY, clsConditionsOrOverallOperator, clsRollingSumRainDayOperator, clsDSCombineOperator, clsSumRainDryPeriodIntervalMinusOperator, clsSumRainDryPeriodOperator, clsDPCombineOperator, clsSumRainDryPeriodIntervalPlusOperator As ROperator + + Private Sub sdgAdditionalCondition_Load(sender As Object, e As EventArgs) Handles MyBase.Load + autoTranslate(Me) + InitialiseControls() + End Sub + + Public Sub InitialiseControls() + ucrChkNumberOfRainyDays.SetText("Number of Rainy Days") + ucrChkNumberOfRainyDays.SetParameter(New RParameter("rd_sub", clsCalcRainDayRollingSum, 2, False), False) + ucrChkNumberOfRainyDays.AddAdditionalCodeParameterPair(clsConditionsAndOperator, New RParameter("rain_days", clsRollingSumRainDayOperator, 2, False), iAdditionalPairNo:=1) + + ucrNudRDMinimumDays.SetParameter(New RParameter("1", 1)) + ucrNudRDMinimumDays.SetLinkedDisplayControl(lblRDMinimum) + ucrNudRDMinimumDays.SetMinMax(1, 366) + + ucrNudRDOutOfDays.SetParameter(New RParameter("n", 1)) + ucrNudRDOutOfDays.SetLinkedDisplayControl(lblRDWidth) + ucrNudRDOutOfDays.SetMinMax(1, 366) + + ucrChkNumberOfRainyDays.AddToLinkedControls(ucrNudRDMinimumDays, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=1) + ucrChkNumberOfRainyDays.AddToLinkedControls(ucrNudRDOutOfDays, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=2) + + 'Dry Spell + ucrChkDrySpell.SetText("Dry Spell") + ucrChkDrySpell.SetParameter(New RParameter("ds_sub", clsCalcDrySpellRollMax, 3, False), False) + ucrChkDrySpell.AddAdditionalCodeParameterPair(clsConditionsAndOperator, New RParameter("dry_spell", clsDSCombineOperator, 3, False), iAdditionalPairNo:=1) + ucrChkDrySpell.AddToLinkedControls(ucrNudDSLengthOfTime, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=21) + ucrChkDrySpell.AddToLinkedControls(ucrNudDSMaximumDays, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=9) + ucrNudDSLengthOfTime.SetLinkedDisplayControl(lblDSLengthofTime) + ucrNudDSMaximumDays.SetLinkedDisplayControl(lblDSMaximumDays) + + ucrNudDSLengthOfTime.SetParameter(New RParameter("n", 1)) + ucrNudDSLengthOfTime.SetMinMax(1, 366) + + ucrNudDSMaximumDays.SetParameter(New RParameter("right", 1)) + ucrNudDSMaximumDays.SetMinMax(1, 366) + ucrNudDSMaximumDays.Increment = 1 + 'ucrNudDSMaximumDays.SetRDefault(9) + + ' Dry Period + ucrChkDryPeriod.SetText("Dry Period") + ucrChkDryPeriod.SetParameter(New RParameter("dp_sub", clsCalcRollSumNumberDryPeriod, 3, False), False) + ucrChkDryPeriod.AddAdditionalCodeParameterPair(clsConditionsAndOperator, New RParameter("dry_period", clsDPCombineOperator, 4, False), iAdditionalPairNo:=1) + + ucrNudDPRainPeriod.SetParameter(New RParameter("n", 0)) + ucrNudDPRainPeriod.SetLinkedDisplayControl(lblDPLength) + ucrNudDPRainPeriod.SetMinMax(1, 366) + + ucrNudDPMaxRain.SetParameter(New RParameter("right", 1)) + ucrNudDPMaxRain.SetLinkedDisplayControl(lblDPMaxRain) + ucrNudDPMaxRain.SetMinMax(1, Integer.MaxValue) + + ucrNudDPOverallInterval.SetParameter(New RParameter("0", 0)) + ucrNudDPOverallInterval.SetLinkedDisplayControl(lblDPOverallInterval) + ucrNudDPOverallInterval.SetMinMax(1, 366) + + ucrChkDryPeriod.AddToLinkedControls(ucrNudDPMaxRain, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=40) + ucrChkDryPeriod.AddToLinkedControls(ucrNudDPOverallInterval, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=45) + ucrChkDryPeriod.AddToLinkedControls(ucrNudDPRainPeriod, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=30) + End Sub + + Public Sub SetRCode(clsNewCombinedList As RFunction, clsNewCalcDrySpellRollMax As RFunction, clsNewIsNaFirstDryPeriod As RFunction, clsNewIsNaFirstDrySpell As RFunction, clsNewIsNaDryPeriod As RFunction, clsNewIsNaDrySpell As RFunction, clsNewRainDayRollingSumFunction As RFunction, clsNewIsNaRollSumRainDay As RFunction, clsNewIsNaFirstRollSumRainDay As RFunction, clsNewDrySpellPeriodRollMaxFunction As RFunction, clsNewRollingSumRainDryPeriodFunction As RFunction, clsNewCalcRainDayRollingSum As RFunction, clsNewCalcRollSumNumberDryPeriod As RFunction, clsNewConditionsAndOperator As ROperator, clsNewIsNaOperatorStartDOY As ROperator, clsNewConditionsOrOverallOperator As ROperator, clsNewRollingSumRainDayOperator As ROperator, clsNewDSCombineOperator As ROperator, clsNewSumRainDryPeriodIntervalMinusOperator As ROperator, clsNewSumRainDryPeriodOperator As ROperator, clsNewDPCombineOperator As ROperator, clsNewSumRainDryPeriodIntervalPlusOperator As ROperator, Optional bReset As Boolean = False) + If Not bControlsInitialised Then + InitialiseControls() + End If + clsCombinedList = clsNewCombinedList + clsCalcDrySpellRollMax = clsNewCalcDrySpellRollMax + clsIsNaFirstDryPeriod = clsNewIsNaFirstDryPeriod + clsIsNaFirstDrySpell = clsNewIsNaFirstDrySpell + clsIsNaDryPeriod = clsNewIsNaDryPeriod + clsIsNaDrySpell = clsNewIsNaDrySpell + clsRainDayRollingSumFunction = clsNewRainDayRollingSumFunction + clsIsNaRollSumRainDay = clsNewIsNaRollSumRainDay + clsIsNaFirstRollSumRainDay = clsNewIsNaFirstRollSumRainDay + clsDrySpellPeriodRollMaxFunction = clsNewDrySpellPeriodRollMaxFunction + clsRollingSumRainDryPeriodFunction = clsNewRollingSumRainDryPeriodFunction + clsCalcRainDayRollingSum = clsNewCalcRainDayRollingSum + clsCalcRollSumNumberDryPeriod = clsNewCalcRollSumNumberDryPeriod + clsConditionsAndOperator = clsNewConditionsAndOperator + clsIsNaOperatorStartDOY = clsNewIsNaOperatorStartDOY + clsConditionsOrOverallOperator = clsNewConditionsOrOverallOperator + clsRollingSumRainDayOperator = clsNewRollingSumRainDayOperator + clsDSCombineOperator = clsNewDSCombineOperator + clsSumRainDryPeriodIntervalMinusOperator = clsNewSumRainDryPeriodIntervalMinusOperator + clsSumRainDryPeriodOperator = clsNewSumRainDryPeriodOperator + clsDPCombineOperator = clsNewDPCombineOperator + clsSumRainDryPeriodIntervalPlusOperator = clsNewSumRainDryPeriodIntervalPlusOperator + + ucrNudDPRainPeriod.AddAdditionalCodeParameterPair(clsSumRainDryPeriodIntervalPlusOperator, ucrNudDPRainPeriod.GetParameter(), iAdditionalPairNo:=1) + + ucrChkNumberOfRainyDays.SetRCode(clsCombinedList, bReset, bCloneIfNeeded:=True) + ucrChkDryPeriod.SetRCode(clsCombinedList, bReset, bCloneIfNeeded:=True) + ucrChkDrySpell.SetRCode(clsCombinedList, bReset, bCloneIfNeeded:=True) + End Sub + + Private Sub ucrChkNumberOfRainyDays_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkNumberOfRainyDays.ControlValueChanged + If ucrChkNumberOfRainyDays.Checked Then + clsIsNaOperatorStartDOY.AddParameter("2", clsRFunctionParameter:=clsIsNaFirstRollSumRainDay, iPosition:=2) + clsConditionsOrOverallOperator.AddParameter("is.na_roll_sum_rain_day", clsRFunctionParameter:=clsIsNaRollSumRainDay, iPosition:=3) + Else + clsIsNaOperatorStartDOY.RemoveParameterByName("2") + clsConditionsOrOverallOperator.RemoveParameterByName("is.na_roll_sum_rain_day") + End If + End Sub + + Private Sub ucrChkDrySpell_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDrySpell.ControlValueChanged + If ucrChkDrySpell.Checked Then + clsIsNaOperatorStartDOY.AddParameter("3", clsRFunctionParameter:=clsIsNaFirstDrySpell, iPosition:=3) + clsConditionsOrOverallOperator.AddParameter("is.na_dry_spell", clsRFunctionParameter:=clsIsNaDrySpell, iPosition:=4) + Else + clsIsNaOperatorStartDOY.RemoveParameterByName("3") + clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_spell") + End If + End Sub + + Private Sub ucrChkDryPeriod_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDryPeriod.ControlValueChanged + If ucrChkDryPeriod.Checked Then + clsIsNaOperatorStartDOY.AddParameter("4", clsRFunctionParameter:=clsIsNaFirstDryPeriod, iPosition:=4) + clsConditionsOrOverallOperator.AddParameter("is.na_dry_period", clsRFunctionParameter:=clsIsNaDryPeriod, iPosition:=5) + Else + clsIsNaOperatorStartDOY.RemoveParameterByName("4") + clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_period") + End If + End Sub + + Private Sub MaximumValuesControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrChkDryPeriod.ControlContentsChanged, ucrNudDPRainPeriod.ControlContentsChanged, ucrNudDPOverallInterval.ControlContentsChanged + If ucrChkDryPeriod.Checked Then + ucrNudDPRainPeriod.Maximum = ucrNudDPOverallInterval.Value + ucrNudDPOverallInterval.Minimum = ucrNudDPRainPeriod.Value + End If + End Sub End Class \ No newline at end of file From 8eb463fbbc9fd8d6a138db03aa5570bcc94b3448 Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Mon, 21 Oct 2024 10:27:25 +0100 Subject: [PATCH 03/11] Added Additional Condition Sub Dialog --- instat/dlgStartofRains.Designer.vb | 928 ++++++++++++----------------- instat/dlgStartofRains.vb | 315 +++++----- 2 files changed, 567 insertions(+), 676 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index e5f35fb174b..77dab3d9fdf 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -38,474 +38,106 @@ Partial Class dlgStartofRains 'Do not modify it using the code editor. Private Sub InitializeComponent() - Me.grpConditionsForSatrtofRains = New System.Windows.Forms.GroupBox() - Me.ucrNudDPOverallInterval = New instat.ucrNud() - Me.ucrNudDSMaximumDays = New instat.ucrNud() - Me.ucrNudDSLengthOfTime = New instat.ucrNud() - Me.lblDPOverallInterval = New System.Windows.Forms.Label() - Me.ucrNudRDMinimumDays = New instat.ucrNud() - Me.ucrNudDPRainPeriod = New instat.ucrNud() - Me.lblDPLength = New System.Windows.Forms.Label() - Me.ucrChkDryPeriod = New instat.ucrCheck() - Me.lblDSLengthofTime = New System.Windows.Forms.Label() - Me.lblDPMaxRain = New System.Windows.Forms.Label() - Me.ucrNudRDOutOfDays = New instat.ucrNud() - Me.ucrNudDPMaxRain = New instat.ucrNud() - Me.ucrChkDrySpell = New instat.ucrCheck() - Me.lblDSMaximumDays = New System.Windows.Forms.Label() - Me.lblRDMinimum = New System.Windows.Forms.Label() - Me.lblTROverDays = New System.Windows.Forms.Label() - Me.lblRDWidth = New System.Windows.Forms.Label() - Me.ucrChkNumberOfRainyDays = New instat.ucrCheck() - Me.ucrNudTROverDays = New instat.ucrNud() - Me.ucrNudTRAmount = New instat.ucrNud() - Me.lblTRVal = New System.Windows.Forms.Label() - Me.ucrChkTotalRainfall = New instat.ucrCheck() - Me.ucrNudTRPercentile = New instat.ucrNud() - Me.rdoTRAmount = New System.Windows.Forms.RadioButton() - Me.rdoTRPercentile = New System.Windows.Forms.RadioButton() - Me.ucrPnlTRCalculateBy = New instat.UcrPanel() - Me.grpRainParameters = New System.Windows.Forms.GroupBox() Me.ucrInputThreshold = New instat.ucrInputComboBox() - Me.ucrInputFilterPreview = New instat.ucrInputTextBox() - Me.cmdDoyRange = New System.Windows.Forms.Button() - Me.lblThreshold = New System.Windows.Forms.Label() - Me.lblDOY = New System.Windows.Forms.Label() - Me.lblDate = New System.Windows.Forms.Label() - Me.lblYear = New System.Windows.Forms.Label() - Me.lblStation = New System.Windows.Forms.Label() Me.lblRainfall = New System.Windows.Forms.Label() + Me.lblStation = New System.Windows.Forms.Label() + Me.lblYear = New System.Windows.Forms.Label() + Me.lblDate = New System.Windows.Forms.Label() + Me.lblDOY = New System.Windows.Forms.Label() Me.grpDisplay = New System.Windows.Forms.GroupBox() Me.ucrInputNewStatusColumnName = New instat.ucrInputTextBox() Me.ucrChkAsDate = New instat.ucrCheck() Me.ucrChkStatus = New instat.ucrCheck() Me.ucrInputNewDateColumnName = New instat.ucrInputTextBox() - Me.ucrChkAsDoy = New instat.ucrCheck() + Me.ucrSelectorForStartofRains = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrInputNewDoyColumnName = New instat.ucrInputTextBox() + Me.ucrChkAsDoy = New instat.ucrCheck() Me.ucrReceiverStation = New instat.ucrReceiverSingle() Me.ucrReceiverDate = New instat.ucrReceiverSingle() Me.ucrReceiverYear = New instat.ucrReceiverSingle() - Me.ucrReceiverDOY = New instat.ucrReceiverSingle() Me.ucrReceiverRainfall = New instat.ucrReceiverSingle() - Me.ucrSelectorForStartofRains = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() + Me.ucrInputFilterPreview = New instat.ucrInputTextBox() + Me.ucrReceiverDOY = New instat.ucrReceiverSingle() + Me.grpConditionsForSatrtofRains = New System.Windows.Forms.GroupBox() + Me.cmdAdditionnal = New System.Windows.Forms.Button() + Me.ucrChkAdditional = New instat.ucrCheck() + Me.ucrReceiverEvap = New instat.ucrReceiverSingle() + Me.lblFraction = New System.Windows.Forms.Label() + Me.ucrNudEvapo = New instat.ucrNud() + Me.rdoEvapo = New System.Windows.Forms.RadioButton() + Me.lblTROverDays = New System.Windows.Forms.Label() + Me.ucrNudTROverDays = New instat.ucrNud() + Me.ucrNudTRAmount = New instat.ucrNud() + Me.lblTRVal = New System.Windows.Forms.Label() + Me.ucrChkTotalRainfall = New instat.ucrCheck() + Me.ucrNudTRPercentile = New instat.ucrNud() + Me.rdoTRAmount = New System.Windows.Forms.RadioButton() + Me.rdoTRPercentile = New System.Windows.Forms.RadioButton() + Me.ucrPnlTRCalculateBy = New instat.UcrPanel() + Me.lblThreshold = New System.Windows.Forms.Label() + Me.grpRainParameters = New System.Windows.Forms.GroupBox() + Me.cmdDoyRange = New System.Windows.Forms.Button() + Me.grpDisplay.SuspendLayout() Me.grpConditionsForSatrtofRains.SuspendLayout() Me.grpRainParameters.SuspendLayout() - Me.grpDisplay.SuspendLayout() Me.SuspendLayout() ' - 'grpConditionsForSatrtofRains - ' - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrNudDPOverallInterval) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrNudDSMaximumDays) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrNudDSLengthOfTime) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblDPOverallInterval) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrNudRDMinimumDays) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrNudDPRainPeriod) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblDPLength) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrChkDryPeriod) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblDSLengthofTime) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblDPMaxRain) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrNudRDOutOfDays) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrNudDPMaxRain) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrChkDrySpell) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblDSMaximumDays) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblRDMinimum) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblTROverDays) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblRDWidth) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrChkNumberOfRainyDays) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrNudTROverDays) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrNudTRAmount) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblTRVal) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrChkTotalRainfall) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrNudTRPercentile) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.rdoTRAmount) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.rdoTRPercentile) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrPnlTRCalculateBy) - Me.grpConditionsForSatrtofRains.Location = New System.Drawing.Point(4, 284) - Me.grpConditionsForSatrtofRains.Name = "grpConditionsForSatrtofRains" - Me.grpConditionsForSatrtofRains.Size = New System.Drawing.Size(686, 174) - Me.grpConditionsForSatrtofRains.TabIndex = 12 - Me.grpConditionsForSatrtofRains.TabStop = False - Me.grpConditionsForSatrtofRains.Text = "Conditions for Start of Rains" - ' - 'ucrNudDPOverallInterval - ' - Me.ucrNudDPOverallInterval.AutoSize = True - Me.ucrNudDPOverallInterval.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudDPOverallInterval.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudDPOverallInterval.Location = New System.Drawing.Point(641, 145) - Me.ucrNudDPOverallInterval.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudDPOverallInterval.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudDPOverallInterval.Name = "ucrNudDPOverallInterval" - Me.ucrNudDPOverallInterval.Size = New System.Drawing.Size(42, 20) - Me.ucrNudDPOverallInterval.TabIndex = 25 - Me.ucrNudDPOverallInterval.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'ucrNudDSMaximumDays - ' - Me.ucrNudDSMaximumDays.AutoSize = True - Me.ucrNudDSMaximumDays.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudDSMaximumDays.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudDSMaximumDays.Location = New System.Drawing.Point(255, 112) - Me.ucrNudDSMaximumDays.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudDSMaximumDays.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudDSMaximumDays.Name = "ucrNudDSMaximumDays" - Me.ucrNudDSMaximumDays.Size = New System.Drawing.Size(42, 20) - Me.ucrNudDSMaximumDays.TabIndex = 16 - Me.ucrNudDSMaximumDays.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'ucrNudDSLengthOfTime - ' - Me.ucrNudDSLengthOfTime.AutoSize = True - Me.ucrNudDSLengthOfTime.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudDSLengthOfTime.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudDSLengthOfTime.Location = New System.Drawing.Point(459, 112) - Me.ucrNudDSLengthOfTime.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudDSLengthOfTime.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudDSLengthOfTime.Name = "ucrNudDSLengthOfTime" - Me.ucrNudDSLengthOfTime.Size = New System.Drawing.Size(42, 20) - Me.ucrNudDSLengthOfTime.TabIndex = 18 - Me.ucrNudDSLengthOfTime.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'lblDPOverallInterval - ' - Me.lblDPOverallInterval.AutoSize = True - Me.lblDPOverallInterval.Location = New System.Drawing.Point(505, 147) - Me.lblDPOverallInterval.Name = "lblDPOverallInterval" - Me.lblDPOverallInterval.Size = New System.Drawing.Size(117, 13) - Me.lblDPOverallInterval.TabIndex = 24 - Me.lblDPOverallInterval.Text = "Overall Interval Length:" - ' - 'ucrNudRDMinimumDays - ' - Me.ucrNudRDMinimumDays.AutoSize = True - Me.ucrNudRDMinimumDays.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudRDMinimumDays.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudRDMinimumDays.Location = New System.Drawing.Point(255, 79) - Me.ucrNudRDMinimumDays.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudRDMinimumDays.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudRDMinimumDays.Name = "ucrNudRDMinimumDays" - Me.ucrNudRDMinimumDays.Size = New System.Drawing.Size(42, 20) - Me.ucrNudRDMinimumDays.TabIndex = 11 - Me.ucrNudRDMinimumDays.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'ucrNudDPRainPeriod - ' - Me.ucrNudDPRainPeriod.AutoSize = True - Me.ucrNudDPRainPeriod.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudDPRainPeriod.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudDPRainPeriod.Location = New System.Drawing.Point(459, 145) - Me.ucrNudDPRainPeriod.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudDPRainPeriod.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudDPRainPeriod.Name = "ucrNudDPRainPeriod" - Me.ucrNudDPRainPeriod.Size = New System.Drawing.Size(42, 20) - Me.ucrNudDPRainPeriod.TabIndex = 23 - Me.ucrNudDPRainPeriod.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'lblDPLength - ' - Me.lblDPLength.AutoSize = True - Me.lblDPLength.Location = New System.Drawing.Point(301, 147) - Me.lblDPLength.Name = "lblDPLength" - Me.lblDPLength.Size = New System.Drawing.Size(100, 13) - Me.lblDPLength.TabIndex = 22 - Me.lblDPLength.Text = "Maximum Dry Days:" - ' - 'ucrChkDryPeriod - ' - Me.ucrChkDryPeriod.AutoSize = True - Me.ucrChkDryPeriod.Checked = False - Me.ucrChkDryPeriod.Location = New System.Drawing.Point(4, 145) - Me.ucrChkDryPeriod.Name = "ucrChkDryPeriod" - Me.ucrChkDryPeriod.Size = New System.Drawing.Size(94, 23) - Me.ucrChkDryPeriod.TabIndex = 19 - ' - 'lblDSLengthofTime - ' - Me.lblDSLengthofTime.AutoSize = True - Me.lblDSLengthofTime.Location = New System.Drawing.Point(301, 116) - Me.lblDSLengthofTime.Name = "lblDSLengthofTime" - Me.lblDSLengthofTime.Size = New System.Drawing.Size(117, 13) - Me.lblDSLengthofTime.TabIndex = 17 - Me.lblDSLengthofTime.Text = "Overall Interval Length:" - ' - 'lblDPMaxRain - ' - Me.lblDPMaxRain.AutoSize = True - Me.lblDPMaxRain.Location = New System.Drawing.Point(118, 147) - Me.lblDPMaxRain.Name = "lblDPMaxRain" - Me.lblDPMaxRain.Size = New System.Drawing.Size(79, 13) - Me.lblDPMaxRain.TabIndex = 20 - Me.lblDPMaxRain.Text = "Maximum Rain:" - ' - 'ucrNudRDOutOfDays - ' - Me.ucrNudRDOutOfDays.AutoSize = True - Me.ucrNudRDOutOfDays.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudRDOutOfDays.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudRDOutOfDays.Location = New System.Drawing.Point(459, 79) - Me.ucrNudRDOutOfDays.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudRDOutOfDays.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudRDOutOfDays.Name = "ucrNudRDOutOfDays" - Me.ucrNudRDOutOfDays.Size = New System.Drawing.Size(42, 20) - Me.ucrNudRDOutOfDays.TabIndex = 13 - Me.ucrNudRDOutOfDays.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'ucrNudDPMaxRain - ' - Me.ucrNudDPMaxRain.AutoSize = True - Me.ucrNudDPMaxRain.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudDPMaxRain.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudDPMaxRain.Location = New System.Drawing.Point(255, 145) - Me.ucrNudDPMaxRain.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudDPMaxRain.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudDPMaxRain.Name = "ucrNudDPMaxRain" - Me.ucrNudDPMaxRain.Size = New System.Drawing.Size(42, 20) - Me.ucrNudDPMaxRain.TabIndex = 21 - Me.ucrNudDPMaxRain.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'ucrChkDrySpell - ' - Me.ucrChkDrySpell.AutoSize = True - Me.ucrChkDrySpell.Checked = False - Me.ucrChkDrySpell.Location = New System.Drawing.Point(4, 112) - Me.ucrChkDrySpell.Name = "ucrChkDrySpell" - Me.ucrChkDrySpell.Size = New System.Drawing.Size(94, 23) - Me.ucrChkDrySpell.TabIndex = 14 - ' - 'lblDSMaximumDays - ' - Me.lblDSMaximumDays.AutoSize = True - Me.lblDSMaximumDays.Location = New System.Drawing.Point(97, 116) - Me.lblDSMaximumDays.Name = "lblDSMaximumDays" - Me.lblDSMaximumDays.Size = New System.Drawing.Size(100, 13) - Me.lblDSMaximumDays.TabIndex = 15 - Me.lblDSMaximumDays.Text = "Maximum Dry Days:" - ' - 'lblRDMinimum - ' - Me.lblRDMinimum.AutoSize = True - Me.lblRDMinimum.Location = New System.Drawing.Point(146, 82) - Me.lblRDMinimum.Name = "lblRDMinimum" - Me.lblRDMinimum.Size = New System.Drawing.Size(51, 13) - Me.lblRDMinimum.TabIndex = 10 - Me.lblRDMinimum.Text = "Minimum:" - ' - 'lblTROverDays - ' - Me.lblTROverDays.AutoSize = True - Me.lblTROverDays.Location = New System.Drawing.Point(144, 26) - Me.lblTROverDays.Name = "lblTROverDays" - Me.lblTROverDays.Size = New System.Drawing.Size(60, 13) - Me.lblTROverDays.TabIndex = 1 - Me.lblTROverDays.Tag = "" - Me.lblTROverDays.Text = "Over Days:" - ' - 'lblRDWidth - ' - Me.lblRDWidth.AutoSize = True - Me.lblRDWidth.Location = New System.Drawing.Point(353, 82) - Me.lblRDWidth.Name = "lblRDWidth" - Me.lblRDWidth.Size = New System.Drawing.Size(66, 13) - Me.lblRDWidth.TabIndex = 12 - Me.lblRDWidth.Text = "Out of Days:" - ' - 'ucrChkNumberOfRainyDays - ' - Me.ucrChkNumberOfRainyDays.AutoSize = True - Me.ucrChkNumberOfRainyDays.Checked = False - Me.ucrChkNumberOfRainyDays.Location = New System.Drawing.Point(4, 79) - Me.ucrChkNumberOfRainyDays.Name = "ucrChkNumberOfRainyDays" - Me.ucrChkNumberOfRainyDays.Size = New System.Drawing.Size(143, 23) - Me.ucrChkNumberOfRainyDays.TabIndex = 9 - ' - 'ucrNudTROverDays - ' - Me.ucrNudTROverDays.AutoSize = True - Me.ucrNudTROverDays.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudTROverDays.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudTROverDays.Location = New System.Drawing.Point(235, 22) - Me.ucrNudTROverDays.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudTROverDays.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudTROverDays.Name = "ucrNudTROverDays" - Me.ucrNudTROverDays.Size = New System.Drawing.Size(42, 20) - Me.ucrNudTROverDays.TabIndex = 2 - Me.ucrNudTROverDays.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'ucrNudTRAmount - ' - Me.ucrNudTRAmount.AutoSize = True - Me.ucrNudTRAmount.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudTRAmount.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudTRAmount.Location = New System.Drawing.Point(569, 22) - Me.ucrNudTRAmount.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudTRAmount.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudTRAmount.Name = "ucrNudTRAmount" - Me.ucrNudTRAmount.Size = New System.Drawing.Size(42, 20) - Me.ucrNudTRAmount.TabIndex = 6 - Me.ucrNudTRAmount.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'lblTRVal - ' - Me.lblTRVal.AutoSize = True - Me.lblTRVal.Location = New System.Drawing.Point(276, 26) - Me.lblTRVal.Name = "lblTRVal" - Me.lblTRVal.Size = New System.Drawing.Size(136, 13) - Me.lblTRVal.TabIndex = 3 - Me.lblTRVal.Text = "Calculate Rainfall Value by:" - ' - 'ucrChkTotalRainfall - ' - Me.ucrChkTotalRainfall.AutoSize = True - Me.ucrChkTotalRainfall.Checked = False - Me.ucrChkTotalRainfall.Location = New System.Drawing.Point(4, 22) - Me.ucrChkTotalRainfall.Name = "ucrChkTotalRainfall" - Me.ucrChkTotalRainfall.Size = New System.Drawing.Size(131, 23) - Me.ucrChkTotalRainfall.TabIndex = 0 - ' - 'ucrNudTRPercentile - ' - Me.ucrNudTRPercentile.AutoSize = True - Me.ucrNudTRPercentile.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudTRPercentile.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudTRPercentile.Location = New System.Drawing.Point(569, 48) - Me.ucrNudTRPercentile.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudTRPercentile.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudTRPercentile.Name = "ucrNudTRPercentile" - Me.ucrNudTRPercentile.Size = New System.Drawing.Size(42, 20) - Me.ucrNudTRPercentile.TabIndex = 8 - Me.ucrNudTRPercentile.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'rdoTRAmount - ' - Me.rdoTRAmount.AutoSize = True - Me.rdoTRAmount.Location = New System.Drawing.Point(479, 24) - Me.rdoTRAmount.Name = "rdoTRAmount" - Me.rdoTRAmount.Size = New System.Drawing.Size(61, 17) - Me.rdoTRAmount.TabIndex = 5 - Me.rdoTRAmount.TabStop = True - Me.rdoTRAmount.Text = "Amount" - Me.rdoTRAmount.UseVisualStyleBackColor = True - ' - 'rdoTRPercentile - ' - Me.rdoTRPercentile.AutoSize = True - Me.rdoTRPercentile.Location = New System.Drawing.Point(479, 48) - Me.rdoTRPercentile.Name = "rdoTRPercentile" - Me.rdoTRPercentile.Size = New System.Drawing.Size(72, 17) - Me.rdoTRPercentile.TabIndex = 7 - Me.rdoTRPercentile.TabStop = True - Me.rdoTRPercentile.Text = "Percentile" - Me.rdoTRPercentile.UseVisualStyleBackColor = True - ' - 'ucrPnlTRCalculateBy - ' - Me.ucrPnlTRCalculateBy.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlTRCalculateBy.Location = New System.Drawing.Point(476, 17) - Me.ucrPnlTRCalculateBy.Name = "ucrPnlTRCalculateBy" - Me.ucrPnlTRCalculateBy.Size = New System.Drawing.Size(146, 62) - Me.ucrPnlTRCalculateBy.TabIndex = 4 - ' - 'grpRainParameters - ' - Me.grpRainParameters.Controls.Add(Me.ucrInputThreshold) - Me.grpRainParameters.Controls.Add(Me.ucrInputFilterPreview) - Me.grpRainParameters.Controls.Add(Me.cmdDoyRange) - Me.grpRainParameters.Controls.Add(Me.lblThreshold) - Me.grpRainParameters.Location = New System.Drawing.Point(4, 238) - Me.grpRainParameters.Name = "grpRainParameters" - Me.grpRainParameters.Size = New System.Drawing.Size(686, 40) - Me.grpRainParameters.TabIndex = 11 - Me.grpRainParameters.TabStop = False - ' 'ucrInputThreshold ' Me.ucrInputThreshold.AddQuotesIfUnrecognised = True Me.ucrInputThreshold.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputThreshold.GetSetSelectedIndex = -1 Me.ucrInputThreshold.IsReadOnly = False - Me.ucrInputThreshold.Location = New System.Drawing.Point(70, 11) + Me.ucrInputThreshold.Location = New System.Drawing.Point(70, 9) Me.ucrInputThreshold.Name = "ucrInputThreshold" Me.ucrInputThreshold.Size = New System.Drawing.Size(62, 21) - Me.ucrInputThreshold.TabIndex = 21 - ' - 'ucrInputFilterPreview - ' - Me.ucrInputFilterPreview.AddQuotesIfUnrecognised = True - Me.ucrInputFilterPreview.AutoSize = True - Me.ucrInputFilterPreview.IsMultiline = False - Me.ucrInputFilterPreview.IsReadOnly = True - Me.ucrInputFilterPreview.Location = New System.Drawing.Point(277, 13) - Me.ucrInputFilterPreview.Name = "ucrInputFilterPreview" - Me.ucrInputFilterPreview.Size = New System.Drawing.Size(242, 22) - Me.ucrInputFilterPreview.TabIndex = 3 - ' - 'cmdDoyRange - ' - Me.cmdDoyRange.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdDoyRange.Location = New System.Drawing.Point(159, 10) - Me.cmdDoyRange.Name = "cmdDoyRange" - Me.cmdDoyRange.Size = New System.Drawing.Size(105, 26) - Me.cmdDoyRange.TabIndex = 2 - Me.cmdDoyRange.Tag = "" - Me.cmdDoyRange.Text = "Day Range" - Me.cmdDoyRange.UseVisualStyleBackColor = True - ' - 'lblThreshold - ' - Me.lblThreshold.AutoSize = True - Me.lblThreshold.Location = New System.Drawing.Point(10, 14) - Me.lblThreshold.Name = "lblThreshold" - Me.lblThreshold.Size = New System.Drawing.Size(57, 13) - Me.lblThreshold.TabIndex = 0 - Me.lblThreshold.Tag = "Threshold" - Me.lblThreshold.Text = "Threshold:" + Me.ucrInputThreshold.TabIndex = 13 ' - 'lblDOY + 'lblRainfall ' - Me.lblDOY.AutoSize = True - Me.lblDOY.Location = New System.Drawing.Point(263, 158) - Me.lblDOY.Name = "lblDOY" - Me.lblDOY.Size = New System.Drawing.Size(66, 13) - Me.lblDOY.TabIndex = 7 - Me.lblDOY.Text = "Day of Year:" + Me.lblRainfall.AutoSize = True + Me.lblRainfall.Location = New System.Drawing.Point(293, 187) + Me.lblRainfall.Name = "lblRainfall" + Me.lblRainfall.Size = New System.Drawing.Size(70, 13) + Me.lblRainfall.TabIndex = 62 + Me.lblRainfall.Text = "Rain Column:" ' - 'lblDate + 'lblStation ' - Me.lblDate.AutoSize = True - Me.lblDate.Location = New System.Drawing.Point(263, 72) - Me.lblDate.Name = "lblDate" - Me.lblDate.Size = New System.Drawing.Size(33, 13) - Me.lblDate.TabIndex = 3 - Me.lblDate.Text = "Date:" + Me.lblStation.AutoSize = True + Me.lblStation.Location = New System.Drawing.Point(293, 15) + Me.lblStation.Name = "lblStation" + Me.lblStation.Size = New System.Drawing.Size(43, 13) + Me.lblStation.TabIndex = 54 + Me.lblStation.Text = "Station:" ' 'lblYear ' Me.lblYear.AutoSize = True - Me.lblYear.Location = New System.Drawing.Point(263, 115) + Me.lblYear.Location = New System.Drawing.Point(293, 101) Me.lblYear.Name = "lblYear" Me.lblYear.Size = New System.Drawing.Size(32, 13) - Me.lblYear.TabIndex = 5 + Me.lblYear.TabIndex = 58 Me.lblYear.Text = "Year:" ' - 'lblStation + 'lblDate ' - Me.lblStation.AutoSize = True - Me.lblStation.Location = New System.Drawing.Point(263, 29) - Me.lblStation.Name = "lblStation" - Me.lblStation.Size = New System.Drawing.Size(43, 13) - Me.lblStation.TabIndex = 1 - Me.lblStation.Text = "Station:" + Me.lblDate.AutoSize = True + Me.lblDate.Location = New System.Drawing.Point(293, 58) + Me.lblDate.Name = "lblDate" + Me.lblDate.Size = New System.Drawing.Size(33, 13) + Me.lblDate.TabIndex = 56 + Me.lblDate.Text = "Date:" ' - 'lblRainfall + 'lblDOY ' - Me.lblRainfall.AutoSize = True - Me.lblRainfall.Location = New System.Drawing.Point(263, 201) - Me.lblRainfall.Name = "lblRainfall" - Me.lblRainfall.Size = New System.Drawing.Size(70, 13) - Me.lblRainfall.TabIndex = 9 - Me.lblRainfall.Text = "Rain Column:" + Me.lblDOY.AutoSize = True + Me.lblDOY.Location = New System.Drawing.Point(293, 144) + Me.lblDOY.Name = "lblDOY" + Me.lblDOY.Size = New System.Drawing.Size(66, 13) + Me.lblDOY.TabIndex = 60 + Me.lblDOY.Text = "Day of Year:" ' 'grpDisplay ' @@ -513,10 +145,10 @@ Partial Class dlgStartofRains Me.grpDisplay.Controls.Add(Me.ucrChkAsDate) Me.grpDisplay.Controls.Add(Me.ucrChkStatus) Me.grpDisplay.Controls.Add(Me.ucrInputNewDateColumnName) - Me.grpDisplay.Location = New System.Drawing.Point(4, 459) + Me.grpDisplay.Location = New System.Drawing.Point(13, 465) Me.grpDisplay.Name = "grpDisplay" - Me.grpDisplay.Size = New System.Drawing.Size(686, 49) - Me.grpDisplay.TabIndex = 13 + Me.grpDisplay.Size = New System.Drawing.Size(584, 49) + Me.grpDisplay.TabIndex = 66 Me.grpDisplay.TabStop = False Me.grpDisplay.Text = "Display" ' @@ -526,28 +158,28 @@ Partial Class dlgStartofRains Me.ucrInputNewStatusColumnName.AutoSize = True Me.ucrInputNewStatusColumnName.IsMultiline = False Me.ucrInputNewStatusColumnName.IsReadOnly = False - Me.ucrInputNewStatusColumnName.Location = New System.Drawing.Point(494, 18) + Me.ucrInputNewStatusColumnName.Location = New System.Drawing.Point(461, 18) Me.ucrInputNewStatusColumnName.Name = "ucrInputNewStatusColumnName" Me.ucrInputNewStatusColumnName.Size = New System.Drawing.Size(117, 21) - Me.ucrInputNewStatusColumnName.TabIndex = 19 + Me.ucrInputNewStatusColumnName.TabIndex = 51 ' 'ucrChkAsDate ' Me.ucrChkAsDate.AutoSize = True Me.ucrChkAsDate.Checked = False - Me.ucrChkAsDate.Location = New System.Drawing.Point(227, 18) + Me.ucrChkAsDate.Location = New System.Drawing.Point(194, 18) Me.ucrChkAsDate.Name = "ucrChkAsDate" Me.ucrChkAsDate.Size = New System.Drawing.Size(51, 23) - Me.ucrChkAsDate.TabIndex = 16 + Me.ucrChkAsDate.TabIndex = 48 ' 'ucrChkStatus ' Me.ucrChkStatus.AutoSize = True Me.ucrChkStatus.Checked = False - Me.ucrChkStatus.Location = New System.Drawing.Point(405, 18) + Me.ucrChkStatus.Location = New System.Drawing.Point(372, 18) Me.ucrChkStatus.Name = "ucrChkStatus" Me.ucrChkStatus.Size = New System.Drawing.Size(84, 23) - Me.ucrChkStatus.TabIndex = 18 + Me.ucrChkStatus.TabIndex = 50 ' 'ucrInputNewDateColumnName ' @@ -555,19 +187,22 @@ Partial Class dlgStartofRains Me.ucrInputNewDateColumnName.AutoSize = True Me.ucrInputNewDateColumnName.IsMultiline = False Me.ucrInputNewDateColumnName.IsReadOnly = False - Me.ucrInputNewDateColumnName.Location = New System.Drawing.Point(281, 18) + Me.ucrInputNewDateColumnName.Location = New System.Drawing.Point(248, 18) Me.ucrInputNewDateColumnName.Name = "ucrInputNewDateColumnName" Me.ucrInputNewDateColumnName.Size = New System.Drawing.Size(115, 21) - Me.ucrInputNewDateColumnName.TabIndex = 17 + Me.ucrInputNewDateColumnName.TabIndex = 49 ' - 'ucrChkAsDoy + 'ucrSelectorForStartofRains ' - Me.ucrChkAsDoy.AutoSize = True - Me.ucrChkAsDoy.Checked = False - Me.ucrChkAsDoy.Location = New System.Drawing.Point(13, 477) - Me.ucrChkAsDoy.Name = "ucrChkAsDoy" - Me.ucrChkAsDoy.Size = New System.Drawing.Size(83, 23) - Me.ucrChkAsDoy.TabIndex = 14 + Me.ucrSelectorForStartofRains.AutoSize = True + Me.ucrSelectorForStartofRains.bDropUnusedFilterLevels = False + Me.ucrSelectorForStartofRains.bShowHiddenColumns = False + Me.ucrSelectorForStartofRains.bUseCurrentFilter = True + Me.ucrSelectorForStartofRains.Location = New System.Drawing.Point(14, 6) + Me.ucrSelectorForStartofRains.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorForStartofRains.Name = "ucrSelectorForStartofRains" + Me.ucrSelectorForStartofRains.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorForStartofRains.TabIndex = 53 ' 'ucrInputNewDoyColumnName ' @@ -575,119 +210,347 @@ Partial Class dlgStartofRains Me.ucrInputNewDoyColumnName.AutoSize = True Me.ucrInputNewDoyColumnName.IsMultiline = False Me.ucrInputNewDoyColumnName.IsReadOnly = False - Me.ucrInputNewDoyColumnName.Location = New System.Drawing.Point(99, 477) + Me.ucrInputNewDoyColumnName.Location = New System.Drawing.Point(75, 483) Me.ucrInputNewDoyColumnName.Name = "ucrInputNewDoyColumnName" Me.ucrInputNewDoyColumnName.Size = New System.Drawing.Size(127, 21) - Me.ucrInputNewDoyColumnName.TabIndex = 15 + Me.ucrInputNewDoyColumnName.TabIndex = 68 + ' + 'ucrChkAsDoy + ' + Me.ucrChkAsDoy.AutoSize = True + Me.ucrChkAsDoy.Checked = False + Me.ucrChkAsDoy.Location = New System.Drawing.Point(20, 483) + Me.ucrChkAsDoy.Name = "ucrChkAsDoy" + Me.ucrChkAsDoy.Size = New System.Drawing.Size(69, 23) + Me.ucrChkAsDoy.TabIndex = 67 ' 'ucrReceiverStation ' Me.ucrReceiverStation.AutoSize = True Me.ucrReceiverStation.frmParent = Me - Me.ucrReceiverStation.Location = New System.Drawing.Point(260, 45) + Me.ucrReceiverStation.Location = New System.Drawing.Point(290, 31) Me.ucrReceiverStation.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverStation.Name = "ucrReceiverStation" Me.ucrReceiverStation.Selector = Nothing Me.ucrReceiverStation.Size = New System.Drawing.Size(143, 20) Me.ucrReceiverStation.strNcFilePath = "" - Me.ucrReceiverStation.TabIndex = 2 + Me.ucrReceiverStation.TabIndex = 55 Me.ucrReceiverStation.ucrSelector = Nothing ' 'ucrReceiverDate ' Me.ucrReceiverDate.AutoSize = True Me.ucrReceiverDate.frmParent = Me - Me.ucrReceiverDate.Location = New System.Drawing.Point(260, 88) + Me.ucrReceiverDate.Location = New System.Drawing.Point(290, 74) Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverDate.Name = "ucrReceiverDate" Me.ucrReceiverDate.Selector = Nothing Me.ucrReceiverDate.Size = New System.Drawing.Size(143, 20) Me.ucrReceiverDate.strNcFilePath = "" - Me.ucrReceiverDate.TabIndex = 4 + Me.ucrReceiverDate.TabIndex = 57 Me.ucrReceiverDate.ucrSelector = Nothing ' 'ucrReceiverYear ' Me.ucrReceiverYear.AutoSize = True Me.ucrReceiverYear.frmParent = Me - Me.ucrReceiverYear.Location = New System.Drawing.Point(260, 131) + Me.ucrReceiverYear.Location = New System.Drawing.Point(290, 117) Me.ucrReceiverYear.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverYear.Name = "ucrReceiverYear" Me.ucrReceiverYear.Selector = Nothing Me.ucrReceiverYear.Size = New System.Drawing.Size(143, 20) Me.ucrReceiverYear.strNcFilePath = "" - Me.ucrReceiverYear.TabIndex = 6 + Me.ucrReceiverYear.TabIndex = 59 Me.ucrReceiverYear.ucrSelector = Nothing ' - 'ucrReceiverDOY - ' - Me.ucrReceiverDOY.AutoSize = True - Me.ucrReceiverDOY.frmParent = Me - Me.ucrReceiverDOY.Location = New System.Drawing.Point(260, 174) - Me.ucrReceiverDOY.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverDOY.Name = "ucrReceiverDOY" - Me.ucrReceiverDOY.Selector = Nothing - Me.ucrReceiverDOY.Size = New System.Drawing.Size(143, 20) - Me.ucrReceiverDOY.strNcFilePath = "" - Me.ucrReceiverDOY.TabIndex = 8 - Me.ucrReceiverDOY.ucrSelector = Nothing - ' 'ucrReceiverRainfall ' Me.ucrReceiverRainfall.AutoSize = True Me.ucrReceiverRainfall.frmParent = Me - Me.ucrReceiverRainfall.Location = New System.Drawing.Point(260, 217) + Me.ucrReceiverRainfall.Location = New System.Drawing.Point(290, 203) Me.ucrReceiverRainfall.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverRainfall.Name = "ucrReceiverRainfall" Me.ucrReceiverRainfall.Selector = Nothing Me.ucrReceiverRainfall.Size = New System.Drawing.Size(143, 20) Me.ucrReceiverRainfall.strNcFilePath = "" - Me.ucrReceiverRainfall.TabIndex = 10 + Me.ucrReceiverRainfall.TabIndex = 63 Me.ucrReceiverRainfall.ucrSelector = Nothing ' - 'ucrSelectorForStartofRains - ' - Me.ucrSelectorForStartofRains.AutoSize = True - Me.ucrSelectorForStartofRains.bDropUnusedFilterLevels = False - Me.ucrSelectorForStartofRains.bShowHiddenColumns = False - Me.ucrSelectorForStartofRains.bUseCurrentFilter = True - Me.ucrSelectorForStartofRains.Location = New System.Drawing.Point(5, 9) - Me.ucrSelectorForStartofRains.Margin = New System.Windows.Forms.Padding(0) - Me.ucrSelectorForStartofRains.Name = "ucrSelectorForStartofRains" - Me.ucrSelectorForStartofRains.Size = New System.Drawing.Size(213, 183) - Me.ucrSelectorForStartofRains.TabIndex = 0 - ' 'ucrBase ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(5, 514) + Me.ucrBase.Location = New System.Drawing.Point(14, 520) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(408, 52) - Me.ucrBase.TabIndex = 20 + Me.ucrBase.TabIndex = 69 + ' + 'ucrInputFilterPreview + ' + Me.ucrInputFilterPreview.AddQuotesIfUnrecognised = True + Me.ucrInputFilterPreview.AutoSize = True + Me.ucrInputFilterPreview.IsMultiline = False + Me.ucrInputFilterPreview.IsReadOnly = True + Me.ucrInputFilterPreview.Location = New System.Drawing.Point(277, 11) + Me.ucrInputFilterPreview.Name = "ucrInputFilterPreview" + Me.ucrInputFilterPreview.Size = New System.Drawing.Size(242, 22) + Me.ucrInputFilterPreview.TabIndex = 15 + ' + 'ucrReceiverDOY + ' + Me.ucrReceiverDOY.AutoSize = True + Me.ucrReceiverDOY.frmParent = Me + Me.ucrReceiverDOY.Location = New System.Drawing.Point(290, 160) + Me.ucrReceiverDOY.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverDOY.Name = "ucrReceiverDOY" + Me.ucrReceiverDOY.Selector = Nothing + Me.ucrReceiverDOY.Size = New System.Drawing.Size(143, 20) + Me.ucrReceiverDOY.strNcFilePath = "" + Me.ucrReceiverDOY.TabIndex = 61 + Me.ucrReceiverDOY.ucrSelector = Nothing + ' + 'grpConditionsForSatrtofRains + ' + Me.grpConditionsForSatrtofRains.Controls.Add(Me.cmdAdditionnal) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrChkAdditional) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrReceiverEvap) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblFraction) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrNudEvapo) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.rdoEvapo) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblTROverDays) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrNudTROverDays) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrNudTRAmount) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblTRVal) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrChkTotalRainfall) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrNudTRPercentile) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.rdoTRAmount) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.rdoTRPercentile) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.ucrPnlTRCalculateBy) + Me.grpConditionsForSatrtofRains.Location = New System.Drawing.Point(13, 270) + Me.grpConditionsForSatrtofRains.Name = "grpConditionsForSatrtofRains" + Me.grpConditionsForSatrtofRains.Size = New System.Drawing.Size(584, 185) + Me.grpConditionsForSatrtofRains.TabIndex = 65 + Me.grpConditionsForSatrtofRains.TabStop = False + Me.grpConditionsForSatrtofRains.Text = "Conditions for Start of Rains" + ' + 'cmdAdditionnal + ' + Me.cmdAdditionnal.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdAdditionnal.Location = New System.Drawing.Point(159, 147) + Me.cmdAdditionnal.Name = "cmdAdditionnal" + Me.cmdAdditionnal.Size = New System.Drawing.Size(105, 26) + Me.cmdAdditionnal.TabIndex = 16 + Me.cmdAdditionnal.Tag = "" + Me.cmdAdditionnal.Text = "Add" + Me.cmdAdditionnal.UseVisualStyleBackColor = True + ' + 'ucrChkAdditional + ' + Me.ucrChkAdditional.AutoSize = True + Me.ucrChkAdditional.Checked = False + Me.ucrChkAdditional.Location = New System.Drawing.Point(4, 151) + Me.ucrChkAdditional.Name = "ucrChkAdditional" + Me.ucrChkAdditional.Size = New System.Drawing.Size(143, 23) + Me.ucrChkAdditional.TabIndex = 45 + ' + 'ucrReceiverEvap + ' + Me.ucrReceiverEvap.AutoSize = True + Me.ucrReceiverEvap.frmParent = Me + Me.ucrReceiverEvap.Location = New System.Drawing.Point(210, 81) + Me.ucrReceiverEvap.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverEvap.Name = "ucrReceiverEvap" + Me.ucrReceiverEvap.Selector = Nothing + Me.ucrReceiverEvap.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverEvap.strNcFilePath = "" + Me.ucrReceiverEvap.TabIndex = 24 + Me.ucrReceiverEvap.ucrSelector = Nothing + ' + 'lblFraction + ' + Me.lblFraction.AutoSize = True + Me.lblFraction.Location = New System.Drawing.Point(349, 83) + Me.lblFraction.Name = "lblFraction" + Me.lblFraction.Size = New System.Drawing.Size(48, 13) + Me.lblFraction.TabIndex = 25 + Me.lblFraction.Text = "Fraction:" + ' + 'ucrNudEvapo + ' + Me.ucrNudEvapo.AutoSize = True + Me.ucrNudEvapo.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudEvapo.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudEvapo.Location = New System.Drawing.Point(414, 78) + Me.ucrNudEvapo.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudEvapo.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudEvapo.Name = "ucrNudEvapo" + Me.ucrNudEvapo.Size = New System.Drawing.Size(42, 20) + Me.ucrNudEvapo.TabIndex = 26 + Me.ucrNudEvapo.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'rdoEvapo + ' + Me.rdoEvapo.AutoSize = True + Me.rdoEvapo.Location = New System.Drawing.Point(120, 83) + Me.rdoEvapo.Name = "rdoEvapo" + Me.rdoEvapo.Size = New System.Drawing.Size(82, 17) + Me.rdoEvapo.TabIndex = 23 + Me.rdoEvapo.TabStop = True + Me.rdoEvapo.Text = "Evaporation" + Me.rdoEvapo.UseVisualStyleBackColor = True + ' + 'lblTROverDays + ' + Me.lblTROverDays.AutoSize = True + Me.lblTROverDays.Location = New System.Drawing.Point(144, 25) + Me.lblTROverDays.Name = "lblTROverDays" + Me.lblTROverDays.Size = New System.Drawing.Size(60, 13) + Me.lblTROverDays.TabIndex = 18 + Me.lblTROverDays.Tag = "" + Me.lblTROverDays.Text = "Over Days:" + ' + 'ucrNudTROverDays + ' + Me.ucrNudTROverDays.AutoSize = True + Me.ucrNudTROverDays.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudTROverDays.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudTROverDays.Location = New System.Drawing.Point(210, 21) + Me.ucrNudTROverDays.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudTROverDays.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudTROverDays.Name = "ucrNudTROverDays" + Me.ucrNudTROverDays.Size = New System.Drawing.Size(42, 20) + Me.ucrNudTROverDays.TabIndex = 19 + Me.ucrNudTROverDays.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudTRAmount + ' + Me.ucrNudTRAmount.AutoSize = True + Me.ucrNudTRAmount.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudTRAmount.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudTRAmount.Location = New System.Drawing.Point(210, 58) + Me.ucrNudTRAmount.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudTRAmount.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudTRAmount.Name = "ucrNudTRAmount" + Me.ucrNudTRAmount.Size = New System.Drawing.Size(42, 20) + Me.ucrNudTRAmount.TabIndex = 22 + Me.ucrNudTRAmount.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'lblTRVal + ' + Me.lblTRVal.AutoSize = True + Me.lblTRVal.Location = New System.Drawing.Point(20, 60) + Me.lblTRVal.Name = "lblTRVal" + Me.lblTRVal.Size = New System.Drawing.Size(37, 13) + Me.lblTRVal.TabIndex = 20 + Me.lblTRVal.Text = "Value:" + ' + 'ucrChkTotalRainfall + ' + Me.ucrChkTotalRainfall.AutoSize = True + Me.ucrChkTotalRainfall.Checked = False + Me.ucrChkTotalRainfall.Location = New System.Drawing.Point(4, 22) + Me.ucrChkTotalRainfall.Name = "ucrChkTotalRainfall" + Me.ucrChkTotalRainfall.Size = New System.Drawing.Size(131, 23) + Me.ucrChkTotalRainfall.TabIndex = 17 + ' + 'ucrNudTRPercentile + ' + Me.ucrNudTRPercentile.AutoSize = True + Me.ucrNudTRPercentile.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudTRPercentile.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudTRPercentile.Location = New System.Drawing.Point(210, 109) + Me.ucrNudTRPercentile.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudTRPercentile.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudTRPercentile.Name = "ucrNudTRPercentile" + Me.ucrNudTRPercentile.Size = New System.Drawing.Size(42, 20) + Me.ucrNudTRPercentile.TabIndex = 28 + Me.ucrNudTRPercentile.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'rdoTRAmount + ' + Me.rdoTRAmount.AutoSize = True + Me.rdoTRAmount.Location = New System.Drawing.Point(120, 60) + Me.rdoTRAmount.Name = "rdoTRAmount" + Me.rdoTRAmount.Size = New System.Drawing.Size(61, 17) + Me.rdoTRAmount.TabIndex = 21 + Me.rdoTRAmount.TabStop = True + Me.rdoTRAmount.Text = "Amount" + Me.rdoTRAmount.UseVisualStyleBackColor = True + ' + 'rdoTRPercentile + ' + Me.rdoTRPercentile.AutoSize = True + Me.rdoTRPercentile.Location = New System.Drawing.Point(120, 109) + Me.rdoTRPercentile.Name = "rdoTRPercentile" + Me.rdoTRPercentile.Size = New System.Drawing.Size(72, 17) + Me.rdoTRPercentile.TabIndex = 27 + Me.rdoTRPercentile.TabStop = True + Me.rdoTRPercentile.Text = "Percentile" + Me.rdoTRPercentile.UseVisualStyleBackColor = True + ' + 'ucrPnlTRCalculateBy + ' + Me.ucrPnlTRCalculateBy.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlTRCalculateBy.Location = New System.Drawing.Point(51, 55) + Me.ucrPnlTRCalculateBy.Name = "ucrPnlTRCalculateBy" + Me.ucrPnlTRCalculateBy.Size = New System.Drawing.Size(165, 75) + Me.ucrPnlTRCalculateBy.TabIndex = 4 + ' + 'lblThreshold + ' + Me.lblThreshold.AutoSize = True + Me.lblThreshold.Location = New System.Drawing.Point(10, 12) + Me.lblThreshold.Name = "lblThreshold" + Me.lblThreshold.Size = New System.Drawing.Size(57, 13) + Me.lblThreshold.TabIndex = 12 + Me.lblThreshold.Tag = "Threshold" + Me.lblThreshold.Text = "Threshold:" + ' + 'grpRainParameters + ' + Me.grpRainParameters.Controls.Add(Me.ucrInputThreshold) + Me.grpRainParameters.Controls.Add(Me.ucrInputFilterPreview) + Me.grpRainParameters.Controls.Add(Me.cmdDoyRange) + Me.grpRainParameters.Controls.Add(Me.lblThreshold) + Me.grpRainParameters.Location = New System.Drawing.Point(13, 222) + Me.grpRainParameters.Name = "grpRainParameters" + Me.grpRainParameters.Size = New System.Drawing.Size(584, 40) + Me.grpRainParameters.TabIndex = 64 + Me.grpRainParameters.TabStop = False + ' + 'cmdDoyRange + ' + Me.cmdDoyRange.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdDoyRange.Location = New System.Drawing.Point(159, 8) + Me.cmdDoyRange.Name = "cmdDoyRange" + Me.cmdDoyRange.Size = New System.Drawing.Size(105, 26) + Me.cmdDoyRange.TabIndex = 14 + Me.cmdDoyRange.Tag = "" + Me.cmdDoyRange.Text = "Day Range" + Me.cmdDoyRange.UseVisualStyleBackColor = True ' 'dlgStartofRains ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.ClientSize = New System.Drawing.Size(696, 573) + Me.ClientSize = New System.Drawing.Size(610, 582) Me.Controls.Add(Me.lblRainfall) - Me.Controls.Add(Me.ucrChkAsDoy) - Me.Controls.Add(Me.ucrInputNewDoyColumnName) Me.Controls.Add(Me.lblStation) - Me.Controls.Add(Me.ucrReceiverStation) - Me.Controls.Add(Me.ucrReceiverDate) - Me.Controls.Add(Me.ucrReceiverYear) - Me.Controls.Add(Me.ucrReceiverDOY) - Me.Controls.Add(Me.ucrReceiverRainfall) Me.Controls.Add(Me.lblYear) Me.Controls.Add(Me.lblDate) Me.Controls.Add(Me.lblDOY) - Me.Controls.Add(Me.grpRainParameters) - Me.Controls.Add(Me.grpConditionsForSatrtofRains) Me.Controls.Add(Me.ucrSelectorForStartofRains) + Me.Controls.Add(Me.ucrInputNewDoyColumnName) + Me.Controls.Add(Me.ucrChkAsDoy) + Me.Controls.Add(Me.ucrReceiverStation) + Me.Controls.Add(Me.ucrReceiverDate) + Me.Controls.Add(Me.ucrReceiverYear) + Me.Controls.Add(Me.ucrReceiverRainfall) Me.Controls.Add(Me.ucrBase) + Me.Controls.Add(Me.ucrReceiverDOY) + Me.Controls.Add(Me.grpConditionsForSatrtofRains) + Me.Controls.Add(Me.grpRainParameters) Me.Controls.Add(Me.grpDisplay) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False @@ -696,66 +559,55 @@ Partial Class dlgStartofRains Me.ShowIcon = False Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Start of Rains" + Me.grpDisplay.ResumeLayout(False) + Me.grpDisplay.PerformLayout() Me.grpConditionsForSatrtofRains.ResumeLayout(False) Me.grpConditionsForSatrtofRains.PerformLayout() Me.grpRainParameters.ResumeLayout(False) Me.grpRainParameters.PerformLayout() - Me.grpDisplay.ResumeLayout(False) - Me.grpDisplay.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() End Sub - Friend WithEvents ucrBase As ucrButtons - Friend WithEvents ucrSelectorForStartofRains As ucrSelectorByDataFrameAddRemove - Friend WithEvents grpConditionsForSatrtofRains As GroupBox - Friend WithEvents lblDSLengthofTime As Label - Friend WithEvents lblDSMaximumDays As Label - Friend WithEvents lblTRVal As Label - Friend WithEvents lblRDMinimum As Label - Friend WithEvents grpRainParameters As GroupBox - Friend WithEvents lblTROverDays As Label - Friend WithEvents lblDOY As Label - Friend WithEvents ucrReceiverRainfall As ucrReceiverSingle - Friend WithEvents ucrReceiverDOY As ucrReceiverSingle - Friend WithEvents lblRDWidth As Label - Friend WithEvents lblThreshold As Label + Friend WithEvents ucrInputThreshold As ucrInputComboBox + Friend WithEvents lblRainfall As Label + Friend WithEvents lblStation As Label + Friend WithEvents lblYear As Label Friend WithEvents lblDate As Label + Friend WithEvents lblDOY As Label + Friend WithEvents grpDisplay As GroupBox + Friend WithEvents ucrInputNewStatusColumnName As ucrInputTextBox + Friend WithEvents ucrChkAsDate As ucrCheck + Friend WithEvents ucrChkStatus As ucrCheck + Friend WithEvents ucrInputNewDateColumnName As ucrInputTextBox + Friend WithEvents ucrSelectorForStartofRains As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrInputNewDoyColumnName As ucrInputTextBox + Friend WithEvents ucrChkAsDoy As ucrCheck + Friend WithEvents ucrReceiverStation As ucrReceiverSingle Friend WithEvents ucrReceiverDate As ucrReceiverSingle Friend WithEvents ucrReceiverYear As ucrReceiverSingle - Friend WithEvents lblYear As Label - Friend WithEvents rdoTRPercentile As RadioButton - Friend WithEvents rdoTRAmount As RadioButton - Friend WithEvents lblDPOverallInterval As Label - Friend WithEvents lblDPLength As Label - Friend WithEvents lblDPMaxRain As Label + Friend WithEvents ucrReceiverRainfall As ucrReceiverSingle + Friend WithEvents ucrBase As ucrButtons + Friend WithEvents ucrReceiverDOY As ucrReceiverSingle + Friend WithEvents grpConditionsForSatrtofRains As GroupBox + Friend WithEvents cmdAdditionnal As Button + Friend WithEvents ucrChkAdditional As ucrCheck + Friend WithEvents ucrReceiverEvap As ucrReceiverSingle + Friend WithEvents lblFraction As Label + Friend WithEvents ucrNudEvapo As ucrNud + Friend WithEvents rdoEvapo As RadioButton + Friend WithEvents lblTROverDays As Label Friend WithEvents ucrNudTROverDays As ucrNud - Friend WithEvents ucrNudTRPercentile As ucrNud - Friend WithEvents lblStation As Label - Friend WithEvents ucrReceiverStation As ucrReceiverSingle - Friend WithEvents ucrChkTotalRainfall As ucrCheck Friend WithEvents ucrNudTRAmount As ucrNud + Friend WithEvents lblTRVal As Label + Friend WithEvents ucrChkTotalRainfall As ucrCheck + Friend WithEvents ucrNudTRPercentile As ucrNud + Friend WithEvents rdoTRAmount As RadioButton + Friend WithEvents rdoTRPercentile As RadioButton Friend WithEvents ucrPnlTRCalculateBy As UcrPanel - Friend WithEvents ucrNudRDMinimumDays As ucrNud - Friend WithEvents ucrNudRDOutOfDays As ucrNud - Friend WithEvents ucrChkNumberOfRainyDays As ucrCheck - Friend WithEvents ucrNudDSLengthOfTime As ucrNud - Friend WithEvents ucrNudDSMaximumDays As ucrNud - Friend WithEvents ucrNudDPOverallInterval As ucrNud - Friend WithEvents ucrNudDPRainPeriod As ucrNud - Friend WithEvents ucrNudDPMaxRain As ucrNud - Friend WithEvents ucrChkDrySpell As ucrCheck - Friend WithEvents ucrChkDryPeriod As ucrCheck - Friend WithEvents ucrInputNewDoyColumnName As ucrInputTextBox + Friend WithEvents grpRainParameters As GroupBox Friend WithEvents ucrInputFilterPreview As ucrInputTextBox Friend WithEvents cmdDoyRange As Button - Friend WithEvents ucrInputNewDateColumnName As ucrInputTextBox - Friend WithEvents ucrChkAsDate As ucrCheck - Friend WithEvents ucrChkAsDoy As ucrCheck - Friend WithEvents lblRainfall As Label - Friend WithEvents ucrChkStatus As ucrCheck - Friend WithEvents ucrInputNewStatusColumnName As ucrInputTextBox - Friend WithEvents grpDisplay As GroupBox - Friend WithEvents ucrInputThreshold As ucrInputComboBox + Friend WithEvents lblThreshold As Label End Class \ No newline at end of file diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index b5df24820c2..516fbdcdc03 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -17,9 +17,10 @@ Imports instat.Translations Public Class dlgStartofRains - Private clsCalcRainDay, clsCalcStartDOY, clsConvertColumnType1Function, clsConvertColumnType2Function, clsConvertColumnTypeFunction, clsGetColumnDataTypeFunction, clsDummyFunction, clsIfelseStatusFunction, clsIfelseStatus1Function, clsFirstStatusFunction, clsIsNAStatusFunction, clsCalcStartDate, clsCombinationCalc, clsListCalFunction, clsCombinationManipList, clsCombinationSubCalcList, clsListSubCalc, clsManipulationFirstDOYPerYear, clsConditionsFilter, clsCombinedList As New RFunction + Private bResetSubdialog As Boolean = True + Private clsCalcRainDay, clsCalcStartDOY, clsTailFunction, clsGetDataFrameFunction, clsListevapFunction, clsRollEvaporationFunction, clsFractionEvapFunction, clsSumEvapFunction, clsConvertColumnType1Function, clsConvertColumnType2Function, clsConvertColumnTypeFunction, clsGetColumnDataTypeFunction, clsDummyFunction, clsIfelseStatusFunction, clsIfelseStatus1Function, clsFirstStatusFunction, clsIsNAStatusFunction, clsCalcStartDate, clsCombinationCalc, clsListCalFunction, clsCombinationManipList, clsCombinationSubCalcList, clsListSubCalc, clsManipulationFirstDOYPerYear, clsConditionsFilter, clsCombinedList As New RFunction Private clsDayFromAndTo, clsGroupByStation, clsGroupByYear, clsListToTalRain, clsApplyInstatFunction, clsFirstDOY, clsFirstDate As New RFunction - Private clsDayFromAndToOperator, clsDayFromOperator, clsDayToOperator, clsRainDayOperator, clsRainDayConditionOperator, clsConditionsAndOperator, clsTRCombineOperator, clsRollingSumRainDayOperator, clsDSCombineOperator, clsDPCombineOperator As New ROperator + Private clsDayFromAndToOperator, clsEvapOperator, clsDayFromOperator, clsDayToOperator, clsRainDayOperator, clsRainDayConditionOperator, clsConditionsAndOperator, clsTRCombineOperator, clsRollingSumRainDayOperator, clsDSCombineOperator, clsDPCombineOperator As New ROperator Private clsDayFilterCalcFromConvert, clsDayFilterCalcFromList As New RFunction Private clsSpellsFunction As New RFunction @@ -70,6 +71,8 @@ Public Class dlgStartofRains Public bFirstLoad As Boolean = True Private bReset As Boolean = True Private strWetSpell As String = "wet_spell" + Private strFactionEvap As String = "fraction_evap" + Private strSumFractionEvap As String = "roll_sum_evap" Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -130,6 +133,11 @@ Public Class dlgStartofRains ucrReceiverRainfall.SetClimaticType("rain") ucrReceiverRainfall.bAutoFill = True + ucrReceiverEvap.SetParameter(New RParameter("evap", 0, False)) + ucrReceiverEvap.SetParameterIsString() + ucrReceiverEvap.bWithQuotes = False + ucrReceiverEvap.Selector = ucrSelectorForStartofRains + ucrInputThreshold.SetParameter(New RParameter("threshold", 1)) dctInputThreshold.Add("0.85", "0.85") dctInputThreshold.Add("0.5", "0.5") @@ -140,18 +148,21 @@ Public Class dlgStartofRains ucrInputThreshold.SetLinkedDisplayControl(lblThreshold) ucrInputThreshold.SetRDefault(0.85) - - 'Total Rainfall ucrPnlTRCalculateBy.AddRadioButton(rdoTRAmount) ucrPnlTRCalculateBy.AddRadioButton(rdoTRPercentile) + ucrPnlTRCalculateBy.AddRadioButton(rdoEvapo) ucrPnlTRCalculateBy.AddParameterPresentCondition(rdoTRAmount, "tr_perc_sub", False) ucrPnlTRCalculateBy.AddParameterPresentCondition(rdoTRPercentile, "tr_perc_sub") + ucrPnlTRCalculateBy.AddParameterPresentCondition(rdoEvapo, "tr_perc_sub") ucrPnlTRCalculateBy.AddToLinkedControls(ucrNudTRPercentile, {rdoTRPercentile}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=0.8) ucrPnlTRCalculateBy.AddToLinkedControls(ucrNudTRAmount, {rdoTRAmount}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=20) + ucrPnlTRCalculateBy.AddToLinkedControls(ucrNudEvapo, {rdoEvapo}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=0.5) + ucrPnlTRCalculateBy.AddToLinkedControls(ucrReceiverEvap, {rdoEvapo}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlTRCalculateBy.SetLinkedDisplayControl(lblTRVal) ucrPnlTRCalculateBy.AddParameterPresentCondition(rdoTRPercentile, "tr_perc") ucrPnlTRCalculateBy.AddParameterPresentCondition(rdoTRAmount, "tr_amount") + ucrPnlTRCalculateBy.AddParameterPresentCondition(rdoEvapo, "evap") ucrNudTRAmount.SetParameter(New RParameter("tr_amount", 1, False), False) ucrNudTRAmount.SetMinMax(1, Integer.MaxValue) @@ -171,57 +182,15 @@ Public Class dlgStartofRains ucrNudTRPercentile.DecimalPlaces = 2 ucrNudTRPercentile.Increment = 0.1 - 'Number of Rainy days - ucrChkNumberOfRainyDays.SetParameter(New RParameter("rd_sub", clsCalcRainDayRollingSum, 2, False), False) - ucrChkNumberOfRainyDays.AddAdditionalCodeParameterPair(clsConditionsAndOperator, New RParameter("rain_days", clsRollingSumRainDayOperator, 2, False), iAdditionalPairNo:=1) - ucrChkNumberOfRainyDays.SetText("Number of Rainy Days") - - ucrNudRDMinimumDays.SetParameter(New RParameter("1", 1)) - ucrNudRDMinimumDays.SetLinkedDisplayControl(lblRDMinimum) - ucrNudRDMinimumDays.SetMinMax(1, 366) - - ucrNudRDOutOfDays.SetParameter(New RParameter("n", 1)) - ucrNudRDOutOfDays.SetLinkedDisplayControl(lblRDWidth) - ucrNudRDOutOfDays.SetMinMax(1, 366) - - ucrChkNumberOfRainyDays.AddToLinkedControls(ucrNudRDMinimumDays, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=1) - ucrChkNumberOfRainyDays.AddToLinkedControls(ucrNudRDOutOfDays, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=2) - - 'Dry Spell - ucrChkDrySpell.SetParameter(New RParameter("ds_sub", clsCalcDrySpellRollMax, 3, False), False) - ucrChkDrySpell.AddAdditionalCodeParameterPair(clsConditionsAndOperator, New RParameter("dry_spell", clsDSCombineOperator, 3, False), iAdditionalPairNo:=1) - ucrChkDrySpell.SetText("Dry Spell") - ucrChkDrySpell.AddToLinkedControls(ucrNudDSLengthOfTime, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=21) - ucrChkDrySpell.AddToLinkedControls(ucrNudDSMaximumDays, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=9) - ucrNudDSLengthOfTime.SetLinkedDisplayControl(lblDSLengthofTime) - ucrNudDSMaximumDays.SetLinkedDisplayControl(lblDSMaximumDays) - - ucrNudDSLengthOfTime.SetParameter(New RParameter("n", 1)) - ucrNudDSLengthOfTime.SetMinMax(1, 366) - - ucrNudDSMaximumDays.SetParameter(New RParameter("ds_max", 1)) - ucrNudDSMaximumDays.SetMinMax(1, 366) + ucrNudEvapo.SetParameter(New RParameter("frac", 1, False)) + ucrNudEvapo.SetMinMax(0.01, 10) + ucrNudEvapo.DecimalPlaces = 2 + ucrNudEvapo.Increment = 0.01 + ucrNudEvapo.SetLinkedDisplayControl(lblFraction) - ' Dry Period - ucrChkDryPeriod.SetParameter(New RParameter("dp_sub", clsCalcRollSumNumberDryPeriod, 3, False), False) - ucrChkDryPeriod.AddAdditionalCodeParameterPair(clsConditionsAndOperator, New RParameter("dry_period", clsDPCombineOperator, 4, False), iAdditionalPairNo:=1) - ucrChkDryPeriod.SetText("Dry Period") - - ucrNudDPRainPeriod.SetParameter(New RParameter("n", 0)) - ucrNudDPRainPeriod.SetLinkedDisplayControl(lblDPLength) - ucrNudDPRainPeriod.SetMinMax(1, 366) - - ucrNudDPMaxRain.SetParameter(New RParameter("right", 1)) - ucrNudDPMaxRain.SetLinkedDisplayControl(lblDPMaxRain) - ucrNudDPMaxRain.SetMinMax(1, Integer.MaxValue) - - ucrNudDPOverallInterval.SetParameter(New RParameter("0", 0)) - ucrNudDPOverallInterval.SetLinkedDisplayControl(lblDPOverallInterval) - ucrNudDPOverallInterval.SetMinMax(1, 366) - - ucrChkDryPeriod.AddToLinkedControls(ucrNudDPMaxRain, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=40) - ucrChkDryPeriod.AddToLinkedControls(ucrNudDPOverallInterval, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=45) - ucrChkDryPeriod.AddToLinkedControls(ucrNudDPRainPeriod, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=30) + ucrChkAdditional.SetText("Additional") + ucrChkAdditional.AddParameterValuesCondition(True, "additional", "True") + ucrChkAdditional.AddParameterValuesCondition(False, "additional", "False") 'save ucrInputNewDoyColumnName.SetParameter(New RParameter("result_name", 2)) @@ -242,7 +211,7 @@ Public Class dlgStartofRains ucrChkAsDoy.AddParameterPresentCondition(True, "sub1", True) ucrChkAsDoy.AddParameterPresentCondition(False, "sub1", False) - ucrChkAsDoy.SetText("Day of Year") + ucrChkAsDoy.SetText("Day") ucrChkAsDate.AddParameterValuesCondition(True, "sub2", "True") ucrChkAsDate.AddParameterValuesCondition(False, "sub2", "False") @@ -251,6 +220,9 @@ Public Class dlgStartofRains ucrChkStatus.AddParameterValuesCondition(True, "sub3", "True") ucrChkStatus.AddParameterValuesCondition(False, "sub3", "False") ucrChkStatus.SetText("Occurrence") + SetReceiver() + AdditionalCondition() + ChangeDSValue() End Sub Private Sub SetDefaults() @@ -290,6 +262,11 @@ Public Class dlgStartofRains clsConvertColumnTypeFunction.Clear() clsConvertColumnType2Function.Clear() clsConvertColumnType1Function.Clear() + clsFractionEvapFunction.Clear() + clsSumEvapFunction.Clear() + clsEvapOperator.Clear() + clsRollEvaporationFunction.Clear() + clsListevapFunction.Clear() clsSpellsFunction.Clear() clsRainDaySpellsOperator.Clear() @@ -320,6 +297,8 @@ Public Class dlgStartofRains clsCalcRainRollingSum.Clear() clsRainRollingSumFunction = New RFunction + clsTailFunction = New RFunction + clsGetDataFrameFunction = New RFunction clsTRWetSpellList.Clear() clsTRWetSpell.Clear() clsTRWetSpellFunction.Clear() @@ -355,7 +334,7 @@ Public Class dlgStartofRains clsDSCombineOperator.Clear() clsDPCombineOperator.Clear() - ucrReceiverRainfall.SetMeAsReceiver() + bResetSubdialog = True ucrSelectorForStartofRains.Reset() clsDayFilterCalcFromConvert = New RFunction @@ -367,6 +346,7 @@ Public Class dlgStartofRains clsDummyFunction = New RFunction clsDummyFunction.AddParameter("sub2", "True", iPosition:=0) clsDummyFunction.AddParameter("sub3", "True", iPosition:=1) + clsDummyFunction.AddParameter("additional", "False", iPosition:=2) 'Day From and To clsDayFromAndTo.SetRCommand("instat_calculation$new") @@ -409,9 +389,6 @@ Public Class dlgStartofRains clsConvertColumnType1Function.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) clsConvertColumnType1Function.AddParameter("to_type", "year_type", iPosition:=2) - clsConvertColumnType2Function.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$convert_column_to_type") - clsConvertColumnType2Function.AddParameter("to_type", "year_type", iPosition:=2) - 'TOTAL RAIN: associated with ucrChkTotalRainfall clsCalcRainRollingSum.SetRCommand("instat_calculation$new") clsCalcRainRollingSum.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) @@ -560,8 +537,34 @@ Public Class dlgStartofRains clsIsNaFirstDrySpell.SetRCommand("is.na") clsIsNaFirstDrySpell.AddParameter("x", clsRFunctionParameter:=clsFirstDrySpell, iPosition:=0) - 'DRY PERIOD + clsFractionEvapFunction.SetRCommand("instat_calculation$new") + clsFractionEvapFunction.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) + clsFractionEvapFunction.AddParameter("function_exp", clsROperatorParameter:=clsEvapOperator, iPosition:=1) + clsFractionEvapFunction.AddParameter("result_name", Chr(34) & strFactionEvap & Chr(34), iPosition:=2) + clsFractionEvapFunction.SetAssignTo(strFactionEvap) + + clsEvapOperator.SetOperation("*") + clsEvapOperator.bToScriptAsRString = True + + clsSumEvapFunction.SetRCommand("instat_calculation$new") + clsSumEvapFunction.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) + clsSumEvapFunction.AddParameter("function_exp", clsRFunctionParameter:=clsRollEvaporationFunction, iPosition:=1) + clsSumEvapFunction.AddParameter("result_name", Chr(34) & strSumFractionEvap & Chr(34), iPosition:=2) + clsSumEvapFunction.AddParameter("sub_calculations", clsRFunctionParameter:=clsListevapFunction, iPosition:=3) + clsSumEvapFunction.SetAssignTo(strSumFractionEvap) + + clsListevapFunction.SetRCommand("list") + clsListevapFunction.AddParameter("x", strFactionEvap, iPosition:=0, bIncludeArgumentName:=False) + + clsRollEvaporationFunction.SetPackageName("RcppRoll") + clsRollEvaporationFunction.SetRCommand("roll_sumr") + clsRollEvaporationFunction.AddParameter("x", strFactionEvap, iPosition:=0) + clsRollEvaporationFunction.AddParameter("n", "2", iPosition:=1) + clsRollEvaporationFunction.AddParameter("fill", "NA", iPosition:=2) + clsRollEvaporationFunction.AddParameter("na.rm", "FALSE", iPosition:=3) + clsRollEvaporationFunction.bToScriptAsRString = True + 'DRY PERIOD clsCalcRainRollingSumDryPeriod.SetRCommand("instat_calculation$new") clsCalcRainRollingSumDryPeriod.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) clsCalcRainRollingSumDryPeriod.AddParameter("function_exp", clsRFunctionParameter:=clsLeadRollingSumRainDryPeriodFunction, iPosition:=1) @@ -622,7 +625,7 @@ Public Class dlgStartofRains clsConditionsFilter.SetAssignTo("conditions_filter") clsCombinedList.SetRCommand("list") - clsCombinedList.AddParameter("tr_sub", clsRFunctionParameter:=clsCalcRainRollingSum, bIncludeArgumentName:=False) + clsCombinedList.AddParameter("tr_sub", clsRFunctionParameter:=clsCalcRainRollingSum, bIncludeArgumentName:=False, iPosition:=0) clsConditionsOrOverallOperator.SetOperation("|") clsConditionsOrOverallOperator.bToScriptAsRString = True @@ -755,6 +758,17 @@ Public Class dlgStartofRains 'Sub_Calculations List clsListSubCalc.SetRCommand("list") + clsGetDataFrameFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_data_names") + + clsTailFunction.SetRCommand("tail") + clsTailFunction.AddParameter("x", clsRFunctionParameter:=clsGetDataFrameFunction, iPosition:=0, bIncludeArgumentName:=False) + clsTailFunction.AddParameter("n", "1", iPosition:=1) + clsTailFunction.SetAssignTo("last_data_name") + + clsConvertColumnType2Function.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$convert_column_to_type") + clsConvertColumnType2Function.AddParameter("data_name", "last_data_name", iPosition:=0) + clsConvertColumnType2Function.AddParameter("to_type", "year_type", iPosition:=2) + 'Run Calculations clsListCalFunction.SetRCommand("list") clsListCalFunction.AddParameter("drop", "FALSE", iPosition:=0) @@ -764,11 +778,17 @@ Public Class dlgStartofRains clsApplyInstatFunction.AddParameter("calc", clsRFunctionParameter:=clsCombinationCalc, iPosition:=0) clsApplyInstatFunction.AddParameter("param_list", clsRFunctionParameter:=clsListCalFunction, iPosition:=2) + ucrBase.clsRsyntax.ClearCodes() + ucrBase.clsRsyntax.SetBaseRFunction(clsApplyInstatFunction) ucrBase.clsRsyntax.AddToBeforeCodes(clsGetColumnDataTypeFunction, iPosition:=0) ucrBase.clsRsyntax.AddToBeforeCodes(clsConvertColumnTypeFunction, iPosition:=1) - ucrBase.clsRsyntax.AddToAfterCodes(clsConvertColumnType1Function, iPosition:=0) - ucrBase.clsRsyntax.AddToAfterCodes(clsConvertColumnType2Function, iPosition:=1) + ucrBase.clsRsyntax.AddToAfterCodes(clsTailFunction, iPosition:=0) + ucrBase.clsRsyntax.AddToAfterCodes(clsConvertColumnType1Function, iPosition:=1) + ucrBase.clsRsyntax.AddToAfterCodes(clsConvertColumnType2Function, iPosition:=2) + SetReceiver() + ChangeDSValue() + AdditionalCondition() End Sub Private Sub SetRCodeForControls(bReset As Boolean) @@ -781,17 +801,15 @@ Public Class dlgStartofRains ucrReceiverRainfall.AddAdditionalCodeParameterPair(clsFirstRain, New RParameter("x", 0), iAdditionalPairNo:=4) ucrReceiverRainfall.AddAdditionalCodeParameterPair(clsIsNaRain, New RParameter("x", 0), iAdditionalPairNo:=5) ucrInputThreshold.AddAdditionalCodeParameterPair(clsRainDayConditionOperator, New RParameter("threshold", 1), iAdditionalPairNo:=1) - - 'clsSORStartSummary.SetControlParameters(ucrReceiverRainfall, iAdditionalPairNo:=4) - 'clsSORStatusSummary.SetControlParameters(ucrReceiverRainfall, iAdditionalPairNo:=5) - - ucrNudDPRainPeriod.AddAdditionalCodeParameterPair(clsSumRainDryPeriodIntervalPlusOperator, ucrNudDPRainPeriod.GetParameter(), iAdditionalPairNo:=1) ucrInputNewDoyColumnName.AddAdditionalCodeParameterPair(clsCalcStartDOY, New RParameter("result_name", 3), iAdditionalPairNo:=1) ucrReceiverDOY.SetRCode(clsDayToOperator, bReset) ucrChkAsDoy.SetRCode(clsCombinationSubCalcList, bReset) ucrChkStatus.SetRCode(clsDummyFunction, bReset) ucrChkAsDate.SetRCode(clsDummyFunction, bReset) + If bReset Then + ucrChkAdditional.SetRCode(clsDummyFunction, bReset) + End If ucrInputThreshold.SetRCode(clsRainDayOperator, bReset) ucrReceiverDate.SetRCode(clsFirstDate, bReset) @@ -804,25 +822,12 @@ Public Class dlgStartofRains ucrNudTROverDays.SetRCode(clsRainRollingSumFunction, bReset) ucrNudTRPercentile.SetRCode(clsTRWetSpellFunction, bReset) ucrReceiverRainfall.SetRCode(clsRainRollingSumFunction, bReset) - - 'Rain Days - ucrChkNumberOfRainyDays.SetRCode(clsCombinedList, bReset) - ucrNudRDOutOfDays.SetRCode(clsRainDayRollingSumFunction, bReset) - - 'DrySpell - ucrChkDrySpell.SetRCode(clsCombinedList, bReset) - ucrNudDSLengthOfTime.SetRCode(clsDrySpellPeriodRollMaxFunction, bReset) - - 'DryPeriod - ucrChkDryPeriod.SetRCode(clsCombinedList, bReset) - ucrNudDPRainPeriod.SetRCode(clsRollingSumRainDryPeriodFunction, bReset) - ucrNudDPMaxRain.SetRCode(clsSumRainDryPeriodOperator, bReset) - ucrNudDPOverallInterval.SetRCode(clsSumRainDryPeriodIntervalMinusOperator, bReset) - - ' Combine - ucrNudRDMinimumDays.SetRCode(clsRollingSumRainDayOperator, bReset) - ucrNudDSMaximumDays.SetRCode(clsDSCombineOperator, bReset) ucrNudTRAmount.SetRCode(clsTRCombineOperator, bReset) + + 'Evaporation + ucrReceiverEvap.SetRCode(clsEvapOperator, bReset) + ucrNudEvapo.SetRCode(clsEvapOperator, bReset) + AdditionalCondition() End Sub Private Sub TestOKEnabled() @@ -832,25 +837,16 @@ Public Class dlgStartofRains Not ucrReceiverDOY.IsEmpty AndAlso Not ucrReceiverYear.IsEmpty AndAlso ucrInputThreshold.GetText <> "" AndAlso - ( - (ucrChkNumberOfRainyDays.Checked AndAlso ucrNudRDMinimumDays.GetText <> "" AndAlso ucrNudRDOutOfDays.GetText <> "") OrElse - Not ucrChkNumberOfRainyDays.Checked) AndAlso ( ( (ucrChkTotalRainfall.Checked AndAlso ucrNudTROverDays.GetText <> "") AndAlso - ((rdoTRAmount.Checked AndAlso ucrNudTRAmount.GetText <> "") OrElse (rdoTRPercentile.Checked AndAlso ucrNudTRPercentile.GetText <> ""))) OrElse - Not ucrChkTotalRainfall.Checked) AndAlso - ( - (ucrChkDrySpell.Checked AndAlso ucrNudDSMaximumDays.GetText <> "" AndAlso ucrNudDSLengthOfTime.GetText <> "") OrElse - Not ucrChkDrySpell.Checked) AndAlso - ( - (ucrChkDryPeriod.Checked AndAlso ucrNudDPMaxRain.GetText <> "" AndAlso ucrNudDPRainPeriod.GetText <> "" AndAlso ucrNudDPOverallInterval.GetText <> "") OrElse - Not ucrChkDryPeriod.Checked) Then + ((rdoTRAmount.Checked AndAlso ucrNudTRAmount.GetText <> "") OrElse (rdoTRPercentile.Checked AndAlso ucrNudTRPercentile.GetText <> "") OrElse (rdoEvapo.Checked AndAlso Not ucrReceiverEvap.IsEmpty AndAlso ucrNudTRPercentile.GetText <> ""))) OrElse + Not ucrChkTotalRainfall.Checked) Then bOkEnabled = True Else bOkEnabled = False End If - If Not (ucrChkTotalRainfall.Checked OrElse ucrChkNumberOfRainyDays.Checked OrElse ucrChkDrySpell.Checked OrElse ucrChkDryPeriod.Checked) Then + If Not ucrChkTotalRainfall.Checked Then bOkEnabled = False End If If Not (ucrChkAsDoy.Checked OrElse ucrChkAsDate.Checked OrElse ucrChkStatus.Checked) Then @@ -886,21 +882,43 @@ Public Class dlgStartofRains End Sub Private Sub CombinedFilter() - If ucrChkTotalRainfall.Checked Then If rdoTRAmount.Checked Then + clsTRCombineOperator.RemoveParameterByName("evap") clsCombinedList.RemoveParameterByName("tr_perc_sub") clsTRCombineOperator.RemoveParameterByName("tr_perc") + clsCombinedList.RemoveParameterByName("evap_frac") clsTRCombineOperator.AddParameter("tr_amount", ucrNudTRAmount.Value, bIncludeArgumentName:=False, iPosition:=1) - Else + ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsFractionEvapFunction) + ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsSumEvapFunction) + ElseIf rdoTRPercentile.Checked Then + clsTRCombineOperator.RemoveParameterByName("evap") clsTRCombineOperator.RemoveParameterByName("tr_amount") + clsCombinedList.RemoveParameterByName("evap_frac") clsCombinedList.AddParameter("tr_perc_sub", clsRFunctionParameter:=clsTRWetSpell, bIncludeArgumentName:=False) clsTRCombineOperator.AddParameter("tr_perc", strParameterValue:=strWetSpell, iPosition:=1) + ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsFractionEvapFunction) + ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsSumEvapFunction) + Else + clsCombinedList.RemoveParameterByName("tr_perc_sub") + clsTRCombineOperator.RemoveParameterByName("tr_perc_sub") + clsTRCombineOperator.RemoveParameterByName("tr_amount") + clsCombinedList.AddParameter("evap_frac", strSumFractionEvap, bIncludeArgumentName:=False, iPosition:=1) + clsTRCombineOperator.AddParameter("evap", strParameterValue:=strSumFractionEvap, iPosition:=1, bIncludeArgumentName:=False) + If Not ucrReceiverEvap.IsEmpty Then + clsFractionEvapFunction.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverEvap.GetVariableNames & ")", iPosition:=3) + Else + clsFractionEvapFunction.RemoveParameterByName("calculated_from") + End If + ucrBase.clsRsyntax.AddToBeforeCodes(clsFractionEvapFunction, iPosition:=2) + ucrBase.clsRsyntax.AddToBeforeCodes(clsSumEvapFunction, iPosition:=3) End If Else clsTRCombineOperator.RemoveParameterByName("tr_amount") clsCombinedList.RemoveParameterByName("tr_perc_sub") + clsCombinedList.RemoveParameterByName("evap_frac") clsTRCombineOperator.RemoveParameterByName("tr_perc") + clsTRCombineOperator.RemoveParameterByName("evap") End If End Sub @@ -950,8 +968,9 @@ Public Class dlgStartofRains clsCalcRainRollingSumDryPeriod.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverRainfall.GetVariableNames & ")", iPosition:=3) End Sub - Private Sub ucrChkTotalRainfall_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkTotalRainfall.ControlValueChanged, ucrPnlTRCalculateBy.ControlValueChanged, ucrNudTRAmount.ControlValueChanged + Private Sub ucrChkTotalRainfall_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkTotalRainfall.ControlValueChanged, ucrPnlTRCalculateBy.ControlValueChanged, ucrNudTRAmount.ControlValueChanged, ucrNudEvapo.ControlValueChanged, ucrReceiverEvap.ControlValueChanged CombinedFilter() + SetReceiver() If ucrChkTotalRainfall.Checked Then clsIsNaOperatorStartDOY.AddParameter("1", clsRFunctionParameter:=clsIsNaFirstRollSumRain, iPosition:=1) clsConditionsOrOverallOperator.AddParameter("is.na_roll_sum_rain", clsRFunctionParameter:=clsIsNaRollSumRain, iPosition:=2) @@ -969,6 +988,7 @@ Public Class dlgStartofRains DryPeriod() GroupByStationOptions() GroupByYearOptions() + CombinedFilter() End Sub Private Sub ucrReceiverDOY_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverDOY.ControlValueChanged, ucrSelectorForStartofRains.ControlValueChanged @@ -988,34 +1008,16 @@ Public Class dlgStartofRains Private Sub ucrReceiverStation_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverStation.ControlValueChanged GroupByStationOptions() - ConvertYearType() End Sub Private Sub ucrReceiverYear_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverYear.ControlValueChanged GroupByYearOptions() End Sub - Private Sub MaximumValuesControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrChkDryPeriod.ControlContentsChanged, ucrNudDPRainPeriod.ControlContentsChanged, ucrNudDPOverallInterval.ControlContentsChanged - If ucrChkDryPeriod.Checked Then - ucrNudDPRainPeriod.Maximum = ucrNudDPOverallInterval.Value - ucrNudDPOverallInterval.Minimum = ucrNudDPRainPeriod.Value - End If - TestOKEnabled() - End Sub - - Private Sub ConvertYearType() - If Not ucrReceiverStation.IsEmpty Then - clsConvertColumnType2Function.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & "_by_station_year" & Chr(34), iPosition:=0) - Else - clsConvertColumnType2Function.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & "_by_year" & Chr(34), iPosition:=0) - End If - End Sub - Private Sub ucrSelectorForStartofRains_DataFrameChanged() Handles ucrSelectorForStartofRains.DataFrameChanged clsGetColumnDataTypeFunction.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) clsConvertColumnTypeFunction.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) clsConvertColumnType1Function.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) - ConvertYearType() clsDayFilterCalcFromList.ClearParameters() End Sub @@ -1058,37 +1060,74 @@ Public Class dlgStartofRains End If End Sub - Private Sub CoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverRainfall.ControlContentsChanged, ucrInputNewDoyColumnName.ControlContentsChanged, ucrReceiverDate.ControlContentsChanged, ucrReceiverDOY.ControlContentsChanged, ucrReceiverYear.ControlContentsChanged, ucrInputThreshold.ControlContentsChanged, ucrChkNumberOfRainyDays.ControlContentsChanged, ucrNudRDMinimumDays.ControlContentsChanged, ucrNudRDOutOfDays.ControlContentsChanged, ucrChkTotalRainfall.ControlContentsChanged, ucrNudTROverDays.ControlContentsChanged, ucrPnlTRCalculateBy.ControlContentsChanged, ucrNudTRAmount.ControlContentsChanged, ucrNudTRPercentile.ControlContentsChanged, ucrChkDrySpell.ControlContentsChanged, ucrNudDSMaximumDays.ControlContentsChanged, ucrNudDSLengthOfTime.ControlContentsChanged, ucrNudDPMaxRain.ControlContentsChanged, ucrChkAsDoy.ControlContentsChanged, ucrChkAsDate.ControlContentsChanged, ucrInputNewDateColumnName.ControlContentsChanged, ucrChkStatus.ControlContentsChanged, ucrInputNewStatusColumnName.ControlContentsChanged + Private Sub CoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverRainfall.ControlContentsChanged, ucrInputNewDoyColumnName.ControlContentsChanged, ucrReceiverDate.ControlContentsChanged, ucrReceiverDOY.ControlContentsChanged, ucrReceiverYear.ControlContentsChanged, ucrInputThreshold.ControlContentsChanged, ucrChkTotalRainfall.ControlContentsChanged, ucrNudTROverDays.ControlContentsChanged, ucrPnlTRCalculateBy.ControlContentsChanged, ucrNudTRAmount.ControlContentsChanged, ucrNudTRPercentile.ControlContentsChanged, ucrChkAsDoy.ControlContentsChanged, ucrChkAsDate.ControlContentsChanged, ucrInputNewDateColumnName.ControlContentsChanged, ucrChkStatus.ControlContentsChanged, ucrInputNewStatusColumnName.ControlContentsChanged, ucrNudEvapo.ControlContentsChanged, ucrReceiverEvap.ControlContentsChanged TestOKEnabled() End Sub - Private Sub ucrChkNumberOfRainyDays_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkNumberOfRainyDays.ControlValueChanged - If ucrChkNumberOfRainyDays.Checked Then - clsIsNaOperatorStartDOY.AddParameter("2", clsRFunctionParameter:=clsIsNaFirstRollSumRainDay, iPosition:=2) - clsConditionsOrOverallOperator.AddParameter("is.na_roll_sum_rain_day", clsRFunctionParameter:=clsIsNaRollSumRainDay, iPosition:=3) + Private Sub SetReceiver() + If rdoEvapo.Checked Then + ucrReceiverEvap.SetMeAsReceiver() Else - clsIsNaOperatorStartDOY.RemoveParameterByName("2") - clsConditionsOrOverallOperator.RemoveParameterByName("is.na_roll_sum_rain_day") + ucrReceiverRainfall.SetMeAsReceiver() End If End Sub - Private Sub ucrChkDrySpell_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDrySpell.ControlValueChanged - If ucrChkDrySpell.Checked Then - clsIsNaOperatorStartDOY.AddParameter("3", clsRFunctionParameter:=clsIsNaFirstDrySpell, iPosition:=3) - clsConditionsOrOverallOperator.AddParameter("is.na_dry_spell", clsRFunctionParameter:=clsIsNaDrySpell, iPosition:=4) + Private Sub AdditionalCondition() + If ucrChkAdditional.Checked Then + cmdAdditionnal.Visible = True Else - clsIsNaOperatorStartDOY.RemoveParameterByName("3") - clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_spell") + cmdAdditionnal.Visible = False End If End Sub - Private Sub ucrChkDryPeriod_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDryPeriod.ControlValueChanged - If ucrChkDryPeriod.Checked Then - clsIsNaOperatorStartDOY.AddParameter("4", clsRFunctionParameter:=clsIsNaFirstDryPeriod, iPosition:=4) - clsConditionsOrOverallOperator.AddParameter("is.na_dry_period", clsRFunctionParameter:=clsIsNaDryPeriod, iPosition:=5) + Private Sub ucrChkAdditional_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAdditional.ControlValueChanged + AdditionalCondition() + End Sub + + Private Sub cmdAdditionnal_Click(sender As Object, e As EventArgs) Handles cmdAdditionnal.Click + sdgAdditionalCondition.SetRCode(clsNewCombinedList:=clsCombinedList, clsNewCalcDrySpellRollMax:=clsCalcDrySpellRollMax, clsNewIsNaFirstDryPeriod:=clsIsNaFirstDryPeriod, clsNewIsNaFirstDrySpell:=clsIsNaFirstDrySpell, clsNewIsNaDryPeriod:=clsIsNaDryPeriod, clsNewIsNaDrySpell:=clsIsNaDrySpell, clsNewRainDayRollingSumFunction:=clsRainDayRollingSumFunction, clsNewIsNaRollSumRainDay:=clsIsNaRollSumRainDay, clsNewIsNaFirstRollSumRainDay:=clsIsNaFirstRollSumRainDay, clsNewDrySpellPeriodRollMaxFunction:=clsDrySpellPeriodRollMaxFunction, clsNewRollingSumRainDryPeriodFunction:=clsRollingSumRainDryPeriodFunction, clsNewCalcRainDayRollingSum:=clsCalcRainDayRollingSum, clsNewCalcRollSumNumberDryPeriod:=clsCalcRollSumNumberDryPeriod, clsNewConditionsAndOperator:=clsConditionsAndOperator, clsNewIsNaOperatorStartDOY:=clsIsNaOperatorStartDOY, clsNewConditionsOrOverallOperator:=clsConditionsOrOverallOperator, clsNewRollingSumRainDayOperator:=clsRollingSumRainDayOperator, clsNewDSCombineOperator:=clsDSCombineOperator, clsNewSumRainDryPeriodIntervalMinusOperator:=clsSumRainDryPeriodIntervalMinusOperator, clsNewSumRainDryPeriodOperator:=clsSumRainDryPeriodOperator, clsNewDPCombineOperator:=clsDPCombineOperator, clsNewSumRainDryPeriodIntervalPlusOperator:=clsSumRainDryPeriodIntervalPlusOperator, bReset:=bResetSubdialog) + sdgAdditionalCondition.ShowDialog() + bResetSubdialog = False + ChangeDSValue() + End Sub + + Private Sub ChangeDSValue() + If Not sdgAdditionalCondition.ucrNudDSMaximumDays.IsEmpty Then + clsDSCombineOperator.AddParameter("ds_max", sdgAdditionalCondition.ucrNudDSMaximumDays.GetText(), iPosition:=1) + Else + clsDSCombineOperator.RemoveParameterByName("ds_max") + End If + If Not sdgAdditionalCondition.ucrNudRDMinimumDays.IsEmpty Then + clsRollingSumRainDayOperator.AddParameter("1", sdgAdditionalCondition.ucrNudRDMinimumDays.GetText(), iPosition:=1) + Else + clsRollingSumRainDayOperator.RemoveParameterByName("1") + End If + If Not sdgAdditionalCondition.ucrNudDPMaxRain.IsEmpty Then + clsSumRainDryPeriodOperator.AddParameter("right", sdgAdditionalCondition.ucrNudDPMaxRain.GetText(), iPosition:=1) + Else + clsSumRainDryPeriodOperator.RemoveParameterByName("right") + End If + If Not sdgAdditionalCondition.ucrNudDPRainPeriod.IsEmpty Then + clsRollingSumRainDryPeriodFunction.AddParameter("n", sdgAdditionalCondition.ucrNudDPRainPeriod.GetText(), iPosition:=1) + clsSumRainDryPeriodIntervalPlusOperator.AddParameter("n", sdgAdditionalCondition.ucrNudDPRainPeriod.GetText(), iPosition:=0) + Else + clsSumRainDryPeriodIntervalPlusOperator.RemoveParameterByName("n") + clsRollingSumRainDryPeriodFunction.RemoveParameterByName("n") + End If + If Not sdgAdditionalCondition.ucrNudDPOverallInterval.IsEmpty Then + clsSumRainDryPeriodIntervalMinusOperator.AddParameter("0", sdgAdditionalCondition.ucrNudDPOverallInterval.GetText(), iPosition:=0) + Else + clsSumRainDryPeriodIntervalMinusOperator.RemoveParameterByName("0") + End If + If Not sdgAdditionalCondition.ucrNudDSLengthOfTime.IsEmpty Then + clsDrySpellPeriodRollMaxFunction.AddParameter("n", sdgAdditionalCondition.ucrNudDSLengthOfTime.GetText(), iPosition:=0) + Else + clsDrySpellPeriodRollMaxFunction.RemoveParameterByName("n") + End If + If Not sdgAdditionalCondition.ucrNudRDOutOfDays.IsEmpty Then + clsRainDayRollingSumFunction.AddParameter("n", sdgAdditionalCondition.ucrNudRDOutOfDays.GetText(), iPosition:=1) Else - clsIsNaOperatorStartDOY.RemoveParameterByName("4") - clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_period") + clsRainDayRollingSumFunction.RemoveParameterByName("n") End If End Sub End Class From 54854f2a4f174e5cf6bd4a3c26f38e5744b13c3d Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Tue, 22 Oct 2024 10:47:29 +0100 Subject: [PATCH 04/11] Change made --- instat/dlgStartofRains.vb | 145 +++++++++++++++++++++++-------- instat/sdgAdditionalCondition.vb | 58 ++++++------- 2 files changed, 138 insertions(+), 65 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 516fbdcdc03..14932917b40 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -18,7 +18,7 @@ Imports instat.Translations Public Class dlgStartofRains Private bResetSubdialog As Boolean = True - Private clsCalcRainDay, clsCalcStartDOY, clsTailFunction, clsGetDataFrameFunction, clsListevapFunction, clsRollEvaporationFunction, clsFractionEvapFunction, clsSumEvapFunction, clsConvertColumnType1Function, clsConvertColumnType2Function, clsConvertColumnTypeFunction, clsGetColumnDataTypeFunction, clsDummyFunction, clsIfelseStatusFunction, clsIfelseStatus1Function, clsFirstStatusFunction, clsIsNAStatusFunction, clsCalcStartDate, clsCombinationCalc, clsListCalFunction, clsCombinationManipList, clsCombinationSubCalcList, clsListSubCalc, clsManipulationFirstDOYPerYear, clsConditionsFilter, clsCombinedList As New RFunction + Private clsCalcRainDay, clsCalcStartDOY, clsPaste0Function, clsGetDataFrameFunction, clsListevapFunction, clsRollEvaporationFunction, clsFractionEvapFunction, clsSumEvapFunction, clsConvertColumnType1Function, clsConvertColumnType2Function, clsConvertColumnTypeFunction, clsGetColumnDataTypeFunction, clsDummyFunction, clsIfelseStatusFunction, clsIfelseStatus1Function, clsFirstStatusFunction, clsIsNAStatusFunction, clsCalcStartDate, clsCombinationCalc, clsListCalFunction, clsCombinationManipList, clsCombinationSubCalcList, clsListSubCalc, clsManipulationFirstDOYPerYear, clsConditionsFilter, clsCombinedList As New RFunction Private clsDayFromAndTo, clsGroupByStation, clsGroupByYear, clsListToTalRain, clsApplyInstatFunction, clsFirstDOY, clsFirstDate As New RFunction Private clsDayFromAndToOperator, clsEvapOperator, clsDayFromOperator, clsDayToOperator, clsRainDayOperator, clsRainDayConditionOperator, clsConditionsAndOperator, clsTRCombineOperator, clsRollingSumRainDayOperator, clsDSCombineOperator, clsDPCombineOperator As New ROperator Private clsDayFilterCalcFromConvert, clsDayFilterCalcFromList As New RFunction @@ -60,7 +60,7 @@ Public Class dlgStartofRains Private clsIsNaDryPeriod As New RFunction 'Rainy Day classes - Private clsCalcRainDayRollingSum, clsRainDayRollingSumFunction, clsRDRollingRainDaysSub As New RFunction + Public clsCalcRainDayRollingSum, clsRainDayRollingSumFunction, clsRDRollingRainDaysSub As New RFunction 'Dry Spell classes Private clsCalcDrySpellRollMax, clsCalcDrySpell, clsDrySpellPeriodLeadFunction, clsDrySpellPeriodRollMaxFunction, clsDrySpellPeriodSubCalcList, clsDrySpellSubCalcList As New RFunction @@ -297,7 +297,7 @@ Public Class dlgStartofRains clsCalcRainRollingSum.Clear() clsRainRollingSumFunction = New RFunction - clsTailFunction = New RFunction + clsPaste0Function = New RFunction clsGetDataFrameFunction = New RFunction clsTRWetSpellList.Clear() clsTRWetSpell.Clear() @@ -559,7 +559,7 @@ Public Class dlgStartofRains clsRollEvaporationFunction.SetPackageName("RcppRoll") clsRollEvaporationFunction.SetRCommand("roll_sumr") clsRollEvaporationFunction.AddParameter("x", strFactionEvap, iPosition:=0) - clsRollEvaporationFunction.AddParameter("n", "2", iPosition:=1) + ' clsRollEvaporationFunction.AddParameter("n", "2", iPosition:=1) clsRollEvaporationFunction.AddParameter("fill", "NA", iPosition:=2) clsRollEvaporationFunction.AddParameter("na.rm", "FALSE", iPosition:=3) clsRollEvaporationFunction.bToScriptAsRString = True @@ -760,10 +760,13 @@ Public Class dlgStartofRains clsGetDataFrameFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_data_names") - clsTailFunction.SetRCommand("tail") - clsTailFunction.AddParameter("x", clsRFunctionParameter:=clsGetDataFrameFunction, iPosition:=0, bIncludeArgumentName:=False) - clsTailFunction.AddParameter("n", "1", iPosition:=1) - clsTailFunction.SetAssignTo("last_data_name") + clsPaste0Function.SetRCommand("paste0") + 'clsPaste0Function.AddParameter("x", clsRFunctionParameter:=clsGetDataFrameFunction, iPosition:=0, bIncludeArgumentName:=False) + clsPaste0Function.AddParameter("n", Chr(34) & "_by_" & Chr(34), iPosition:=1, bIncludeArgumentName:=False) + ' clsPaste0Function.AddParameter("z", "_", iPosition:=3, bIncludeArgumentName:=False) + clsPaste0Function.SetAssignTo("last_data_name") + + ' last_data_name <- paste0("dodoma", "_by_", "s_year", "_", "station") clsConvertColumnType2Function.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$convert_column_to_type") clsConvertColumnType2Function.AddParameter("data_name", "last_data_name", iPosition:=0) @@ -783,7 +786,7 @@ Public Class dlgStartofRains ucrBase.clsRsyntax.SetBaseRFunction(clsApplyInstatFunction) ucrBase.clsRsyntax.AddToBeforeCodes(clsGetColumnDataTypeFunction, iPosition:=0) ucrBase.clsRsyntax.AddToBeforeCodes(clsConvertColumnTypeFunction, iPosition:=1) - ucrBase.clsRsyntax.AddToAfterCodes(clsTailFunction, iPosition:=0) + ucrBase.clsRsyntax.AddToAfterCodes(clsPaste0Function, iPosition:=0) ucrBase.clsRsyntax.AddToAfterCodes(clsConvertColumnType1Function, iPosition:=1) ucrBase.clsRsyntax.AddToAfterCodes(clsConvertColumnType2Function, iPosition:=2) SetReceiver() @@ -802,6 +805,7 @@ Public Class dlgStartofRains ucrReceiverRainfall.AddAdditionalCodeParameterPair(clsIsNaRain, New RParameter("x", 0), iAdditionalPairNo:=5) ucrInputThreshold.AddAdditionalCodeParameterPair(clsRainDayConditionOperator, New RParameter("threshold", 1), iAdditionalPairNo:=1) ucrInputNewDoyColumnName.AddAdditionalCodeParameterPair(clsCalcStartDOY, New RParameter("result_name", 3), iAdditionalPairNo:=1) + ucrNudTROverDays.AddAdditionalCodeParameterPair(clsRollEvaporationFunction, New RParameter("n", 1), iAdditionalPairNo:=1) ucrReceiverDOY.SetRCode(clsDayToOperator, bReset) ucrChkAsDoy.SetRCode(clsCombinationSubCalcList, bReset) @@ -1008,16 +1012,19 @@ Public Class dlgStartofRains Private Sub ucrReceiverStation_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverStation.ControlValueChanged GroupByStationOptions() + StationVariable() End Sub Private Sub ucrReceiverYear_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverYear.ControlValueChanged GroupByYearOptions() + YearVariable() End Sub Private Sub ucrSelectorForStartofRains_DataFrameChanged() Handles ucrSelectorForStartofRains.DataFrameChanged clsGetColumnDataTypeFunction.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) clsConvertColumnTypeFunction.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) clsConvertColumnType1Function.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + clsPaste0Function.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0, bIncludeArgumentName:=False) clsDayFilterCalcFromList.ClearParameters() End Sub @@ -1082,6 +1089,7 @@ Public Class dlgStartofRains Private Sub ucrChkAdditional_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAdditional.ControlValueChanged AdditionalCondition() + ChangeDSValue() End Sub Private Sub cmdAdditionnal_Click(sender As Object, e As EventArgs) Handles cmdAdditionnal.Click @@ -1089,45 +1097,110 @@ Public Class dlgStartofRains sdgAdditionalCondition.ShowDialog() bResetSubdialog = False ChangeDSValue() + AdditionalCondition() End Sub Private Sub ChangeDSValue() - If Not sdgAdditionalCondition.ucrNudDSMaximumDays.IsEmpty Then - clsDSCombineOperator.AddParameter("ds_max", sdgAdditionalCondition.ucrNudDSMaximumDays.GetText(), iPosition:=1) - Else - clsDSCombineOperator.RemoveParameterByName("ds_max") - End If - If Not sdgAdditionalCondition.ucrNudRDMinimumDays.IsEmpty Then - clsRollingSumRainDayOperator.AddParameter("1", sdgAdditionalCondition.ucrNudRDMinimumDays.GetText(), iPosition:=1) - Else - clsRollingSumRainDayOperator.RemoveParameterByName("1") - End If - If Not sdgAdditionalCondition.ucrNudDPMaxRain.IsEmpty Then - clsSumRainDryPeriodOperator.AddParameter("right", sdgAdditionalCondition.ucrNudDPMaxRain.GetText(), iPosition:=1) + If ucrChkAdditional.Checked Then + If sdgAdditionalCondition.ucrChkNumberOfRainyDays.Checked Then + clsIsNaOperatorStartDOY.AddParameter("2", clsRFunctionParameter:=clsIsNaFirstRollSumRainDay, iPosition:=2) + clsConditionsOrOverallOperator.AddParameter("is.na_roll_sum_rain_day", clsRFunctionParameter:=clsIsNaRollSumRainDay, iPosition:=3) + Else + clsIsNaOperatorStartDOY.RemoveParameterByName("2") + clsConditionsOrOverallOperator.RemoveParameterByName("is.na_roll_sum_rain_day") + End If + If sdgAdditionalCondition.ucrChkDrySpell.Checked Then + clsIsNaOperatorStartDOY.AddParameter("3", clsRFunctionParameter:=clsIsNaFirstDrySpell, iPosition:=3) + clsConditionsOrOverallOperator.AddParameter("is.na_dry_spell", clsRFunctionParameter:=clsIsNaDrySpell, iPosition:=4) + Else + clsIsNaOperatorStartDOY.RemoveParameterByName("3") + clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_spell") + End If + If sdgAdditionalCondition.ucrChkDryPeriod.Checked Then + clsIsNaOperatorStartDOY.AddParameter("4", clsRFunctionParameter:=clsIsNaFirstDryPeriod, iPosition:=4) + clsConditionsOrOverallOperator.AddParameter("is.na_dry_period", clsRFunctionParameter:=clsIsNaDryPeriod, iPosition:=5) + Else + clsIsNaOperatorStartDOY.RemoveParameterByName("4") + clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_period") + End If + If Not sdgAdditionalCondition.ucrNudDSMaximumDays.IsEmpty Then + clsDSCombineOperator.AddParameter("ds_max", sdgAdditionalCondition.ucrNudDSMaximumDays.GetText(), iPosition:=1) + Else + clsDSCombineOperator.RemoveParameterByName("ds_max") + End If + If Not sdgAdditionalCondition.ucrNudRDMinimumDays.IsEmpty Then + clsRollingSumRainDayOperator.AddParameter("1", sdgAdditionalCondition.ucrNudRDMinimumDays.GetText(), iPosition:=1) + Else + clsRollingSumRainDayOperator.RemoveParameterByName("1") + End If + If Not sdgAdditionalCondition.ucrNudDPMaxRain.IsEmpty Then + clsSumRainDryPeriodOperator.AddParameter("right", sdgAdditionalCondition.ucrNudDPMaxRain.GetText(), iPosition:=1) + Else + clsSumRainDryPeriodOperator.RemoveParameterByName("right") + End If + If Not sdgAdditionalCondition.ucrNudDPRainPeriod.IsEmpty Then + clsRollingSumRainDryPeriodFunction.AddParameter("n", sdgAdditionalCondition.ucrNudDPRainPeriod.GetText(), iPosition:=1) + clsSumRainDryPeriodIntervalPlusOperator.AddParameter("n", sdgAdditionalCondition.ucrNudDPRainPeriod.GetText(), iPosition:=0) + Else + clsSumRainDryPeriodIntervalPlusOperator.RemoveParameterByName("n") + clsRollingSumRainDryPeriodFunction.RemoveParameterByName("n") + End If + If Not sdgAdditionalCondition.ucrNudDPOverallInterval.IsEmpty Then + clsSumRainDryPeriodIntervalMinusOperator.AddParameter("0", sdgAdditionalCondition.ucrNudDPOverallInterval.GetText(), iPosition:=0) + Else + clsSumRainDryPeriodIntervalMinusOperator.RemoveParameterByName("0") + End If + If Not sdgAdditionalCondition.ucrNudDSLengthOfTime.IsEmpty Then + clsDrySpellPeriodRollMaxFunction.AddParameter("n", sdgAdditionalCondition.ucrNudDSLengthOfTime.GetText(), iPosition:=0) + Else + clsDrySpellPeriodRollMaxFunction.RemoveParameterByName("n") + End If + If Not sdgAdditionalCondition.ucrNudRDOutOfDays.IsEmpty Then + clsRainDayRollingSumFunction.AddParameter("n", sdgAdditionalCondition.ucrNudRDOutOfDays.GetText(), iPosition:=1) + Else + clsRainDayRollingSumFunction.RemoveParameterByName("n") + End If Else + ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRainDay) + ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRainDayRollingSum) + ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRainRollingSumDryPeriod) + ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRollSumNumberDryPeriod) + ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcDrySpell) + ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcDrySpellRollMax) + + clsIsNaOperatorStartDOY.RemoveParameterByName("4") + clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_period") + clsIsNaOperatorStartDOY.RemoveParameterByName("3") + clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_spell") + clsIsNaOperatorStartDOY.RemoveParameterByName("2") + clsConditionsOrOverallOperator.RemoveParameterByName("is.na_roll_sum_rain_day") + + clsRainDayRollingSumFunction.RemoveParameterByName("n") + clsDrySpellPeriodRollMaxFunction.RemoveParameterByName("n") clsSumRainDryPeriodOperator.RemoveParameterByName("right") - End If - If Not sdgAdditionalCondition.ucrNudDPRainPeriod.IsEmpty Then - clsRollingSumRainDryPeriodFunction.AddParameter("n", sdgAdditionalCondition.ucrNudDPRainPeriod.GetText(), iPosition:=1) - clsSumRainDryPeriodIntervalPlusOperator.AddParameter("n", sdgAdditionalCondition.ucrNudDPRainPeriod.GetText(), iPosition:=0) - Else + clsRollingSumRainDayOperator.RemoveParameterByName("1") + clsDSCombineOperator.RemoveParameterByName("ds_max") clsSumRainDryPeriodIntervalPlusOperator.RemoveParameterByName("n") clsRollingSumRainDryPeriodFunction.RemoveParameterByName("n") - End If - If Not sdgAdditionalCondition.ucrNudDPOverallInterval.IsEmpty Then - clsSumRainDryPeriodIntervalMinusOperator.AddParameter("0", sdgAdditionalCondition.ucrNudDPOverallInterval.GetText(), iPosition:=0) - Else clsSumRainDryPeriodIntervalMinusOperator.RemoveParameterByName("0") End If - If Not sdgAdditionalCondition.ucrNudDSLengthOfTime.IsEmpty Then - clsDrySpellPeriodRollMaxFunction.AddParameter("n", sdgAdditionalCondition.ucrNudDSLengthOfTime.GetText(), iPosition:=0) + End Sub + + Private Sub StationVariable() + If Not ucrReceiverStation.IsEmpty Then + clsPaste0Function.AddParameter("z", Chr(34) & "_" & Chr(34), iPosition:=3, bIncludeArgumentName:=False) + clsPaste0Function.AddParameter("x", ucrReceiverStation.GetVariableNames(), iPosition:=2, bIncludeArgumentName:=False) Else - clsDrySpellPeriodRollMaxFunction.RemoveParameterByName("n") + clsPaste0Function.RemoveParameterByName("x") + clsPaste0Function.RemoveParameterByName("z") End If - If Not sdgAdditionalCondition.ucrNudRDOutOfDays.IsEmpty Then - clsRainDayRollingSumFunction.AddParameter("n", sdgAdditionalCondition.ucrNudRDOutOfDays.GetText(), iPosition:=1) + End Sub + + Private Sub YearVariable() + If Not ucrReceiverYear.IsEmpty Then + clsPaste0Function.AddParameter("y", ucrReceiverYear.GetVariableNames(), iPosition:=4, bIncludeArgumentName:=False) Else - clsRainDayRollingSumFunction.RemoveParameterByName("n") + clsPaste0Function.RemoveParameterByName("y") End If End Sub End Class diff --git a/instat/sdgAdditionalCondition.vb b/instat/sdgAdditionalCondition.vb index 69fea212509..17f34d4b023 100644 --- a/instat/sdgAdditionalCondition.vb +++ b/instat/sdgAdditionalCondition.vb @@ -115,35 +115,35 @@ Public Class sdgAdditionalCondition ucrChkDrySpell.SetRCode(clsCombinedList, bReset, bCloneIfNeeded:=True) End Sub - Private Sub ucrChkNumberOfRainyDays_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkNumberOfRainyDays.ControlValueChanged - If ucrChkNumberOfRainyDays.Checked Then - clsIsNaOperatorStartDOY.AddParameter("2", clsRFunctionParameter:=clsIsNaFirstRollSumRainDay, iPosition:=2) - clsConditionsOrOverallOperator.AddParameter("is.na_roll_sum_rain_day", clsRFunctionParameter:=clsIsNaRollSumRainDay, iPosition:=3) - Else - clsIsNaOperatorStartDOY.RemoveParameterByName("2") - clsConditionsOrOverallOperator.RemoveParameterByName("is.na_roll_sum_rain_day") - End If - End Sub - - Private Sub ucrChkDrySpell_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDrySpell.ControlValueChanged - If ucrChkDrySpell.Checked Then - clsIsNaOperatorStartDOY.AddParameter("3", clsRFunctionParameter:=clsIsNaFirstDrySpell, iPosition:=3) - clsConditionsOrOverallOperator.AddParameter("is.na_dry_spell", clsRFunctionParameter:=clsIsNaDrySpell, iPosition:=4) - Else - clsIsNaOperatorStartDOY.RemoveParameterByName("3") - clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_spell") - End If - End Sub - - Private Sub ucrChkDryPeriod_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDryPeriod.ControlValueChanged - If ucrChkDryPeriod.Checked Then - clsIsNaOperatorStartDOY.AddParameter("4", clsRFunctionParameter:=clsIsNaFirstDryPeriod, iPosition:=4) - clsConditionsOrOverallOperator.AddParameter("is.na_dry_period", clsRFunctionParameter:=clsIsNaDryPeriod, iPosition:=5) - Else - clsIsNaOperatorStartDOY.RemoveParameterByName("4") - clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_period") - End If - End Sub + 'Private Sub ucrChkNumberOfRainyDays_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkNumberOfRainyDays.ControlValueChanged + ' If ucrChkNumberOfRainyDays.Checked Then + ' clsIsNaOperatorStartDOY.AddParameter("2", clsRFunctionParameter:=clsIsNaFirstRollSumRainDay, iPosition:=2) + ' clsConditionsOrOverallOperator.AddParameter("is.na_roll_sum_rain_day", clsRFunctionParameter:=clsIsNaRollSumRainDay, iPosition:=3) + ' Else + ' clsIsNaOperatorStartDOY.RemoveParameterByName("2") + ' clsConditionsOrOverallOperator.RemoveParameterByName("is.na_roll_sum_rain_day") + ' End If + 'End Sub + + 'Private Sub ucrChkDrySpell_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDrySpell.ControlValueChanged + ' If ucrChkDrySpell.Checked Then + ' clsIsNaOperatorStartDOY.AddParameter("3", clsRFunctionParameter:=clsIsNaFirstDrySpell, iPosition:=3) + ' clsConditionsOrOverallOperator.AddParameter("is.na_dry_spell", clsRFunctionParameter:=clsIsNaDrySpell, iPosition:=4) + ' Else + ' clsIsNaOperatorStartDOY.RemoveParameterByName("3") + ' clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_spell") + ' End If + 'End Sub + + 'Private Sub ucrChkDryPeriod_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDryPeriod.ControlValueChanged + ' If ucrChkDryPeriod.Checked Then + ' clsIsNaOperatorStartDOY.AddParameter("4", clsRFunctionParameter:=clsIsNaFirstDryPeriod, iPosition:=4) + ' clsConditionsOrOverallOperator.AddParameter("is.na_dry_period", clsRFunctionParameter:=clsIsNaDryPeriod, iPosition:=5) + ' Else + ' clsIsNaOperatorStartDOY.RemoveParameterByName("4") + ' clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_period") + ' End If + 'End Sub Private Sub MaximumValuesControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrChkDryPeriod.ControlContentsChanged, ucrNudDPRainPeriod.ControlContentsChanged, ucrNudDPOverallInterval.ControlContentsChanged If ucrChkDryPeriod.Checked Then From fbeae0d68c2b1be6443c92f5e4b7433a9e84504a Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Tue, 22 Oct 2024 13:35:24 +0100 Subject: [PATCH 05/11] Change made --- instat/dlgStartofRains.vb | 26 +++++++++---- instat/sdgAdditionalCondition.vb | 63 ++++++++++++++++---------------- 2 files changed, 50 insertions(+), 39 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 14932917b40..a45b4f2412f 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -1093,10 +1093,9 @@ Public Class dlgStartofRains End Sub Private Sub cmdAdditionnal_Click(sender As Object, e As EventArgs) Handles cmdAdditionnal.Click - sdgAdditionalCondition.SetRCode(clsNewCombinedList:=clsCombinedList, clsNewCalcDrySpellRollMax:=clsCalcDrySpellRollMax, clsNewIsNaFirstDryPeriod:=clsIsNaFirstDryPeriod, clsNewIsNaFirstDrySpell:=clsIsNaFirstDrySpell, clsNewIsNaDryPeriod:=clsIsNaDryPeriod, clsNewIsNaDrySpell:=clsIsNaDrySpell, clsNewRainDayRollingSumFunction:=clsRainDayRollingSumFunction, clsNewIsNaRollSumRainDay:=clsIsNaRollSumRainDay, clsNewIsNaFirstRollSumRainDay:=clsIsNaFirstRollSumRainDay, clsNewDrySpellPeriodRollMaxFunction:=clsDrySpellPeriodRollMaxFunction, clsNewRollingSumRainDryPeriodFunction:=clsRollingSumRainDryPeriodFunction, clsNewCalcRainDayRollingSum:=clsCalcRainDayRollingSum, clsNewCalcRollSumNumberDryPeriod:=clsCalcRollSumNumberDryPeriod, clsNewConditionsAndOperator:=clsConditionsAndOperator, clsNewIsNaOperatorStartDOY:=clsIsNaOperatorStartDOY, clsNewConditionsOrOverallOperator:=clsConditionsOrOverallOperator, clsNewRollingSumRainDayOperator:=clsRollingSumRainDayOperator, clsNewDSCombineOperator:=clsDSCombineOperator, clsNewSumRainDryPeriodIntervalMinusOperator:=clsSumRainDryPeriodIntervalMinusOperator, clsNewSumRainDryPeriodOperator:=clsSumRainDryPeriodOperator, clsNewDPCombineOperator:=clsDPCombineOperator, clsNewSumRainDryPeriodIntervalPlusOperator:=clsSumRainDryPeriodIntervalPlusOperator, bReset:=bResetSubdialog) + sdgAdditionalCondition.SetRCode(clsNewCombinedList:=clsCombinedList, clsNewCalcRainDay:=clsCalcRainDay, clsNewCalcDrySpellRollMax:=clsCalcDrySpellRollMax, clsNewIsNaFirstDryPeriod:=clsIsNaFirstDryPeriod, clsNewIsNaFirstDrySpell:=clsIsNaFirstDrySpell, clsNewIsNaDryPeriod:=clsIsNaDryPeriod, clsNewIsNaDrySpell:=clsIsNaDrySpell, clsNewRainDayRollingSumFunction:=clsRainDayRollingSumFunction, clsNewIsNaRollSumRainDay:=clsIsNaRollSumRainDay, clsNewIsNaFirstRollSumRainDay:=clsIsNaFirstRollSumRainDay, clsNewDrySpellPeriodRollMaxFunction:=clsDrySpellPeriodRollMaxFunction, clsNewRollingSumRainDryPeriodFunction:=clsRollingSumRainDryPeriodFunction, clsNewCalcRainDayRollingSum:=clsCalcRainDayRollingSum, clsNewCalcRollSumNumberDryPeriod:=clsCalcRollSumNumberDryPeriod, clsNewConditionsAndOperator:=clsConditionsAndOperator, clsNewIsNaOperatorStartDOY:=clsIsNaOperatorStartDOY, clsNewConditionsOrOverallOperator:=clsConditionsOrOverallOperator, clsNewRollingSumRainDayOperator:=clsRollingSumRainDayOperator, clsNewDSCombineOperator:=clsDSCombineOperator, clsNewSumRainDryPeriodIntervalMinusOperator:=clsSumRainDryPeriodIntervalMinusOperator, clsNewSumRainDryPeriodOperator:=clsSumRainDryPeriodOperator, clsNewDPCombineOperator:=clsDPCombineOperator, clsNewSumRainDryPeriodIntervalPlusOperator:=clsSumRainDryPeriodIntervalPlusOperator, bReset:=bResetSubdialog) sdgAdditionalCondition.ShowDialog() bResetSubdialog = False - ChangeDSValue() AdditionalCondition() End Sub @@ -1105,21 +1104,29 @@ Public Class dlgStartofRains If sdgAdditionalCondition.ucrChkNumberOfRainyDays.Checked Then clsIsNaOperatorStartDOY.AddParameter("2", clsRFunctionParameter:=clsIsNaFirstRollSumRainDay, iPosition:=2) clsConditionsOrOverallOperator.AddParameter("is.na_roll_sum_rain_day", clsRFunctionParameter:=clsIsNaRollSumRainDay, iPosition:=3) + 'ucrBase.clsRsyntax.AddToBeforeCodes(clsCalcRainDay, iPosition:=2) + 'ucrBase.clsRsyntax.AddToBeforeCodes(clsCalcRainDayRollingSum, iPosition:=3) + clsCombinedList.AddParameter("rd_sub", clsRFunctionParameter:=clsCalcRainDayRollingSum, bIncludeArgumentName:=False, iPosition:=1) Else + clsCombinedList.RemoveParameterByName("rd_sub") clsIsNaOperatorStartDOY.RemoveParameterByName("2") clsConditionsOrOverallOperator.RemoveParameterByName("is.na_roll_sum_rain_day") End If If sdgAdditionalCondition.ucrChkDrySpell.Checked Then clsIsNaOperatorStartDOY.AddParameter("3", clsRFunctionParameter:=clsIsNaFirstDrySpell, iPosition:=3) clsConditionsOrOverallOperator.AddParameter("is.na_dry_spell", clsRFunctionParameter:=clsIsNaDrySpell, iPosition:=4) + clsCombinedList.AddParameter("ds_sub", clsRFunctionParameter:=clsCalcDrySpellRollMax, iPosition:=2, bIncludeArgumentName:=False) Else + clsCombinedList.RemoveParameterByName("ds_sub") clsIsNaOperatorStartDOY.RemoveParameterByName("3") clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_spell") End If If sdgAdditionalCondition.ucrChkDryPeriod.Checked Then clsIsNaOperatorStartDOY.AddParameter("4", clsRFunctionParameter:=clsIsNaFirstDryPeriod, iPosition:=4) clsConditionsOrOverallOperator.AddParameter("is.na_dry_period", clsRFunctionParameter:=clsIsNaDryPeriod, iPosition:=5) + clsCombinedList.AddParameter("dp_sub", clsRFunctionParameter:=clsCalcRollSumNumberDryPeriod, iPosition:=3, bIncludeArgumentName:=False) Else + clsCombinedList.RemoveParameterByName("dp_sub") clsIsNaOperatorStartDOY.RemoveParameterByName("4") clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_period") End If @@ -1161,12 +1168,15 @@ Public Class dlgStartofRains clsRainDayRollingSumFunction.RemoveParameterByName("n") End If Else - ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRainDay) - ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRainDayRollingSum) - ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRainRollingSumDryPeriod) - ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRollSumNumberDryPeriod) - ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcDrySpell) - ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcDrySpellRollMax) + clsCombinedList.RemoveParameterByName("rd_sub") + clsCombinedList.RemoveParameterByName("ds_sub") + clsCombinedList.RemoveParameterByName("dp_sub") + 'ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRainDay) + 'ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRainDayRollingSum) + 'ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRainRollingSumDryPeriod) + 'ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRollSumNumberDryPeriod) + 'ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcDrySpell) + 'ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcDrySpellRollMax) clsIsNaOperatorStartDOY.RemoveParameterByName("4") clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_period") diff --git a/instat/sdgAdditionalCondition.vb b/instat/sdgAdditionalCondition.vb index 17f34d4b023..c100f4651f9 100644 --- a/instat/sdgAdditionalCondition.vb +++ b/instat/sdgAdditionalCondition.vb @@ -18,7 +18,7 @@ Imports instat.Translations Public Class sdgAdditionalCondition Public bFirstLoad As Boolean = True Public bControlsInitialised As Boolean = False - Private clsCombinedList, clsCalcDrySpellRollMax, clsIsNaFirstDryPeriod, clsIsNaFirstDrySpell, clsIsNaDryPeriod, clsIsNaDrySpell, clsRainDayRollingSumFunction, clsIsNaRollSumRainDay, clsIsNaFirstRollSumRainDay, clsDrySpellPeriodRollMaxFunction, clsRollingSumRainDryPeriodFunction, clsCalcRainDayRollingSum, clsCalcRollSumNumberDryPeriod As RFunction + Private clsCombinedList, clsCalcDrySpellRollMax, clsCalcRainDay, clsIsNaFirstDryPeriod, clsIsNaFirstDrySpell, clsIsNaDryPeriod, clsIsNaDrySpell, clsRainDayRollingSumFunction, clsIsNaRollSumRainDay, clsIsNaFirstRollSumRainDay, clsDrySpellPeriodRollMaxFunction, clsRollingSumRainDryPeriodFunction, clsCalcRainDayRollingSum, clsCalcRollSumNumberDryPeriod As RFunction Private clsConditionsAndOperator, clsIsNaOperatorStartDOY, clsConditionsOrOverallOperator, clsRollingSumRainDayOperator, clsDSCombineOperator, clsSumRainDryPeriodIntervalMinusOperator, clsSumRainDryPeriodOperator, clsDPCombineOperator, clsSumRainDryPeriodIntervalPlusOperator As ROperator Private Sub sdgAdditionalCondition_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -81,7 +81,7 @@ Public Class sdgAdditionalCondition ucrChkDryPeriod.AddToLinkedControls(ucrNudDPRainPeriod, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=30) End Sub - Public Sub SetRCode(clsNewCombinedList As RFunction, clsNewCalcDrySpellRollMax As RFunction, clsNewIsNaFirstDryPeriod As RFunction, clsNewIsNaFirstDrySpell As RFunction, clsNewIsNaDryPeriod As RFunction, clsNewIsNaDrySpell As RFunction, clsNewRainDayRollingSumFunction As RFunction, clsNewIsNaRollSumRainDay As RFunction, clsNewIsNaFirstRollSumRainDay As RFunction, clsNewDrySpellPeriodRollMaxFunction As RFunction, clsNewRollingSumRainDryPeriodFunction As RFunction, clsNewCalcRainDayRollingSum As RFunction, clsNewCalcRollSumNumberDryPeriod As RFunction, clsNewConditionsAndOperator As ROperator, clsNewIsNaOperatorStartDOY As ROperator, clsNewConditionsOrOverallOperator As ROperator, clsNewRollingSumRainDayOperator As ROperator, clsNewDSCombineOperator As ROperator, clsNewSumRainDryPeriodIntervalMinusOperator As ROperator, clsNewSumRainDryPeriodOperator As ROperator, clsNewDPCombineOperator As ROperator, clsNewSumRainDryPeriodIntervalPlusOperator As ROperator, Optional bReset As Boolean = False) + Public Sub SetRCode(clsNewCombinedList As RFunction, clsNewCalcDrySpellRollMax As RFunction, clsNewCalcRainDay As RFunction, clsNewIsNaFirstDryPeriod As RFunction, clsNewIsNaFirstDrySpell As RFunction, clsNewIsNaDryPeriod As RFunction, clsNewIsNaDrySpell As RFunction, clsNewRainDayRollingSumFunction As RFunction, clsNewIsNaRollSumRainDay As RFunction, clsNewIsNaFirstRollSumRainDay As RFunction, clsNewDrySpellPeriodRollMaxFunction As RFunction, clsNewRollingSumRainDryPeriodFunction As RFunction, clsNewCalcRainDayRollingSum As RFunction, clsNewCalcRollSumNumberDryPeriod As RFunction, clsNewConditionsAndOperator As ROperator, clsNewIsNaOperatorStartDOY As ROperator, clsNewConditionsOrOverallOperator As ROperator, clsNewRollingSumRainDayOperator As ROperator, clsNewDSCombineOperator As ROperator, clsNewSumRainDryPeriodIntervalMinusOperator As ROperator, clsNewSumRainDryPeriodOperator As ROperator, clsNewDPCombineOperator As ROperator, clsNewSumRainDryPeriodIntervalPlusOperator As ROperator, Optional bReset As Boolean = False) If Not bControlsInitialised Then InitialiseControls() End If @@ -92,6 +92,7 @@ Public Class sdgAdditionalCondition clsIsNaDryPeriod = clsNewIsNaDryPeriod clsIsNaDrySpell = clsNewIsNaDrySpell clsRainDayRollingSumFunction = clsNewRainDayRollingSumFunction + clsCalcRainDay = clsNewCalcRainDay clsIsNaRollSumRainDay = clsNewIsNaRollSumRainDay clsIsNaFirstRollSumRainDay = clsNewIsNaFirstRollSumRainDay clsDrySpellPeriodRollMaxFunction = clsNewDrySpellPeriodRollMaxFunction @@ -115,35 +116,35 @@ Public Class sdgAdditionalCondition ucrChkDrySpell.SetRCode(clsCombinedList, bReset, bCloneIfNeeded:=True) End Sub - 'Private Sub ucrChkNumberOfRainyDays_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkNumberOfRainyDays.ControlValueChanged - ' If ucrChkNumberOfRainyDays.Checked Then - ' clsIsNaOperatorStartDOY.AddParameter("2", clsRFunctionParameter:=clsIsNaFirstRollSumRainDay, iPosition:=2) - ' clsConditionsOrOverallOperator.AddParameter("is.na_roll_sum_rain_day", clsRFunctionParameter:=clsIsNaRollSumRainDay, iPosition:=3) - ' Else - ' clsIsNaOperatorStartDOY.RemoveParameterByName("2") - ' clsConditionsOrOverallOperator.RemoveParameterByName("is.na_roll_sum_rain_day") - ' End If - 'End Sub - - 'Private Sub ucrChkDrySpell_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDrySpell.ControlValueChanged - ' If ucrChkDrySpell.Checked Then - ' clsIsNaOperatorStartDOY.AddParameter("3", clsRFunctionParameter:=clsIsNaFirstDrySpell, iPosition:=3) - ' clsConditionsOrOverallOperator.AddParameter("is.na_dry_spell", clsRFunctionParameter:=clsIsNaDrySpell, iPosition:=4) - ' Else - ' clsIsNaOperatorStartDOY.RemoveParameterByName("3") - ' clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_spell") - ' End If - 'End Sub - - 'Private Sub ucrChkDryPeriod_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDryPeriod.ControlValueChanged - ' If ucrChkDryPeriod.Checked Then - ' clsIsNaOperatorStartDOY.AddParameter("4", clsRFunctionParameter:=clsIsNaFirstDryPeriod, iPosition:=4) - ' clsConditionsOrOverallOperator.AddParameter("is.na_dry_period", clsRFunctionParameter:=clsIsNaDryPeriod, iPosition:=5) - ' Else - ' clsIsNaOperatorStartDOY.RemoveParameterByName("4") - ' clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_period") - ' End If - 'End Sub + Private Sub ucrChkNumberOfRainyDays_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkNumberOfRainyDays.ControlValueChanged + If ucrChkNumberOfRainyDays.Checked Then + clsIsNaOperatorStartDOY.AddParameter("2", clsRFunctionParameter:=clsIsNaFirstRollSumRainDay, iPosition:=2) + clsConditionsOrOverallOperator.AddParameter("is.na_roll_sum_rain_day", clsRFunctionParameter:=clsIsNaRollSumRainDay, iPosition:=3) + Else + clsIsNaOperatorStartDOY.RemoveParameterByName("2") + clsConditionsOrOverallOperator.RemoveParameterByName("is.na_roll_sum_rain_day") + End If + End Sub + + Private Sub ucrChkDrySpell_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDrySpell.ControlValueChanged + If ucrChkDrySpell.Checked Then + clsIsNaOperatorStartDOY.AddParameter("3", clsRFunctionParameter:=clsIsNaFirstDrySpell, iPosition:=3) + clsConditionsOrOverallOperator.AddParameter("is.na_dry_spell", clsRFunctionParameter:=clsIsNaDrySpell, iPosition:=4) + Else + clsIsNaOperatorStartDOY.RemoveParameterByName("3") + clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_spell") + End If + End Sub + + Private Sub ucrChkDryPeriod_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDryPeriod.ControlValueChanged + If ucrChkDryPeriod.Checked Then + clsIsNaOperatorStartDOY.AddParameter("4", clsRFunctionParameter:=clsIsNaFirstDryPeriod, iPosition:=4) + clsConditionsOrOverallOperator.AddParameter("is.na_dry_period", clsRFunctionParameter:=clsIsNaDryPeriod, iPosition:=5) + Else + clsIsNaOperatorStartDOY.RemoveParameterByName("4") + clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_period") + End If + End Sub Private Sub MaximumValuesControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrChkDryPeriod.ControlContentsChanged, ucrNudDPRainPeriod.ControlContentsChanged, ucrNudDPOverallInterval.ControlContentsChanged If ucrChkDryPeriod.Checked Then From 3de5f6aaed4f7e77cc7c9eff93bdf0d82395e1a0 Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Wed, 23 Oct 2024 11:06:17 +0100 Subject: [PATCH 06/11] Change made --- instat/dlgStartofRains.vb | 51 ++++++++++-------------------- instat/sdgAdditionalCondition.vb | 53 +++----------------------------- 2 files changed, 20 insertions(+), 84 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index a45b4f2412f..1aa3e7c2afc 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -18,7 +18,7 @@ Imports instat.Translations Public Class dlgStartofRains Private bResetSubdialog As Boolean = True - Private clsCalcRainDay, clsCalcStartDOY, clsPaste0Function, clsGetDataFrameFunction, clsListevapFunction, clsRollEvaporationFunction, clsFractionEvapFunction, clsSumEvapFunction, clsConvertColumnType1Function, clsConvertColumnType2Function, clsConvertColumnTypeFunction, clsGetColumnDataTypeFunction, clsDummyFunction, clsIfelseStatusFunction, clsIfelseStatus1Function, clsFirstStatusFunction, clsIsNAStatusFunction, clsCalcStartDate, clsCombinationCalc, clsListCalFunction, clsCombinationManipList, clsCombinationSubCalcList, clsListSubCalc, clsManipulationFirstDOYPerYear, clsConditionsFilter, clsCombinedList As New RFunction + Private clsCalcRainDay, clsCalcStartDOY, clsVectorFunction, clsGetlinkeddataFunction, clsGetDataFrameFunction, clsListevapFunction, clsRollEvaporationFunction, clsFractionEvapFunction, clsSumEvapFunction, clsConvertColumnType1Function, clsConvertColumnType2Function, clsConvertColumnTypeFunction, clsGetColumnDataTypeFunction, clsDummyFunction, clsIfelseStatusFunction, clsIfelseStatus1Function, clsFirstStatusFunction, clsIsNAStatusFunction, clsCalcStartDate, clsCombinationCalc, clsListCalFunction, clsCombinationManipList, clsCombinationSubCalcList, clsListSubCalc, clsManipulationFirstDOYPerYear, clsConditionsFilter, clsCombinedList As New RFunction Private clsDayFromAndTo, clsGroupByStation, clsGroupByYear, clsListToTalRain, clsApplyInstatFunction, clsFirstDOY, clsFirstDate As New RFunction Private clsDayFromAndToOperator, clsEvapOperator, clsDayFromOperator, clsDayToOperator, clsRainDayOperator, clsRainDayConditionOperator, clsConditionsAndOperator, clsTRCombineOperator, clsRollingSumRainDayOperator, clsDSCombineOperator, clsDPCombineOperator As New ROperator Private clsDayFilterCalcFromConvert, clsDayFilterCalcFromList As New RFunction @@ -60,7 +60,7 @@ Public Class dlgStartofRains Private clsIsNaDryPeriod As New RFunction 'Rainy Day classes - Public clsCalcRainDayRollingSum, clsRainDayRollingSumFunction, clsRDRollingRainDaysSub As New RFunction + Private clsCalcRainDayRollingSum, clsRainDayRollingSumFunction, clsRDRollingRainDaysSub As New RFunction 'Dry Spell classes Private clsCalcDrySpellRollMax, clsCalcDrySpell, clsDrySpellPeriodLeadFunction, clsDrySpellPeriodRollMaxFunction, clsDrySpellPeriodSubCalcList, clsDrySpellSubCalcList As New RFunction @@ -297,7 +297,8 @@ Public Class dlgStartofRains clsCalcRainRollingSum.Clear() clsRainRollingSumFunction = New RFunction - clsPaste0Function = New RFunction + clsGetlinkeddataFunction = New RFunction + clsVectorFunction = New RFunction clsGetDataFrameFunction = New RFunction clsTRWetSpellList.Clear() clsTRWetSpell.Clear() @@ -559,7 +560,6 @@ Public Class dlgStartofRains clsRollEvaporationFunction.SetPackageName("RcppRoll") clsRollEvaporationFunction.SetRCommand("roll_sumr") clsRollEvaporationFunction.AddParameter("x", strFactionEvap, iPosition:=0) - ' clsRollEvaporationFunction.AddParameter("n", "2", iPosition:=1) clsRollEvaporationFunction.AddParameter("fill", "NA", iPosition:=2) clsRollEvaporationFunction.AddParameter("na.rm", "FALSE", iPosition:=3) clsRollEvaporationFunction.bToScriptAsRString = True @@ -760,16 +760,13 @@ Public Class dlgStartofRains clsGetDataFrameFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_data_names") - clsPaste0Function.SetRCommand("paste0") - 'clsPaste0Function.AddParameter("x", clsRFunctionParameter:=clsGetDataFrameFunction, iPosition:=0, bIncludeArgumentName:=False) - clsPaste0Function.AddParameter("n", Chr(34) & "_by_" & Chr(34), iPosition:=1, bIncludeArgumentName:=False) - ' clsPaste0Function.AddParameter("z", "_", iPosition:=3, bIncludeArgumentName:=False) - clsPaste0Function.SetAssignTo("last_data_name") + clsGetlinkeddataFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_linked_to_data_name") + clsGetlinkeddataFunction.SetAssignTo("linked_data_name") - ' last_data_name <- paste0("dodoma", "_by_", "s_year", "_", "station") + clsVectorFunction.SetRCommand("c") clsConvertColumnType2Function.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$convert_column_to_type") - clsConvertColumnType2Function.AddParameter("data_name", "last_data_name", iPosition:=0) + clsConvertColumnType2Function.AddParameter("data_name", "linked_data_name", iPosition:=0) clsConvertColumnType2Function.AddParameter("to_type", "year_type", iPosition:=2) 'Run Calculations @@ -786,7 +783,7 @@ Public Class dlgStartofRains ucrBase.clsRsyntax.SetBaseRFunction(clsApplyInstatFunction) ucrBase.clsRsyntax.AddToBeforeCodes(clsGetColumnDataTypeFunction, iPosition:=0) ucrBase.clsRsyntax.AddToBeforeCodes(clsConvertColumnTypeFunction, iPosition:=1) - ucrBase.clsRsyntax.AddToAfterCodes(clsPaste0Function, iPosition:=0) + ucrBase.clsRsyntax.AddToAfterCodes(clsGetlinkeddataFunction, iPosition:=0) ucrBase.clsRsyntax.AddToAfterCodes(clsConvertColumnType1Function, iPosition:=1) ucrBase.clsRsyntax.AddToAfterCodes(clsConvertColumnType2Function, iPosition:=2) SetReceiver() @@ -1012,7 +1009,6 @@ Public Class dlgStartofRains Private Sub ucrReceiverStation_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverStation.ControlValueChanged GroupByStationOptions() - StationVariable() End Sub Private Sub ucrReceiverYear_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverYear.ControlValueChanged @@ -1024,7 +1020,7 @@ Public Class dlgStartofRains clsGetColumnDataTypeFunction.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) clsConvertColumnTypeFunction.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) clsConvertColumnType1Function.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) - clsPaste0Function.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0, bIncludeArgumentName:=False) + clsGetlinkeddataFunction.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0, bIncludeArgumentName:=False) clsDayFilterCalcFromList.ClearParameters() End Sub @@ -1093,10 +1089,11 @@ Public Class dlgStartofRains End Sub Private Sub cmdAdditionnal_Click(sender As Object, e As EventArgs) Handles cmdAdditionnal.Click - sdgAdditionalCondition.SetRCode(clsNewCombinedList:=clsCombinedList, clsNewCalcRainDay:=clsCalcRainDay, clsNewCalcDrySpellRollMax:=clsCalcDrySpellRollMax, clsNewIsNaFirstDryPeriod:=clsIsNaFirstDryPeriod, clsNewIsNaFirstDrySpell:=clsIsNaFirstDrySpell, clsNewIsNaDryPeriod:=clsIsNaDryPeriod, clsNewIsNaDrySpell:=clsIsNaDrySpell, clsNewRainDayRollingSumFunction:=clsRainDayRollingSumFunction, clsNewIsNaRollSumRainDay:=clsIsNaRollSumRainDay, clsNewIsNaFirstRollSumRainDay:=clsIsNaFirstRollSumRainDay, clsNewDrySpellPeriodRollMaxFunction:=clsDrySpellPeriodRollMaxFunction, clsNewRollingSumRainDryPeriodFunction:=clsRollingSumRainDryPeriodFunction, clsNewCalcRainDayRollingSum:=clsCalcRainDayRollingSum, clsNewCalcRollSumNumberDryPeriod:=clsCalcRollSumNumberDryPeriod, clsNewConditionsAndOperator:=clsConditionsAndOperator, clsNewIsNaOperatorStartDOY:=clsIsNaOperatorStartDOY, clsNewConditionsOrOverallOperator:=clsConditionsOrOverallOperator, clsNewRollingSumRainDayOperator:=clsRollingSumRainDayOperator, clsNewDSCombineOperator:=clsDSCombineOperator, clsNewSumRainDryPeriodIntervalMinusOperator:=clsSumRainDryPeriodIntervalMinusOperator, clsNewSumRainDryPeriodOperator:=clsSumRainDryPeriodOperator, clsNewDPCombineOperator:=clsDPCombineOperator, clsNewSumRainDryPeriodIntervalPlusOperator:=clsSumRainDryPeriodIntervalPlusOperator, bReset:=bResetSubdialog) + sdgAdditionalCondition.SetRCode(clsNewCombinedList:=clsCombinedList, clsNewCalcRollSumNumberDryPeriod:=clsCalcRollSumNumberDryPeriod, clsNewCalcRainDayRollingSum:=clsCalcRainDayRollingSum, clsNewCalcDrySpellRollMax:=clsCalcDrySpellRollMax, clsNewConditionsAndOperator:=clsConditionsAndOperator, clsNewRollingSumRainDayOperator:=clsRollingSumRainDayOperator, clsNewDSCombineOperator:=clsDSCombineOperator, clsNewDPCombineOperator:=clsDPCombineOperator, clsNewSumRainDryPeriodIntervalPlusOperator:=clsSumRainDryPeriodIntervalPlusOperator, bReset:=bResetSubdialog) sdgAdditionalCondition.ShowDialog() bResetSubdialog = False AdditionalCondition() + ChangeDSValue() End Sub Private Sub ChangeDSValue() @@ -1104,8 +1101,6 @@ Public Class dlgStartofRains If sdgAdditionalCondition.ucrChkNumberOfRainyDays.Checked Then clsIsNaOperatorStartDOY.AddParameter("2", clsRFunctionParameter:=clsIsNaFirstRollSumRainDay, iPosition:=2) clsConditionsOrOverallOperator.AddParameter("is.na_roll_sum_rain_day", clsRFunctionParameter:=clsIsNaRollSumRainDay, iPosition:=3) - 'ucrBase.clsRsyntax.AddToBeforeCodes(clsCalcRainDay, iPosition:=2) - 'ucrBase.clsRsyntax.AddToBeforeCodes(clsCalcRainDayRollingSum, iPosition:=3) clsCombinedList.AddParameter("rd_sub", clsRFunctionParameter:=clsCalcRainDayRollingSum, bIncludeArgumentName:=False, iPosition:=1) Else clsCombinedList.RemoveParameterByName("rd_sub") @@ -1171,12 +1166,6 @@ Public Class dlgStartofRains clsCombinedList.RemoveParameterByName("rd_sub") clsCombinedList.RemoveParameterByName("ds_sub") clsCombinedList.RemoveParameterByName("dp_sub") - 'ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRainDay) - 'ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRainDayRollingSum) - 'ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRainRollingSumDryPeriod) - 'ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcRollSumNumberDryPeriod) - 'ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcDrySpell) - 'ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsCalcDrySpellRollMax) clsIsNaOperatorStartDOY.RemoveParameterByName("4") clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_period") @@ -1196,21 +1185,13 @@ Public Class dlgStartofRains End If End Sub - Private Sub StationVariable() - If Not ucrReceiverStation.IsEmpty Then - clsPaste0Function.AddParameter("z", Chr(34) & "_" & Chr(34), iPosition:=3, bIncludeArgumentName:=False) - clsPaste0Function.AddParameter("x", ucrReceiverStation.GetVariableNames(), iPosition:=2, bIncludeArgumentName:=False) - Else - clsPaste0Function.RemoveParameterByName("x") - clsPaste0Function.RemoveParameterByName("z") - End If - End Sub - Private Sub YearVariable() If Not ucrReceiverYear.IsEmpty Then - clsPaste0Function.AddParameter("y", ucrReceiverYear.GetVariableNames(), iPosition:=4, bIncludeArgumentName:=False) + clsVectorFunction.AddParameter("x", ucrReceiverYear.GetVariableNames(), iPosition:=0, bIncludeArgumentName:=False) + clsGetlinkeddataFunction.AddParameter("link_cols", clsRFunctionParameter:=clsVectorFunction, iPosition:=1) Else - clsPaste0Function.RemoveParameterByName("y") + clsGetlinkeddataFunction.RemoveParameterByName("link_cols") + clsVectorFunction.RemoveParameterByName("x") End If End Sub End Class diff --git a/instat/sdgAdditionalCondition.vb b/instat/sdgAdditionalCondition.vb index c100f4651f9..e917c6a0c9c 100644 --- a/instat/sdgAdditionalCondition.vb +++ b/instat/sdgAdditionalCondition.vb @@ -18,8 +18,8 @@ Imports instat.Translations Public Class sdgAdditionalCondition Public bFirstLoad As Boolean = True Public bControlsInitialised As Boolean = False - Private clsCombinedList, clsCalcDrySpellRollMax, clsCalcRainDay, clsIsNaFirstDryPeriod, clsIsNaFirstDrySpell, clsIsNaDryPeriod, clsIsNaDrySpell, clsRainDayRollingSumFunction, clsIsNaRollSumRainDay, clsIsNaFirstRollSumRainDay, clsDrySpellPeriodRollMaxFunction, clsRollingSumRainDryPeriodFunction, clsCalcRainDayRollingSum, clsCalcRollSumNumberDryPeriod As RFunction - Private clsConditionsAndOperator, clsIsNaOperatorStartDOY, clsConditionsOrOverallOperator, clsRollingSumRainDayOperator, clsDSCombineOperator, clsSumRainDryPeriodIntervalMinusOperator, clsSumRainDryPeriodOperator, clsDPCombineOperator, clsSumRainDryPeriodIntervalPlusOperator As ROperator + Private clsCombinedList, clsCalcDrySpellRollMax, clsCalcRainDayRollingSum, clsCalcRollSumNumberDryPeriod As RFunction + Private clsConditionsAndOperator, clsRollingSumRainDayOperator, clsDSCombineOperator, clsDPCombineOperator, clsSumRainDryPeriodIntervalPlusOperator As ROperator Private Sub sdgAdditionalCondition_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) @@ -57,7 +57,6 @@ Public Class sdgAdditionalCondition ucrNudDSMaximumDays.SetParameter(New RParameter("right", 1)) ucrNudDSMaximumDays.SetMinMax(1, 366) ucrNudDSMaximumDays.Increment = 1 - 'ucrNudDSMaximumDays.SetRDefault(9) ' Dry Period ucrChkDryPeriod.SetText("Dry Period") @@ -81,31 +80,17 @@ Public Class sdgAdditionalCondition ucrChkDryPeriod.AddToLinkedControls(ucrNudDPRainPeriod, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=30) End Sub - Public Sub SetRCode(clsNewCombinedList As RFunction, clsNewCalcDrySpellRollMax As RFunction, clsNewCalcRainDay As RFunction, clsNewIsNaFirstDryPeriod As RFunction, clsNewIsNaFirstDrySpell As RFunction, clsNewIsNaDryPeriod As RFunction, clsNewIsNaDrySpell As RFunction, clsNewRainDayRollingSumFunction As RFunction, clsNewIsNaRollSumRainDay As RFunction, clsNewIsNaFirstRollSumRainDay As RFunction, clsNewDrySpellPeriodRollMaxFunction As RFunction, clsNewRollingSumRainDryPeriodFunction As RFunction, clsNewCalcRainDayRollingSum As RFunction, clsNewCalcRollSumNumberDryPeriod As RFunction, clsNewConditionsAndOperator As ROperator, clsNewIsNaOperatorStartDOY As ROperator, clsNewConditionsOrOverallOperator As ROperator, clsNewRollingSumRainDayOperator As ROperator, clsNewDSCombineOperator As ROperator, clsNewSumRainDryPeriodIntervalMinusOperator As ROperator, clsNewSumRainDryPeriodOperator As ROperator, clsNewDPCombineOperator As ROperator, clsNewSumRainDryPeriodIntervalPlusOperator As ROperator, Optional bReset As Boolean = False) + Public Sub SetRCode(clsNewCombinedList As RFunction, clsNewCalcDrySpellRollMax As RFunction, clsNewCalcRainDayRollingSum As RFunction, clsNewCalcRollSumNumberDryPeriod As RFunction, clsNewConditionsAndOperator As ROperator, clsNewRollingSumRainDayOperator As ROperator, clsNewDSCombineOperator As ROperator, clsNewDPCombineOperator As ROperator, clsNewSumRainDryPeriodIntervalPlusOperator As ROperator, Optional bReset As Boolean = False) If Not bControlsInitialised Then InitialiseControls() End If clsCombinedList = clsNewCombinedList clsCalcDrySpellRollMax = clsNewCalcDrySpellRollMax - clsIsNaFirstDryPeriod = clsNewIsNaFirstDryPeriod - clsIsNaFirstDrySpell = clsNewIsNaFirstDrySpell - clsIsNaDryPeriod = clsNewIsNaDryPeriod - clsIsNaDrySpell = clsNewIsNaDrySpell - clsRainDayRollingSumFunction = clsNewRainDayRollingSumFunction - clsCalcRainDay = clsNewCalcRainDay - clsIsNaRollSumRainDay = clsNewIsNaRollSumRainDay - clsIsNaFirstRollSumRainDay = clsNewIsNaFirstRollSumRainDay - clsDrySpellPeriodRollMaxFunction = clsNewDrySpellPeriodRollMaxFunction - clsRollingSumRainDryPeriodFunction = clsNewRollingSumRainDryPeriodFunction - clsCalcRainDayRollingSum = clsNewCalcRainDayRollingSum + clsCalcRainDayRollingSum = clsNewCalcRainDayRollingSum clsCalcRollSumNumberDryPeriod = clsNewCalcRollSumNumberDryPeriod clsConditionsAndOperator = clsNewConditionsAndOperator - clsIsNaOperatorStartDOY = clsNewIsNaOperatorStartDOY - clsConditionsOrOverallOperator = clsNewConditionsOrOverallOperator clsRollingSumRainDayOperator = clsNewRollingSumRainDayOperator clsDSCombineOperator = clsNewDSCombineOperator - clsSumRainDryPeriodIntervalMinusOperator = clsNewSumRainDryPeriodIntervalMinusOperator - clsSumRainDryPeriodOperator = clsNewSumRainDryPeriodOperator clsDPCombineOperator = clsNewDPCombineOperator clsSumRainDryPeriodIntervalPlusOperator = clsNewSumRainDryPeriodIntervalPlusOperator @@ -116,36 +101,6 @@ Public Class sdgAdditionalCondition ucrChkDrySpell.SetRCode(clsCombinedList, bReset, bCloneIfNeeded:=True) End Sub - Private Sub ucrChkNumberOfRainyDays_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkNumberOfRainyDays.ControlValueChanged - If ucrChkNumberOfRainyDays.Checked Then - clsIsNaOperatorStartDOY.AddParameter("2", clsRFunctionParameter:=clsIsNaFirstRollSumRainDay, iPosition:=2) - clsConditionsOrOverallOperator.AddParameter("is.na_roll_sum_rain_day", clsRFunctionParameter:=clsIsNaRollSumRainDay, iPosition:=3) - Else - clsIsNaOperatorStartDOY.RemoveParameterByName("2") - clsConditionsOrOverallOperator.RemoveParameterByName("is.na_roll_sum_rain_day") - End If - End Sub - - Private Sub ucrChkDrySpell_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDrySpell.ControlValueChanged - If ucrChkDrySpell.Checked Then - clsIsNaOperatorStartDOY.AddParameter("3", clsRFunctionParameter:=clsIsNaFirstDrySpell, iPosition:=3) - clsConditionsOrOverallOperator.AddParameter("is.na_dry_spell", clsRFunctionParameter:=clsIsNaDrySpell, iPosition:=4) - Else - clsIsNaOperatorStartDOY.RemoveParameterByName("3") - clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_spell") - End If - End Sub - - Private Sub ucrChkDryPeriod_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDryPeriod.ControlValueChanged - If ucrChkDryPeriod.Checked Then - clsIsNaOperatorStartDOY.AddParameter("4", clsRFunctionParameter:=clsIsNaFirstDryPeriod, iPosition:=4) - clsConditionsOrOverallOperator.AddParameter("is.na_dry_period", clsRFunctionParameter:=clsIsNaDryPeriod, iPosition:=5) - Else - clsIsNaOperatorStartDOY.RemoveParameterByName("4") - clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_period") - End If - End Sub - Private Sub MaximumValuesControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrChkDryPeriod.ControlContentsChanged, ucrNudDPRainPeriod.ControlContentsChanged, ucrNudDPOverallInterval.ControlContentsChanged If ucrChkDryPeriod.Checked Then ucrNudDPRainPeriod.Maximum = ucrNudDPOverallInterval.Value From 1c26f02707ffd5a5eea64faa4e93b7072c326caa Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Wed, 23 Oct 2024 11:07:18 +0100 Subject: [PATCH 07/11] Change made --- instat/sdgAdditionalCondition.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/sdgAdditionalCondition.vb b/instat/sdgAdditionalCondition.vb index e917c6a0c9c..6dfb3e53a67 100644 --- a/instat/sdgAdditionalCondition.vb +++ b/instat/sdgAdditionalCondition.vb @@ -86,7 +86,7 @@ Public Class sdgAdditionalCondition End If clsCombinedList = clsNewCombinedList clsCalcDrySpellRollMax = clsNewCalcDrySpellRollMax - clsCalcRainDayRollingSum = clsNewCalcRainDayRollingSum + clsCalcRainDayRollingSum = clsNewCalcRainDayRollingSum clsCalcRollSumNumberDryPeriod = clsNewCalcRollSumNumberDryPeriod clsConditionsAndOperator = clsNewConditionsAndOperator clsRollingSumRainDayOperator = clsNewRollingSumRainDayOperator From b13f00ed24d03ab13f6a5165304eecaa7f41a2f9 Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Wed, 23 Oct 2024 15:03:58 +0100 Subject: [PATCH 08/11] Change made --- instat/dlgStartofRains.vb | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 1aa3e7c2afc..65262c1a10b 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -73,6 +73,7 @@ Public Class dlgStartofRains Private strWetSpell As String = "wet_spell" Private strFactionEvap As String = "fraction_evap" Private strSumFractionEvap As String = "roll_sum_evap" + Private strRollSumRainDryPeriod As String = "roll_sum_rain_dry_period" Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -236,7 +237,7 @@ Public Class dlgStartofRains Dim strStartDate As String = "start_rain_date" Dim strStartStatus As String = "start_rain_status" Dim strStartDoy As String = "start_rain" - Dim strRollSumRainDryPeriod As String = "roll_sum_rain_dry_period" + 'Dim strRollSumRainDryPeriod As String = "roll_sum_rain_dry_period" Dim strYearType As String = "year_type" clsDayFromAndTo.Clear() @@ -442,7 +443,7 @@ Public Class dlgStartofRains clsRollingSumRainDayOperator.SetOperation(">=") clsRollingSumRainDayOperator.AddParameter("0", strRollSumRainDay, iPosition:=0) - clsRollingSumRainDayOperator.AddParameter("1", 1, iPosition:=1) + ' clsRollingSumRainDayOperator.AddParameter("1", 1, iPosition:=1) clsFirstRollSumRainDay.SetPackageName("dplyr") clsFirstRollSumRainDay.SetRCommand("first") @@ -599,16 +600,16 @@ Public Class dlgStartofRains clsRollSumNumberDryPeriodFunction.AddParameter("na.rm", "FALSE", iPosition:=3) clsSumRainDryPeriodOperator.SetOperation("<=") - clsSumRainDryPeriodOperator.AddParameter("left", strRollSumRainDryPeriod, iPosition:=0) + ' clsSumRainDryPeriodOperator.AddParameter("left", strRollSumRainDryPeriod, iPosition:=0) clsSumRainDryPeriodOperator.AddParameter("right", 40, iPosition:=1) clsSumRainDryPeriodIntervalMinusOperator.SetOperation("-") clsSumRainDryPeriodIntervalMinusOperator.AddParameter("0", 45, iPosition:=0) - clsSumRainDryPeriodIntervalMinusOperator.AddParameter("1", clsROperatorParameter:=clsSumRainDryPeriodIntervalPlusOperator, iPosition:=1) + ' clsSumRainDryPeriodIntervalMinusOperator.AddParameter("1", clsROperatorParameter:=clsSumRainDryPeriodIntervalPlusOperator, iPosition:=1) clsSumRainDryPeriodIntervalPlusOperator.SetOperation("+") clsSumRainDryPeriodIntervalPlusOperator.AddParameter("n", 30, iPosition:=0) - clsSumRainDryPeriodIntervalPlusOperator.AddParameter("1", 1, iPosition:=1) + ' clsSumRainDryPeriodIntervalPlusOperator.AddParameter("1", 1, iPosition:=1) clsFirstDryPeriod.SetPackageName("dplyr") clsFirstDryPeriod.SetRCommand("first") @@ -1136,20 +1137,26 @@ Public Class dlgStartofRains clsRollingSumRainDayOperator.RemoveParameterByName("1") End If If Not sdgAdditionalCondition.ucrNudDPMaxRain.IsEmpty Then + clsSumRainDryPeriodOperator.AddParameter("left", strRollSumRainDryPeriod, iPosition:=0) clsSumRainDryPeriodOperator.AddParameter("right", sdgAdditionalCondition.ucrNudDPMaxRain.GetText(), iPosition:=1) Else clsSumRainDryPeriodOperator.RemoveParameterByName("right") + clsSumRainDryPeriodOperator.RemoveParameterByName("left") End If If Not sdgAdditionalCondition.ucrNudDPRainPeriod.IsEmpty Then clsRollingSumRainDryPeriodFunction.AddParameter("n", sdgAdditionalCondition.ucrNudDPRainPeriod.GetText(), iPosition:=1) clsSumRainDryPeriodIntervalPlusOperator.AddParameter("n", sdgAdditionalCondition.ucrNudDPRainPeriod.GetText(), iPosition:=0) + clsSumRainDryPeriodIntervalPlusOperator.AddParameter("1", 1, iPosition:=1) Else clsSumRainDryPeriodIntervalPlusOperator.RemoveParameterByName("n") + clsSumRainDryPeriodIntervalPlusOperator.RemoveParameterByName("1") clsRollingSumRainDryPeriodFunction.RemoveParameterByName("n") End If If Not sdgAdditionalCondition.ucrNudDPOverallInterval.IsEmpty Then + clsSumRainDryPeriodIntervalMinusOperator.AddParameter("1", clsROperatorParameter:=clsSumRainDryPeriodIntervalPlusOperator, iPosition:=1) clsSumRainDryPeriodIntervalMinusOperator.AddParameter("0", sdgAdditionalCondition.ucrNudDPOverallInterval.GetText(), iPosition:=0) Else + clsSumRainDryPeriodIntervalMinusOperator.RemoveParameterByName("1") clsSumRainDryPeriodIntervalMinusOperator.RemoveParameterByName("0") End If If Not sdgAdditionalCondition.ucrNudDSLengthOfTime.IsEmpty Then @@ -1174,14 +1181,21 @@ Public Class dlgStartofRains clsIsNaOperatorStartDOY.RemoveParameterByName("2") clsConditionsOrOverallOperator.RemoveParameterByName("is.na_roll_sum_rain_day") + clsConditionsAndOperator.RemoveParameterByName("dry_period") + clsConditionsAndOperator.RemoveParameterByName("dry_spell") + clsConditionsAndOperator.RemoveParameterByName("rain_days") + clsRainDayRollingSumFunction.RemoveParameterByName("n") clsDrySpellPeriodRollMaxFunction.RemoveParameterByName("n") clsSumRainDryPeriodOperator.RemoveParameterByName("right") + clsSumRainDryPeriodOperator.RemoveParameterByName("left") clsRollingSumRainDayOperator.RemoveParameterByName("1") clsDSCombineOperator.RemoveParameterByName("ds_max") clsSumRainDryPeriodIntervalPlusOperator.RemoveParameterByName("n") + clsSumRainDryPeriodIntervalPlusOperator.RemoveParameterByName("1") clsRollingSumRainDryPeriodFunction.RemoveParameterByName("n") clsSumRainDryPeriodIntervalMinusOperator.RemoveParameterByName("0") + clsSumRainDryPeriodIntervalMinusOperator.RemoveParameterByName("1") End If End Sub From 951e1ee3a6b9ac55aa5a79c18e4870ff738f97a3 Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Thu, 24 Oct 2024 09:00:46 +0100 Subject: [PATCH 09/11] hange made --- instat/dlgStartofRains.Designer.vb | 18 ++++++++--------- instat/dlgStartofRains.vb | 31 ++++++++++++++---------------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index 77dab3d9fdf..ab78e3eb6e2 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -357,7 +357,7 @@ Partial Class dlgStartofRains ' Me.ucrReceiverEvap.AutoSize = True Me.ucrReceiverEvap.frmParent = Me - Me.ucrReceiverEvap.Location = New System.Drawing.Point(210, 81) + Me.ucrReceiverEvap.Location = New System.Drawing.Point(289, 81) Me.ucrReceiverEvap.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverEvap.Name = "ucrReceiverEvap" Me.ucrReceiverEvap.Selector = Nothing @@ -369,7 +369,7 @@ Partial Class dlgStartofRains 'lblFraction ' Me.lblFraction.AutoSize = True - Me.lblFraction.Location = New System.Drawing.Point(349, 83) + Me.lblFraction.Location = New System.Drawing.Point(428, 83) Me.lblFraction.Name = "lblFraction" Me.lblFraction.Size = New System.Drawing.Size(48, 13) Me.lblFraction.TabIndex = 25 @@ -380,7 +380,7 @@ Partial Class dlgStartofRains Me.ucrNudEvapo.AutoSize = True Me.ucrNudEvapo.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudEvapo.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudEvapo.Location = New System.Drawing.Point(414, 78) + Me.ucrNudEvapo.Location = New System.Drawing.Point(493, 78) Me.ucrNudEvapo.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudEvapo.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudEvapo.Name = "ucrNudEvapo" @@ -391,7 +391,7 @@ Partial Class dlgStartofRains 'rdoEvapo ' Me.rdoEvapo.AutoSize = True - Me.rdoEvapo.Location = New System.Drawing.Point(120, 83) + Me.rdoEvapo.Location = New System.Drawing.Point(199, 83) Me.rdoEvapo.Name = "rdoEvapo" Me.rdoEvapo.Size = New System.Drawing.Size(82, 17) Me.rdoEvapo.TabIndex = 23 @@ -427,7 +427,7 @@ Partial Class dlgStartofRains Me.ucrNudTRAmount.AutoSize = True Me.ucrNudTRAmount.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudTRAmount.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudTRAmount.Location = New System.Drawing.Point(210, 58) + Me.ucrNudTRAmount.Location = New System.Drawing.Point(289, 58) Me.ucrNudTRAmount.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudTRAmount.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudTRAmount.Name = "ucrNudTRAmount" @@ -458,7 +458,7 @@ Partial Class dlgStartofRains Me.ucrNudTRPercentile.AutoSize = True Me.ucrNudTRPercentile.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudTRPercentile.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudTRPercentile.Location = New System.Drawing.Point(210, 109) + Me.ucrNudTRPercentile.Location = New System.Drawing.Point(289, 109) Me.ucrNudTRPercentile.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudTRPercentile.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudTRPercentile.Name = "ucrNudTRPercentile" @@ -469,7 +469,7 @@ Partial Class dlgStartofRains 'rdoTRAmount ' Me.rdoTRAmount.AutoSize = True - Me.rdoTRAmount.Location = New System.Drawing.Point(120, 60) + Me.rdoTRAmount.Location = New System.Drawing.Point(199, 60) Me.rdoTRAmount.Name = "rdoTRAmount" Me.rdoTRAmount.Size = New System.Drawing.Size(61, 17) Me.rdoTRAmount.TabIndex = 21 @@ -480,7 +480,7 @@ Partial Class dlgStartofRains 'rdoTRPercentile ' Me.rdoTRPercentile.AutoSize = True - Me.rdoTRPercentile.Location = New System.Drawing.Point(120, 109) + Me.rdoTRPercentile.Location = New System.Drawing.Point(199, 109) Me.rdoTRPercentile.Name = "rdoTRPercentile" Me.rdoTRPercentile.Size = New System.Drawing.Size(72, 17) Me.rdoTRPercentile.TabIndex = 27 @@ -491,7 +491,7 @@ Partial Class dlgStartofRains 'ucrPnlTRCalculateBy ' Me.ucrPnlTRCalculateBy.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlTRCalculateBy.Location = New System.Drawing.Point(51, 55) + Me.ucrPnlTRCalculateBy.Location = New System.Drawing.Point(130, 55) Me.ucrPnlTRCalculateBy.Name = "ucrPnlTRCalculateBy" Me.ucrPnlTRCalculateBy.Size = New System.Drawing.Size(165, 75) Me.ucrPnlTRCalculateBy.TabIndex = 4 diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 65262c1a10b..ac61acf3c7d 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -73,7 +73,7 @@ Public Class dlgStartofRains Private strWetSpell As String = "wet_spell" Private strFactionEvap As String = "fraction_evap" Private strSumFractionEvap As String = "roll_sum_evap" - Private strRollSumRainDryPeriod As String = "roll_sum_rain_dry_period" + 'Private strRollSumRainDryPeriod As String = "roll_sum_rain_dry_period" Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -189,7 +189,7 @@ Public Class dlgStartofRains ucrNudEvapo.Increment = 0.01 ucrNudEvapo.SetLinkedDisplayControl(lblFraction) - ucrChkAdditional.SetText("Additional") + ucrChkAdditional.SetText("Additional Conditions") ucrChkAdditional.AddParameterValuesCondition(True, "additional", "True") ucrChkAdditional.AddParameterValuesCondition(False, "additional", "False") @@ -237,7 +237,7 @@ Public Class dlgStartofRains Dim strStartDate As String = "start_rain_date" Dim strStartStatus As String = "start_rain_status" Dim strStartDoy As String = "start_rain" - 'Dim strRollSumRainDryPeriod As String = "roll_sum_rain_dry_period" + Dim strRollSumRainDryPeriod As String = "roll_sum_rain_dry_period" Dim strYearType As String = "year_type" clsDayFromAndTo.Clear() @@ -443,7 +443,7 @@ Public Class dlgStartofRains clsRollingSumRainDayOperator.SetOperation(">=") clsRollingSumRainDayOperator.AddParameter("0", strRollSumRainDay, iPosition:=0) - ' clsRollingSumRainDayOperator.AddParameter("1", 1, iPosition:=1) + clsRollingSumRainDayOperator.AddParameter("1", 1, iPosition:=1) clsFirstRollSumRainDay.SetPackageName("dplyr") clsFirstRollSumRainDay.SetRCommand("first") @@ -600,16 +600,16 @@ Public Class dlgStartofRains clsRollSumNumberDryPeriodFunction.AddParameter("na.rm", "FALSE", iPosition:=3) clsSumRainDryPeriodOperator.SetOperation("<=") - ' clsSumRainDryPeriodOperator.AddParameter("left", strRollSumRainDryPeriod, iPosition:=0) + clsSumRainDryPeriodOperator.AddParameter("left", strRollSumRainDryPeriod, iPosition:=0) clsSumRainDryPeriodOperator.AddParameter("right", 40, iPosition:=1) clsSumRainDryPeriodIntervalMinusOperator.SetOperation("-") clsSumRainDryPeriodIntervalMinusOperator.AddParameter("0", 45, iPosition:=0) - ' clsSumRainDryPeriodIntervalMinusOperator.AddParameter("1", clsROperatorParameter:=clsSumRainDryPeriodIntervalPlusOperator, iPosition:=1) + clsSumRainDryPeriodIntervalMinusOperator.AddParameter("1", clsROperatorParameter:=clsSumRainDryPeriodIntervalPlusOperator, iPosition:=1) clsSumRainDryPeriodIntervalPlusOperator.SetOperation("+") clsSumRainDryPeriodIntervalPlusOperator.AddParameter("n", 30, iPosition:=0) - ' clsSumRainDryPeriodIntervalPlusOperator.AddParameter("1", 1, iPosition:=1) + clsSumRainDryPeriodIntervalPlusOperator.AddParameter("1", 1, iPosition:=1) clsFirstDryPeriod.SetPackageName("dplyr") clsFirstDryPeriod.SetRCommand("first") @@ -1100,28 +1100,34 @@ Public Class dlgStartofRains Private Sub ChangeDSValue() If ucrChkAdditional.Checked Then If sdgAdditionalCondition.ucrChkNumberOfRainyDays.Checked Then + clsConditionsAndOperator.AddParameter("rain_days", clsROperatorParameter:=clsRollingSumRainDayOperator, iPosition:=2, bIncludeArgumentName:=False) clsIsNaOperatorStartDOY.AddParameter("2", clsRFunctionParameter:=clsIsNaFirstRollSumRainDay, iPosition:=2) clsConditionsOrOverallOperator.AddParameter("is.na_roll_sum_rain_day", clsRFunctionParameter:=clsIsNaRollSumRainDay, iPosition:=3) clsCombinedList.AddParameter("rd_sub", clsRFunctionParameter:=clsCalcRainDayRollingSum, bIncludeArgumentName:=False, iPosition:=1) Else clsCombinedList.RemoveParameterByName("rd_sub") + clsConditionsAndOperator.RemoveParameterByName("rain_days") clsIsNaOperatorStartDOY.RemoveParameterByName("2") clsConditionsOrOverallOperator.RemoveParameterByName("is.na_roll_sum_rain_day") End If If sdgAdditionalCondition.ucrChkDrySpell.Checked Then + clsConditionsAndOperator.AddParameter("dry_spell", clsROperatorParameter:=clsDSCombineOperator, iPosition:=3, bIncludeArgumentName:=False) clsIsNaOperatorStartDOY.AddParameter("3", clsRFunctionParameter:=clsIsNaFirstDrySpell, iPosition:=3) clsConditionsOrOverallOperator.AddParameter("is.na_dry_spell", clsRFunctionParameter:=clsIsNaDrySpell, iPosition:=4) clsCombinedList.AddParameter("ds_sub", clsRFunctionParameter:=clsCalcDrySpellRollMax, iPosition:=2, bIncludeArgumentName:=False) Else + clsConditionsAndOperator.RemoveParameterByName("dry_spell") clsCombinedList.RemoveParameterByName("ds_sub") clsIsNaOperatorStartDOY.RemoveParameterByName("3") clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_spell") End If If sdgAdditionalCondition.ucrChkDryPeriod.Checked Then + clsConditionsAndOperator.AddParameter("dry_period", clsROperatorParameter:=clsDPCombineOperator, iPosition:=4, bIncludeArgumentName:=False) clsIsNaOperatorStartDOY.AddParameter("4", clsRFunctionParameter:=clsIsNaFirstDryPeriod, iPosition:=4) clsConditionsOrOverallOperator.AddParameter("is.na_dry_period", clsRFunctionParameter:=clsIsNaDryPeriod, iPosition:=5) clsCombinedList.AddParameter("dp_sub", clsRFunctionParameter:=clsCalcRollSumNumberDryPeriod, iPosition:=3, bIncludeArgumentName:=False) Else + clsConditionsAndOperator.RemoveParameterByName("dry_period") clsCombinedList.RemoveParameterByName("dp_sub") clsIsNaOperatorStartDOY.RemoveParameterByName("4") clsConditionsOrOverallOperator.RemoveParameterByName("is.na_dry_period") @@ -1137,26 +1143,20 @@ Public Class dlgStartofRains clsRollingSumRainDayOperator.RemoveParameterByName("1") End If If Not sdgAdditionalCondition.ucrNudDPMaxRain.IsEmpty Then - clsSumRainDryPeriodOperator.AddParameter("left", strRollSumRainDryPeriod, iPosition:=0) clsSumRainDryPeriodOperator.AddParameter("right", sdgAdditionalCondition.ucrNudDPMaxRain.GetText(), iPosition:=1) Else clsSumRainDryPeriodOperator.RemoveParameterByName("right") - clsSumRainDryPeriodOperator.RemoveParameterByName("left") End If If Not sdgAdditionalCondition.ucrNudDPRainPeriod.IsEmpty Then clsRollingSumRainDryPeriodFunction.AddParameter("n", sdgAdditionalCondition.ucrNudDPRainPeriod.GetText(), iPosition:=1) clsSumRainDryPeriodIntervalPlusOperator.AddParameter("n", sdgAdditionalCondition.ucrNudDPRainPeriod.GetText(), iPosition:=0) - clsSumRainDryPeriodIntervalPlusOperator.AddParameter("1", 1, iPosition:=1) Else clsSumRainDryPeriodIntervalPlusOperator.RemoveParameterByName("n") - clsSumRainDryPeriodIntervalPlusOperator.RemoveParameterByName("1") clsRollingSumRainDryPeriodFunction.RemoveParameterByName("n") End If If Not sdgAdditionalCondition.ucrNudDPOverallInterval.IsEmpty Then - clsSumRainDryPeriodIntervalMinusOperator.AddParameter("1", clsROperatorParameter:=clsSumRainDryPeriodIntervalPlusOperator, iPosition:=1) clsSumRainDryPeriodIntervalMinusOperator.AddParameter("0", sdgAdditionalCondition.ucrNudDPOverallInterval.GetText(), iPosition:=0) Else - clsSumRainDryPeriodIntervalMinusOperator.RemoveParameterByName("1") clsSumRainDryPeriodIntervalMinusOperator.RemoveParameterByName("0") End If If Not sdgAdditionalCondition.ucrNudDSLengthOfTime.IsEmpty Then @@ -1188,14 +1188,11 @@ Public Class dlgStartofRains clsRainDayRollingSumFunction.RemoveParameterByName("n") clsDrySpellPeriodRollMaxFunction.RemoveParameterByName("n") clsSumRainDryPeriodOperator.RemoveParameterByName("right") - clsSumRainDryPeriodOperator.RemoveParameterByName("left") - clsRollingSumRainDayOperator.RemoveParameterByName("1") clsDSCombineOperator.RemoveParameterByName("ds_max") + clsRollingSumRainDayOperator.RemoveParameterByName("1") clsSumRainDryPeriodIntervalPlusOperator.RemoveParameterByName("n") - clsSumRainDryPeriodIntervalPlusOperator.RemoveParameterByName("1") clsRollingSumRainDryPeriodFunction.RemoveParameterByName("n") clsSumRainDryPeriodIntervalMinusOperator.RemoveParameterByName("0") - clsSumRainDryPeriodIntervalMinusOperator.RemoveParameterByName("1") End If End Sub From 28b82ed843ee1de7fcb6996545b344454038288a Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Thu, 24 Oct 2024 15:10:43 +0100 Subject: [PATCH 10/11] Change made --- instat/dlgStartofRains.vb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index ac61acf3c7d..5b0a42b19e7 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -1010,11 +1010,12 @@ Public Class dlgStartofRains Private Sub ucrReceiverStation_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverStation.ControlValueChanged GroupByStationOptions() + YearStationVariable() End Sub Private Sub ucrReceiverYear_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverYear.ControlValueChanged GroupByYearOptions() - YearVariable() + YearStationVariable() End Sub Private Sub ucrSelectorForStartofRains_DataFrameChanged() Handles ucrSelectorForStartofRains.DataFrameChanged @@ -1196,9 +1197,14 @@ Public Class dlgStartofRains End If End Sub - Private Sub YearVariable() + Private Sub YearStationVariable() If Not ucrReceiverYear.IsEmpty Then clsVectorFunction.AddParameter("x", ucrReceiverYear.GetVariableNames(), iPosition:=0, bIncludeArgumentName:=False) + If Not ucrReceiverStation.IsEmpty Then + clsVectorFunction.AddParameter("y", ucrReceiverStation.GetVariableNames(), iPosition:=1, bIncludeArgumentName:=False) + Else + clsVectorFunction.RemoveParameterByName("y") + End If clsGetlinkeddataFunction.AddParameter("link_cols", clsRFunctionParameter:=clsVectorFunction, iPosition:=1) Else clsGetlinkeddataFunction.RemoveParameterByName("link_cols") From 2ce7e1ba9450882d4064c1226e5a9a243e3800bb Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Thu, 24 Oct 2024 19:15:43 +0100 Subject: [PATCH 11/11] Change made --- instat/dlgStartofRains.vb | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 5b0a42b19e7..ca242b4e7c5 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -73,7 +73,6 @@ Public Class dlgStartofRains Private strWetSpell As String = "wet_spell" Private strFactionEvap As String = "fraction_evap" Private strSumFractionEvap As String = "roll_sum_evap" - 'Private strRollSumRainDryPeriod As String = "roll_sum_rain_dry_period" Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -240,6 +239,14 @@ Public Class dlgStartofRains Dim strRollSumRainDryPeriod As String = "roll_sum_rain_dry_period" Dim strYearType As String = "year_type" + clsRainRollingSumFunction = New RFunction + clsGetlinkeddataFunction = New RFunction + clsVectorFunction = New RFunction + clsGetDataFrameFunction = New RFunction + clsDayFilterCalcFromConvert = New RFunction + clsDayFilterCalcFromList = New RFunction + clsDummyFunction = New RFunction + clsDayFromAndTo.Clear() clsDayFromAndToOperator.Clear() clsGroupByStation.Clear() @@ -297,10 +304,6 @@ Public Class dlgStartofRains clsIsNaFirstDryPeriod.Clear() clsCalcRainRollingSum.Clear() - clsRainRollingSumFunction = New RFunction - clsGetlinkeddataFunction = New RFunction - clsVectorFunction = New RFunction - clsGetDataFrameFunction = New RFunction clsTRWetSpellList.Clear() clsTRWetSpell.Clear() clsTRWetSpellFunction.Clear() @@ -339,13 +342,11 @@ Public Class dlgStartofRains bResetSubdialog = True ucrSelectorForStartofRains.Reset() - clsDayFilterCalcFromConvert = New RFunction clsDayFilterCalcFromConvert.SetRCommand("calc_from_convert") - clsDayFilterCalcFromList = New RFunction + clsDayFilterCalcFromList.SetRCommand("list") clsDayFilterCalcFromConvert.AddParameter("x", clsRFunctionParameter:=clsDayFilterCalcFromList, iPosition:=0) - clsDummyFunction = New RFunction clsDummyFunction.AddParameter("sub2", "True", iPosition:=0) clsDummyFunction.AddParameter("sub3", "True", iPosition:=1) clsDummyFunction.AddParameter("additional", "False", iPosition:=2) @@ -1078,11 +1079,7 @@ Public Class dlgStartofRains End Sub Private Sub AdditionalCondition() - If ucrChkAdditional.Checked Then - cmdAdditionnal.Visible = True - Else - cmdAdditionnal.Visible = False - End If + cmdAdditionnal.Visible = ucrChkAdditional.Checked End Sub Private Sub ucrChkAdditional_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAdditional.ControlValueChanged