diff --git a/instat/UcrGeomListWithAes.designer.vb b/instat/UcrGeomListWithAes.designer.vb index 71af73d59c1..92756749b8a 100644 --- a/instat/UcrGeomListWithAes.designer.vb +++ b/instat/UcrGeomListWithAes.designer.vb @@ -28,6 +28,7 @@ Partial Class UcrGeomListWithParameters Me.ucrReceiverParam5 = New instat.ucrReceiverSingle() Me.grpAesList = New System.Windows.Forms.GroupBox() Me.lblGgParam6 = New System.Windows.Forms.Label() + Me.lblGgParam10 = New System.Windows.Forms.Label() Me.lblGgParam9 = New System.Windows.Forms.Label() Me.lblGgParam8 = New System.Windows.Forms.Label() Me.lblGgParam7 = New System.Windows.Forms.Label() @@ -36,6 +37,7 @@ Partial Class UcrGeomListWithParameters Me.lblGgParam3 = New System.Windows.Forms.Label() Me.lblGgParam2 = New System.Windows.Forms.Label() Me.lblGgParam1 = New System.Windows.Forms.Label() + Me.ucrReceiverParam10 = New instat.ucrReceiverSingle() Me.ucrReceiverParam9 = New instat.ucrReceiverSingle() Me.ucrReceiverParam8 = New instat.ucrReceiverSingle() Me.ucrReceiverParam7 = New instat.ucrReceiverSingle() @@ -47,6 +49,8 @@ Partial Class UcrGeomListWithParameters ' 'UcrSelector ' + Me.UcrSelector.bShowHiddenColumns = False + Me.UcrSelector.bUseCurrentFilter = False Me.UcrSelector.Location = New System.Drawing.Point(3, 56) Me.UcrSelector.Margin = New System.Windows.Forms.Padding(0) Me.UcrSelector.Name = "UcrSelector" @@ -109,6 +113,7 @@ Partial Class UcrGeomListWithParameters 'grpAesList ' Me.grpAesList.Controls.Add(Me.lblGgParam6) + Me.grpAesList.Controls.Add(Me.lblGgParam10) Me.grpAesList.Controls.Add(Me.lblGgParam9) Me.grpAesList.Controls.Add(Me.lblGgParam8) Me.grpAesList.Controls.Add(Me.lblGgParam7) @@ -117,6 +122,7 @@ Partial Class UcrGeomListWithParameters Me.grpAesList.Controls.Add(Me.lblGgParam3) Me.grpAesList.Controls.Add(Me.lblGgParam2) Me.grpAesList.Controls.Add(Me.lblGgParam1) + Me.grpAesList.Controls.Add(Me.ucrReceiverParam10) Me.grpAesList.Controls.Add(Me.ucrReceiverParam9) Me.grpAesList.Controls.Add(Me.ucrReceiverParam8) Me.grpAesList.Controls.Add(Me.ucrReceiverParam1) @@ -128,7 +134,7 @@ Partial Class UcrGeomListWithParameters Me.grpAesList.Controls.Add(Me.ucrReceiverParam2) Me.grpAesList.Location = New System.Drawing.Point(242, 19) Me.grpAesList.Name = "grpAesList" - Me.grpAesList.Size = New System.Drawing.Size(219, 264) + Me.grpAesList.Size = New System.Drawing.Size(219, 296) Me.grpAesList.TabIndex = 9 Me.grpAesList.TabStop = False Me.grpAesList.Text = "Geom Aesthetics" @@ -142,6 +148,15 @@ Partial Class UcrGeomListWithParameters Me.lblGgParam6.TabIndex = 10 Me.lblGgParam6.Text = "label" ' + 'lblGgParam10 + ' + Me.lblGgParam10.AutoSize = True + Me.lblGgParam10.Location = New System.Drawing.Point(6, 267) + Me.lblGgParam10.Name = "lblGgParam10" + Me.lblGgParam10.Size = New System.Drawing.Size(39, 13) + Me.lblGgParam10.TabIndex = 10 + Me.lblGgParam10.Text = "Label2" + ' 'lblGgParam9 ' Me.lblGgParam9.AutoSize = True @@ -214,6 +229,15 @@ Partial Class UcrGeomListWithParameters Me.lblGgParam1.TabIndex = 9 Me.lblGgParam1.Text = "Label1" ' + 'ucrReceiverParam10 + ' + Me.ucrReceiverParam10.Location = New System.Drawing.Point(97, 267) + Me.ucrReceiverParam10.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverParam10.Name = "ucrReceiverParam10" + Me.ucrReceiverParam10.Selector = Nothing + Me.ucrReceiverParam10.Size = New System.Drawing.Size(106, 26) + Me.ucrReceiverParam10.TabIndex = 8 + ' 'ucrReceiverParam9 ' Me.ucrReceiverParam9.Location = New System.Drawing.Point(98, 241) @@ -279,7 +303,7 @@ Partial Class UcrGeomListWithParameters Me.Controls.Add(Me.lblAesList) Me.Controls.Add(Me.UcrSelector) Me.Name = "UcrGeomListWithParameters" - Me.Size = New System.Drawing.Size(467, 286) + Me.Size = New System.Drawing.Size(467, 317) Me.Controls.SetChildIndex(Me.UcrSelector, 0) Me.Controls.SetChildIndex(Me.lblAesList, 0) Me.Controls.SetChildIndex(Me.grpAesList, 0) @@ -314,4 +338,6 @@ Partial Class UcrGeomListWithParameters Friend WithEvents ucrReceiverParam8 As ucrReceiverSingle Friend WithEvents chkApplyOnAllLayers As CheckBox Friend WithEvents chkIgnoreGlobalAes As CheckBox + Friend WithEvents lblGgParam10 As Label + Friend WithEvents ucrReceiverParam10 As ucrReceiverSingle End Class diff --git a/instat/UcrGeomListWithAes.vb b/instat/UcrGeomListWithAes.vb index 0e0e45260ea..77634f4e086 100644 --- a/instat/UcrGeomListWithAes.vb +++ b/instat/UcrGeomListWithAes.vb @@ -59,6 +59,7 @@ Public Class UcrGeomListWithParameters ucrReceiverParam7.Selector = UcrSelector ucrReceiverParam8.Selector = UcrSelector ucrReceiverParam9.Selector = UcrSelector + ucrReceiverParam10.Selector = UcrSelector ucrReceiverParam1.SetMeAsReceiver() End Sub @@ -132,78 +133,92 @@ Public Class UcrGeomListWithParameters Dim i As Integer = 0 If lstAesParameterLabels.Count = 0 Then - lstAesParameterLabels.AddRange({lblGgParam1, lblGgParam2, lblGgParam3, lblGgParam4, lblGgParam5, lblGgParam6, lblGgParam7, lblGgParam8, lblGgParam9}) 'Adds range for the parameter labels + lstAesParameterLabels.AddRange({lblGgParam1, lblGgParam2, lblGgParam3, lblGgParam4, lblGgParam5, lblGgParam6, lblGgParam7, lblGgParam8, lblGgParam9, lblGgParam10}) 'Adds range for the parameter labels End If If lstAesParameterUcr.Count = 0 Then 'Adds range for the parameter receivers - lstAesParameterUcr.AddRange({ucrReceiverParam1, ucrReceiverParam2, ucrReceiverParam3, ucrReceiverParam4, ucrReceiverParam5, ucrReceiverParam6, ucrReceiverParam7, ucrReceiverParam8, ucrReceiverParam9}) + lstAesParameterUcr.AddRange({ucrReceiverParam1, ucrReceiverParam2, ucrReceiverParam3, ucrReceiverParam4, ucrReceiverParam5, ucrReceiverParam6, ucrReceiverParam7, ucrReceiverParam8, ucrReceiverParam9, ucrReceiverParam10}) End If - If clsCurrGeom.clsAesParameters.Count < 9 Then - lblGgParam9.Visible = False - ucrReceiverParam9.Visible = False - Else - lblGgParam9.Visible = True - ucrReceiverParam9.Visible = True - End If + 'Depending on the number of AesParameters in clsCurrGeom, the dialog shows the relevant number of receivers with their (not yet customized) labels. + 'Task/Question: This could be done in a more economical way within a sub that takes as argument j=clsCurrGeom.clsAesParameters.count and goes through the lists lstAesParameterLabels and lstAesParameterUcr and sets the labels and ucr's to visible until index = j, and then hides the rest of the list. Maybe we could also check whether our list of labels and ucr's are long enough here and send a developper message explaining the situation in case not to avoid the bug we had. + 'Task/Question: Could use something like Dim iMaxIndex As Integer = Math.Min((clsCurrGeom.clsAesParameters.Count - 1),(clsAesParameterLabels.Count - 1)), but then instead of using Math.Min we would use our own If Else... in order to identify if there is a scratch. This max index would then be used in population of labels as well. + 'Warning: Moved the check clsCurrGeom IsNot Nothing to here as clsCurrGeom is used below. + If clsCurrGeom IsNot Nothing Then + If clsCurrGeom.clsAesParameters.Count < 10 Then + lblGgParam10.Visible = False + ucrReceiverParam10.Visible = False + Else + lblGgParam10.Visible = True + ucrReceiverParam10.Visible = True + End If - If clsCurrGeom.clsAesParameters.Count < 8 Then - lblGgParam8.Visible = False - ucrReceiverParam8.Visible = False - Else - lblGgParam8.Visible = True - ucrReceiverParam8.Visible = True - End If + If clsCurrGeom.clsAesParameters.Count < 9 Then + lblGgParam9.Visible = False + ucrReceiverParam9.Visible = False + Else + lblGgParam9.Visible = True + ucrReceiverParam9.Visible = True + End If - If clsCurrGeom.clsAesParameters.Count < 7 Then - lblGgParam7.Visible = False - ucrReceiverParam7.Visible = False - Else - lblGgParam7.Visible = True - ucrReceiverParam7.Visible = True - End If - If clsCurrGeom.clsAesParameters.Count < 6 Then - lblGgParam6.Visible = False - ucrReceiverParam6.Visible = False - Else - lblGgParam6.Visible = True - ucrReceiverParam6.Visible = True - End If - If clsCurrGeom.clsAesParameters.Count < 5 Then - lblGgParam5.Visible = False - ucrReceiverParam5.Visible = False - Else - lblGgParam5.Visible = True - ucrReceiverParam5.Visible = True - End If + If clsCurrGeom.clsAesParameters.Count < 8 Then + lblGgParam8.Visible = False + ucrReceiverParam8.Visible = False + Else + lblGgParam8.Visible = True + ucrReceiverParam8.Visible = True + End If - If clsCurrGeom.clsAesParameters.Count < 4 Then - lblGgParam4.Visible = False - ucrReceiverParam4.Visible = False - Else - lblGgParam4.Visible = True - ucrReceiverParam4.Visible = True - End If + If clsCurrGeom.clsAesParameters.Count < 7 Then + lblGgParam7.Visible = False + ucrReceiverParam7.Visible = False + Else + lblGgParam7.Visible = True + ucrReceiverParam7.Visible = True + End If + If clsCurrGeom.clsAesParameters.Count < 6 Then + lblGgParam6.Visible = False + ucrReceiverParam6.Visible = False + Else + lblGgParam6.Visible = True + ucrReceiverParam6.Visible = True + End If + If clsCurrGeom.clsAesParameters.Count < 5 Then + lblGgParam5.Visible = False + ucrReceiverParam5.Visible = False + Else + lblGgParam5.Visible = True + ucrReceiverParam5.Visible = True + End If - If clsCurrGeom.clsAesParameters.Count < 3 Then - lblGgParam3.Visible = False - ucrReceiverParam3.Visible = False - Else - lblGgParam3.Visible = True - ucrReceiverParam3.Visible = True - End If + If clsCurrGeom.clsAesParameters.Count < 4 Then + lblGgParam4.Visible = False + ucrReceiverParam4.Visible = False + Else + lblGgParam4.Visible = True + ucrReceiverParam4.Visible = True + End If + + If clsCurrGeom.clsAesParameters.Count < 3 Then + lblGgParam3.Visible = False + ucrReceiverParam3.Visible = False + Else + lblGgParam3.Visible = True + ucrReceiverParam3.Visible = True + End If + + If clsCurrGeom.clsAesParameters.Count < 2 Then 'this is available for some cases like piechart + lblGgParam2.Visible = False + ucrReceiverParam2.Visible = False + Else + lblGgParam2.Visible = True + ucrReceiverParam2.Visible = True + End If + + 'populating labels with appropriate names + clsGeomAesFunction.ClearParameters() - If clsCurrGeom.clsAesParameters.Count < 2 Then 'this is available for some cases like piechart - lblGgParam2.Visible = False - ucrReceiverParam2.Visible = False - Else - lblGgParam2.Visible = True - ucrReceiverParam2.Visible = True - End If - 'populating labels with appropriate names - clsGeomAesFunction.ClearParameters() - If clsCurrGeom IsNot Nothing Then lstCurrArguments.Clear() For i = 0 To (clsCurrGeom.clsAesParameters.Count - 1) lstAesParameterLabels(i).Text = clsCurrGeom.clsAesParameters(i).strAesParameterName @@ -220,6 +235,7 @@ Public Class UcrGeomListWithParameters lstAesParameterUcr(i).SetExcludedDataTypes(clsCurrGeom.clsAesParameters(i).strExcludedDataTypes) End If Next + Else 'Question: Maybe add a developer error message when clsCurrGeom Is Nothing ? Should that not never be the case here ? End If SetAes(bCurrentFixAes) End Sub @@ -233,7 +249,7 @@ Public Class UcrGeomListWithParameters SetParameters() End Sub - Private Sub ucrReceiverParam_WithMeSelectionChanged(ucrChangedReceiver As ucrReceiverSingle) Handles ucrReceiverParam1.WithMeSelectionChanged, ucrReceiverParam2.WithMeSelectionChanged, ucrReceiverParam3.WithMeSelectionChanged, ucrReceiverParam4.WithMeSelectionChanged, ucrReceiverParam5.WithMeSelectionChanged, ucrReceiverParam6.WithMeSelectionChanged, ucrReceiverParam7.WithMeSelectionChanged, ucrReceiverParam8.WithMeSelectionChanged, ucrReceiverParam9.WithMeSelectionChanged + Private Sub ucrReceiverParam_WithMeSelectionChanged(ucrChangedReceiver As ucrReceiverSingle) Handles ucrReceiverParam1.WithMeSelectionChanged, ucrReceiverParam2.WithMeSelectionChanged, ucrReceiverParam3.WithMeSelectionChanged, ucrReceiverParam4.WithMeSelectionChanged, ucrReceiverParam5.WithMeSelectionChanged, ucrReceiverParam6.WithMeSelectionChanged, ucrReceiverParam7.WithMeSelectionChanged, ucrReceiverParam8.WithMeSelectionChanged, ucrReceiverParam9.WithMeSelectionChanged, ucrReceiverParam10.WithMeSelectionChanged Dim iIndex As Integer If bAddToLocalAes Then diff --git a/instat/dlgBoxPlot.vb b/instat/dlgBoxPlot.vb index 993a34f56cb..ff25cad156d 100644 --- a/instat/dlgBoxPlot.vb +++ b/instat/dlgBoxPlot.vb @@ -47,6 +47,7 @@ Public Class dlgBoxplot ucrSelectorBoxPlot.Focus() ucrVariablesAsFactorForBoxplot.ResetControl() chkHorizontalBoxplot.Checked = False + ucrSaveBoxplot.Reset() sdgPlots.Reset() TestOkEnabled() SetXParameter() @@ -86,7 +87,6 @@ Public Class dlgBoxplot End Sub Private Sub TestOkEnabled() - If ucrVariablesAsFactorForBoxplot.IsEmpty Or (ucrSaveBoxplot.chkSaveGraph.Checked And ucrSaveBoxplot.ucrInputGraphName.IsEmpty) Then ucrBase.OKEnabled(False) Else @@ -170,4 +170,8 @@ Public Class dlgBoxplot End If TestOkEnabled() End Sub + + Private Sub ucrSaveBoxplot_ContentsChanged() Handles ucrSaveBoxplot.ContentsChanged + TestOkEnabled() + End Sub End Class \ No newline at end of file diff --git a/instat/dlgClimdex.Designer.vb b/instat/dlgClimdex.Designer.vb index 3dd163276a7..681a61e597d 100644 --- a/instat/dlgClimdex.Designer.vb +++ b/instat/dlgClimdex.Designer.vb @@ -1,9 +1,9 @@ - _ + Partial Class dlgClimdex Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. - _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then @@ -20,33 +20,421 @@ Partial Class dlgClimdex 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. - _ + Private Sub InitializeComponent() + Me.lblTmax = New System.Windows.Forms.Label() + Me.lblTmin = New System.Windows.Forms.Label() + Me.lblPrec = New System.Windows.Forms.Label() + Me.cmdClimdexOptions = New System.Windows.Forms.Button() + Me.lblBaseRangeFrom = New System.Windows.Forms.Label() + Me.nudYearFrom = New System.Windows.Forms.NumericUpDown() + Me.nudYearTo = New System.Windows.Forms.NumericUpDown() + Me.lblBaseRangeTo = New System.Windows.Forms.Label() + Me.lblN = New System.Windows.Forms.Label() + Me.nudN = New System.Windows.Forms.NumericUpDown() + Me.chkNHemisphere = New System.Windows.Forms.CheckBox() + Me.lblAnnual = New System.Windows.Forms.Label() + Me.nudMothlyMissingDays = New System.Windows.Forms.NumericUpDown() + Me.nudAnnualMissingDays = New System.Windows.Forms.NumericUpDown() + Me.lblMonthly = New System.Windows.Forms.Label() + Me.grpBaseRange = New System.Windows.Forms.GroupBox() + Me.grpMaxMissingDays = New System.Windows.Forms.GroupBox() + Me.lblMinBaseData = New System.Windows.Forms.Label() + Me.nudMinBaseData = New System.Windows.Forms.NumericUpDown() + Me.lblTempQuantiles = New System.Windows.Forms.Label() + Me.lblPrecQuantiles = New System.Windows.Forms.Label() + Me.lblFreq = New System.Windows.Forms.Label() + Me.ucrInputFreq = New instat.ucrInputComboBox() + Me.ucrMultipleInputTempQtiles = New instat.ucrMultipleInput() + Me.ucrMultipleInputPrecQtiles = New instat.ucrMultipleInput() + Me.ucrReceiverPrec = New instat.ucrReceiverSingle() + Me.ucrReceiverTmin = New instat.ucrReceiverSingle() + Me.ucrReceiverTmax = New instat.ucrReceiverSingle() + Me.ucrSelectorClimdex = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBaseClimdex = New instat.ucrButtons() + CType(Me.nudYearFrom, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudYearTo, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudN, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudMothlyMissingDays, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudAnnualMissingDays, System.ComponentModel.ISupportInitialize).BeginInit() + Me.grpBaseRange.SuspendLayout() + Me.grpMaxMissingDays.SuspendLayout() + CType(Me.nudMinBaseData, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' + 'lblTmax + ' + Me.lblTmax.AutoSize = True + Me.lblTmax.Location = New System.Drawing.Point(332, 6) + Me.lblTmax.Name = "lblTmax" + Me.lblTmax.Size = New System.Drawing.Size(33, 13) + Me.lblTmax.TabIndex = 1 + Me.lblTmax.Tag = "Tmax" + Me.lblTmax.Text = "Tmax" + ' + 'lblTmin + ' + Me.lblTmin.AutoSize = True + Me.lblTmin.Location = New System.Drawing.Point(333, 53) + Me.lblTmin.Name = "lblTmin" + Me.lblTmin.Size = New System.Drawing.Size(30, 13) + Me.lblTmin.TabIndex = 3 + Me.lblTmin.Tag = "Tmin" + Me.lblTmin.Text = "Tmin" + ' + 'lblPrec + ' + Me.lblPrec.AutoSize = True + Me.lblPrec.Location = New System.Drawing.Point(334, 97) + Me.lblPrec.Name = "lblPrec" + Me.lblPrec.Size = New System.Drawing.Size(29, 13) + Me.lblPrec.TabIndex = 5 + Me.lblPrec.Tag = "Prec" + Me.lblPrec.Text = "Prec" + ' + 'cmdClimdexOptions + ' + Me.cmdClimdexOptions.Location = New System.Drawing.Point(293, 321) + Me.cmdClimdexOptions.Name = "cmdClimdexOptions" + Me.cmdClimdexOptions.Size = New System.Drawing.Size(111, 23) + Me.cmdClimdexOptions.TabIndex = 20 + Me.cmdClimdexOptions.Tag = "Climdex_Options..." + Me.cmdClimdexOptions.Text = "Climdex Options..." + Me.cmdClimdexOptions.UseVisualStyleBackColor = True + ' + 'lblBaseRangeFrom + ' + Me.lblBaseRangeFrom.AutoSize = True + Me.lblBaseRangeFrom.Location = New System.Drawing.Point(7, 22) + Me.lblBaseRangeFrom.Name = "lblBaseRangeFrom" + Me.lblBaseRangeFrom.Size = New System.Drawing.Size(30, 13) + Me.lblBaseRangeFrom.TabIndex = 0 + Me.lblBaseRangeFrom.Tag = "From" + Me.lblBaseRangeFrom.Text = "From" + ' + 'nudYearFrom + ' + Me.nudYearFrom.Location = New System.Drawing.Point(43, 20) + Me.nudYearFrom.Maximum = New Decimal(New Integer() {9999, 0, 0, 0}) + Me.nudYearFrom.Minimum = New Decimal(New Integer() {1900, 0, 0, 0}) + Me.nudYearFrom.Name = "nudYearFrom" + Me.nudYearFrom.Size = New System.Drawing.Size(47, 20) + Me.nudYearFrom.TabIndex = 1 + Me.nudYearFrom.Value = New Decimal(New Integer() {1961, 0, 0, 0}) + ' + 'nudYearTo + ' + Me.nudYearTo.Location = New System.Drawing.Point(121, 19) + Me.nudYearTo.Maximum = New Decimal(New Integer() {9999, 0, 0, 0}) + Me.nudYearTo.Minimum = New Decimal(New Integer() {1900, 0, 0, 0}) + Me.nudYearTo.Name = "nudYearTo" + Me.nudYearTo.Size = New System.Drawing.Size(47, 20) + Me.nudYearTo.TabIndex = 3 + Me.nudYearTo.Value = New Decimal(New Integer() {1990, 0, 0, 0}) + ' + 'lblBaseRangeTo + ' + Me.lblBaseRangeTo.AutoSize = True + Me.lblBaseRangeTo.Location = New System.Drawing.Point(96, 22) + Me.lblBaseRangeTo.Name = "lblBaseRangeTo" + Me.lblBaseRangeTo.Size = New System.Drawing.Size(20, 13) + Me.lblBaseRangeTo.TabIndex = 2 + Me.lblBaseRangeTo.Tag = "To" + Me.lblBaseRangeTo.Text = "To" + ' + 'lblN + ' + Me.lblN.AutoSize = True + Me.lblN.Location = New System.Drawing.Point(278, 197) + Me.lblN.Name = "lblN" + Me.lblN.Size = New System.Drawing.Size(93, 13) + Me.lblN.TabIndex = 10 + Me.lblN.Tag = "Days_for_Quantiles" + Me.lblN.Text = "Days for Quantiles" + ' + 'nudN + ' + Me.nudN.Location = New System.Drawing.Point(381, 194) + Me.nudN.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudN.Name = "nudN" + Me.nudN.Size = New System.Drawing.Size(36, 20) + Me.nudN.TabIndex = 11 + Me.nudN.Value = New Decimal(New Integer() {5, 0, 0, 0}) + ' + 'chkNHemisphere + ' + Me.chkNHemisphere.AutoSize = True + Me.chkNHemisphere.Location = New System.Drawing.Point(10, 301) + Me.chkNHemisphere.Name = "chkNHemisphere" + Me.chkNHemisphere.Size = New System.Drawing.Size(126, 17) + Me.chkNHemisphere.TabIndex = 16 + Me.chkNHemisphere.Tag = "Northern_Hemisphere" + Me.chkNHemisphere.Text = "Northern Hemisphere" + Me.chkNHemisphere.UseVisualStyleBackColor = True + ' + 'lblAnnual + ' + Me.lblAnnual.AutoSize = True + Me.lblAnnual.Location = New System.Drawing.Point(7, 19) + Me.lblAnnual.Name = "lblAnnual" + Me.lblAnnual.Size = New System.Drawing.Size(40, 13) + Me.lblAnnual.TabIndex = 0 + Me.lblAnnual.Tag = "Annual" + Me.lblAnnual.Text = "Annual" + ' + 'nudMothlyMissingDays + ' + Me.nudMothlyMissingDays.Location = New System.Drawing.Point(156, 17) + Me.nudMothlyMissingDays.Maximum = New Decimal(New Integer() {31, 0, 0, 0}) + Me.nudMothlyMissingDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudMothlyMissingDays.Name = "nudMothlyMissingDays" + Me.nudMothlyMissingDays.Size = New System.Drawing.Size(47, 20) + Me.nudMothlyMissingDays.TabIndex = 3 + Me.nudMothlyMissingDays.Value = New Decimal(New Integer() {3, 0, 0, 0}) + ' + 'nudAnnualMissingDays + ' + Me.nudAnnualMissingDays.Location = New System.Drawing.Point(53, 17) + Me.nudAnnualMissingDays.Maximum = New Decimal(New Integer() {366, 0, 0, 0}) + Me.nudAnnualMissingDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudAnnualMissingDays.Name = "nudAnnualMissingDays" + Me.nudAnnualMissingDays.Size = New System.Drawing.Size(47, 20) + Me.nudAnnualMissingDays.TabIndex = 1 + Me.nudAnnualMissingDays.Value = New Decimal(New Integer() {15, 0, 0, 0}) + ' + 'lblMonthly + ' + Me.lblMonthly.AutoSize = True + Me.lblMonthly.Location = New System.Drawing.Point(106, 19) + Me.lblMonthly.Name = "lblMonthly" + Me.lblMonthly.Size = New System.Drawing.Size(44, 13) + Me.lblMonthly.TabIndex = 2 + Me.lblMonthly.Tag = "Monthly" + Me.lblMonthly.Text = "Monthly" + ' + 'grpBaseRange + ' + Me.grpBaseRange.Controls.Add(Me.nudYearFrom) + Me.grpBaseRange.Controls.Add(Me.nudYearTo) + Me.grpBaseRange.Controls.Add(Me.lblBaseRangeTo) + Me.grpBaseRange.Controls.Add(Me.lblBaseRangeFrom) + Me.grpBaseRange.Location = New System.Drawing.Point(10, 196) + Me.grpBaseRange.Name = "grpBaseRange" + Me.grpBaseRange.Size = New System.Drawing.Size(174, 46) + Me.grpBaseRange.TabIndex = 9 + Me.grpBaseRange.TabStop = False + Me.grpBaseRange.Tag = "Base_Range" + Me.grpBaseRange.Text = "Base Range" + ' + 'grpMaxMissingDays + ' + Me.grpMaxMissingDays.Controls.Add(Me.nudMothlyMissingDays) + Me.grpMaxMissingDays.Controls.Add(Me.lblMonthly) + Me.grpMaxMissingDays.Controls.Add(Me.lblAnnual) + Me.grpMaxMissingDays.Controls.Add(Me.nudAnnualMissingDays) + Me.grpMaxMissingDays.Location = New System.Drawing.Point(10, 247) + Me.grpMaxMissingDays.Name = "grpMaxMissingDays" + Me.grpMaxMissingDays.Size = New System.Drawing.Size(216, 46) + Me.grpMaxMissingDays.TabIndex = 13 + Me.grpMaxMissingDays.TabStop = False + Me.grpMaxMissingDays.Tag = "Maximum_Missing_Days" + Me.grpMaxMissingDays.Text = "Maximum Missing Days" + ' + 'lblMinBaseData + ' + Me.lblMinBaseData.AutoSize = True + Me.lblMinBaseData.Location = New System.Drawing.Point(10, 326) + Me.lblMinBaseData.Name = "lblMinBaseData" + Me.lblMinBaseData.Size = New System.Drawing.Size(193, 13) + Me.lblMinBaseData.TabIndex = 18 + Me.lblMinBaseData.Tag = "Minimum_Fraction_of_Base_Data_ Present" + Me.lblMinBaseData.Text = "Minimum Fraction of Base Data Present" + ' + 'nudMinBaseData + ' + Me.nudMinBaseData.DecimalPlaces = 1 + Me.nudMinBaseData.Increment = New Decimal(New Integer() {1, 0, 0, 65536}) + Me.nudMinBaseData.Location = New System.Drawing.Point(216, 322) + Me.nudMinBaseData.Maximum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudMinBaseData.Name = "nudMinBaseData" + Me.nudMinBaseData.Size = New System.Drawing.Size(36, 20) + Me.nudMinBaseData.TabIndex = 19 + Me.nudMinBaseData.Value = New Decimal(New Integer() {1, 0, 0, 65536}) + ' + 'lblTempQuantiles + ' + Me.lblTempQuantiles.AutoSize = True + Me.lblTempQuantiles.Location = New System.Drawing.Point(291, 221) + Me.lblTempQuantiles.Name = "lblTempQuantiles" + Me.lblTempQuantiles.Size = New System.Drawing.Size(114, 13) + Me.lblTempQuantiles.TabIndex = 12 + Me.lblTempQuantiles.Tag = "Temperature_Quantiles" + Me.lblTempQuantiles.Text = "Temperature Quantiles" + ' + 'lblPrecQuantiles + ' + Me.lblPrecQuantiles.AutoSize = True + Me.lblPrecQuantiles.Location = New System.Drawing.Point(292, 269) + Me.lblPrecQuantiles.Name = "lblPrecQuantiles" + Me.lblPrecQuantiles.Size = New System.Drawing.Size(112, 13) + Me.lblPrecQuantiles.TabIndex = 15 + Me.lblPrecQuantiles.Tag = "Precipitation_Quantiles" + Me.lblPrecQuantiles.Text = "Precipitation Quantiles" + ' + 'lblFreq + ' + Me.lblFreq.AutoSize = True + Me.lblFreq.Location = New System.Drawing.Point(320, 143) + Me.lblFreq.Name = "lblFreq" + Me.lblFreq.Size = New System.Drawing.Size(57, 13) + Me.lblFreq.TabIndex = 7 + Me.lblFreq.Tag = "Frequency" + Me.lblFreq.Text = "Frequency" + ' + 'ucrInputFreq + ' + Me.ucrInputFreq.IsReadOnly = False + Me.ucrInputFreq.Location = New System.Drawing.Point(280, 164) + Me.ucrInputFreq.Name = "ucrInputFreq" + Me.ucrInputFreq.Size = New System.Drawing.Size(137, 21) + Me.ucrInputFreq.TabIndex = 8 + ' + 'ucrMultipleInputTempQtiles + ' + Me.ucrMultipleInputTempQtiles.Location = New System.Drawing.Point(273, 239) + Me.ucrMultipleInputTempQtiles.Name = "ucrMultipleInputTempQtiles" + Me.ucrMultipleInputTempQtiles.Size = New System.Drawing.Size(150, 29) + Me.ucrMultipleInputTempQtiles.TabIndex = 14 + ' + 'ucrMultipleInputPrecQtiles + ' + Me.ucrMultipleInputPrecQtiles.Location = New System.Drawing.Point(273, 286) + Me.ucrMultipleInputPrecQtiles.Name = "ucrMultipleInputPrecQtiles" + Me.ucrMultipleInputPrecQtiles.Size = New System.Drawing.Size(150, 29) + Me.ucrMultipleInputPrecQtiles.TabIndex = 17 + ' + 'ucrReceiverPrec + ' + Me.ucrReceiverPrec.Location = New System.Drawing.Point(288, 114) + Me.ucrReceiverPrec.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverPrec.Name = "ucrReceiverPrec" + Me.ucrReceiverPrec.Selector = Nothing + Me.ucrReceiverPrec.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverPrec.TabIndex = 6 + ' + 'ucrReceiverTmin + ' + Me.ucrReceiverTmin.Location = New System.Drawing.Point(288, 71) + Me.ucrReceiverTmin.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverTmin.Name = "ucrReceiverTmin" + Me.ucrReceiverTmin.Selector = Nothing + Me.ucrReceiverTmin.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverTmin.TabIndex = 4 + ' + 'ucrReceiverTmax + ' + Me.ucrReceiverTmax.Location = New System.Drawing.Point(288, 24) + Me.ucrReceiverTmax.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverTmax.Name = "ucrReceiverTmax" + Me.ucrReceiverTmax.Selector = Nothing + Me.ucrReceiverTmax.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverTmax.TabIndex = 2 + ' + 'ucrSelectorClimdex + ' + Me.ucrSelectorClimdex.bShowHiddenColumns = False + Me.ucrSelectorClimdex.bUseCurrentFilter = False + Me.ucrSelectorClimdex.Location = New System.Drawing.Point(10, 9) + Me.ucrSelectorClimdex.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorClimdex.Name = "ucrSelectorClimdex" + Me.ucrSelectorClimdex.Size = New System.Drawing.Size(210, 180) + Me.ucrSelectorClimdex.TabIndex = 0 + ' 'ucrBaseClimdex ' - Me.ucrBaseClimdex.Location = New System.Drawing.Point(12, 197) + Me.ucrBaseClimdex.Location = New System.Drawing.Point(10, 346) Me.ucrBaseClimdex.Name = "ucrBaseClimdex" Me.ucrBaseClimdex.Size = New System.Drawing.Size(410, 52) - Me.ucrBaseClimdex.TabIndex = 0 + Me.ucrBaseClimdex.TabIndex = 21 ' 'dlgClimdex ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(412, 261) + Me.ClientSize = New System.Drawing.Size(424, 402) + Me.Controls.Add(Me.ucrInputFreq) + Me.Controls.Add(Me.lblFreq) + Me.Controls.Add(Me.ucrMultipleInputTempQtiles) + Me.Controls.Add(Me.ucrMultipleInputPrecQtiles) + Me.Controls.Add(Me.lblPrecQuantiles) + Me.Controls.Add(Me.lblTempQuantiles) + Me.Controls.Add(Me.lblMinBaseData) + Me.Controls.Add(Me.nudMinBaseData) + Me.Controls.Add(Me.grpMaxMissingDays) + Me.Controls.Add(Me.grpBaseRange) + Me.Controls.Add(Me.chkNHemisphere) + Me.Controls.Add(Me.lblN) + Me.Controls.Add(Me.nudN) + Me.Controls.Add(Me.cmdClimdexOptions) + Me.Controls.Add(Me.lblPrec) + Me.Controls.Add(Me.lblTmin) + Me.Controls.Add(Me.lblTmax) + Me.Controls.Add(Me.ucrReceiverPrec) + Me.Controls.Add(Me.ucrReceiverTmin) + Me.Controls.Add(Me.ucrReceiverTmax) + Me.Controls.Add(Me.ucrSelectorClimdex) Me.Controls.Add(Me.ucrBaseClimdex) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "dlgClimdex" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent Me.Tag = "Climdex" Me.Text = "Climdex" + CType(Me.nudYearFrom, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudYearTo, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudN, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudMothlyMissingDays, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudAnnualMissingDays, System.ComponentModel.ISupportInitialize).EndInit() + Me.grpBaseRange.ResumeLayout(False) + Me.grpBaseRange.PerformLayout() + Me.grpMaxMissingDays.ResumeLayout(False) + Me.grpMaxMissingDays.PerformLayout() + CType(Me.nudMinBaseData, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) + Me.PerformLayout() End Sub Friend WithEvents ucrBaseClimdex As ucrButtons -End Class + + Friend WithEvents ucrSelectorClimdex As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrReceiverTmax As ucrReceiverSingle + Friend WithEvents ucrReceiverTmin As ucrReceiverSingle + Friend WithEvents ucrReceiverPrec As ucrReceiverSingle + Friend WithEvents lblTmax As Label + Friend WithEvents lblTmin As Label + Friend WithEvents lblPrec As Label + Friend WithEvents cmdClimdexOptions As Button + Friend WithEvents lblBaseRangeFrom As Label + Friend WithEvents nudYearFrom As NumericUpDown + Friend WithEvents nudYearTo As NumericUpDown + Friend WithEvents lblBaseRangeTo As Label + Friend WithEvents lblN As Label + Friend WithEvents nudN As NumericUpDown + Friend WithEvents chkNHemisphere As CheckBox + Friend WithEvents lblAnnual As Label + Friend WithEvents nudMothlyMissingDays As NumericUpDown + Friend WithEvents nudAnnualMissingDays As NumericUpDown + Friend WithEvents lblMonthly As Label + Friend WithEvents grpBaseRange As GroupBox + Friend WithEvents grpMaxMissingDays As GroupBox + Friend WithEvents lblMinBaseData As Label + Friend WithEvents nudMinBaseData As NumericUpDown + Friend WithEvents lblTempQuantiles As Label + Friend WithEvents lblPrecQuantiles As Label + Friend WithEvents ucrMultipleInputPrecQtiles As ucrMultipleInput + Friend WithEvents ucrMultipleInputTempQtiles As ucrMultipleInput + Friend WithEvents lblFreq As Label + Friend WithEvents ucrInputFreq As ucrInputComboBox +End Class \ No newline at end of file diff --git a/instat/dlgClimdex.vb b/instat/dlgClimdex.vb index 163c69afd55..efc6f924f05 100644 --- a/instat/dlgClimdex.vb +++ b/instat/dlgClimdex.vb @@ -13,10 +13,194 @@ ' ' You should have received a copy of the GNU General Public License k ' along with this program. If not, see . - Imports instat.Translations Public Class dlgClimdex + Public clsRClimdexInput, clsRMaxMisingDays, clsRTmax, clsRTmin, clsRPrec As New RFunction + Private bFirstLoad As Boolean = True + Private Sub dlgClimdex_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) + If bFirstLoad Then + InitialiseDialog() + SetDefaults() + bFirstLoad = False + Else + ReopenDialog() + End If + End Sub + + Private Sub SetDefaults() + ucrSelectorClimdex.Reset() + ucrSelectorClimdex.Focus() + ucrReceiverTmax.SetMeAsReceiver() + sdgClimdexIndices.SetDefaults() + chkNHemisphere.Checked = True + nudYearFrom.Value = 1961 + nudYearTo.Value = 1990 + nudN.Value = 5 + nudAnnualMissingDays.Value = 15 + nudMothlyMissingDays.Value = 3 + nudMinBaseData.Value = 0.1 + ucrInputFreq.cboInput.SelectedItem = "annual" + ucrMultipleInputPrecQtiles.txtNumericItems.Text = "0.95, 0.99" + ucrMultipleInputTempQtiles.txtNumericItems.Text = "0.1, 0.9" + TestOkEnabled() + End Sub + + Private Sub InitialiseDialog() + clsRClimdexInput.SetRCommand("climdexInput.raw") + clsRMaxMisingDays.SetRCommand("c") + clsRTmax.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data") + clsRTmin.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data") + clsRPrec.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data") + ucrMultipleInputTempQtiles.bIsNumericInput = True + ucrMultipleInputPrecQtiles.bIsNumericInput = True + 'ucrBase.iHelpTopicID = 436 + 'ucrBaseClimdex.clsRsyntax.iCallType = 0 + ucrReceiverTmax.Selector = ucrSelectorClimdex + ucrReceiverTmin.Selector = ucrSelectorClimdex + ucrReceiverPrec.Selector = ucrSelectorClimdex + ucrInputFreq.SetItems({"monthly", "annual"}) + + End Sub + + Private Sub TestOkEnabled() + If ucrReceiverTmax.IsEmpty AndAlso ucrReceiverTmin.IsEmpty AndAlso ucrReceiverPrec.IsEmpty Then + ucrBaseClimdex.OKEnabled(False) + Else + ucrBaseClimdex.OKEnabled(True) + End If + End Sub + + Private Sub ReopenDialog() + End Sub + + Private Sub ucrBaseClimdex_ClickReset(sender As Object, e As EventArgs) Handles ucrBaseClimdex.ClickReset + SetDefaults() + End Sub + + Private Sub ucrReceiverTmax_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverTmax.SelectionChanged + clsRTmax.AddParameter("data_name", Chr(34) & ucrSelectorClimdex.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) + If Not ucrReceiverTmax.IsEmpty Then + clsRTmax.AddParameter("col_name", ucrReceiverTmax.GetVariableNames()) + clsRClimdexInput.AddParameter("tmax", clsRFunctionParameter:=clsRTmax) + clsRClimdexInput.AddParameter("tmax.dates", "as.PCICt(do.call(paste, climdex_data[,c(" & Chr(34) & "year" & Chr(34) & "," & Chr(34) & "jday" & Chr(34) & ")]), format=" & Chr(34) & "%Y %j" & Chr(34) & ", cal=" & Chr(34) & "gregorian" & Chr(34) & ")") + Else + clsRClimdexInput.RemoveParameterByName("tmax") + clsRClimdexInput.RemoveParameterByName("tmax.dates") + End If + TestOkEnabled() + End Sub + + Private Sub ucrReceiverTmin_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverTmin.SelectionChanged + clsRTmin.AddParameter("data_name", Chr(34) & ucrSelectorClimdex.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) + If Not ucrReceiverTmin.IsEmpty Then + clsRTmin.AddParameter("col_name", ucrReceiverTmin.GetVariableNames()) + clsRClimdexInput.AddParameter("tmin", clsRFunctionParameter:=clsRTmin) + clsRClimdexInput.AddParameter("tmin.dates", "as.PCICt(do.call(paste, climdex_data[,c(" & Chr(34) & "year" & Chr(34) & "," & Chr(34) & "jday" & Chr(34) & ")]), format=" & Chr(34) & "%Y %j" & Chr(34) & ", cal=" & Chr(34) & "gregorian" & Chr(34) & ")") + Else + clsRClimdexInput.RemoveParameterByName("tmin") + clsRClimdexInput.RemoveParameterByName("tmin.dates") + End If + TestOkEnabled() + End Sub + + Private Sub ucrReceiverPrec_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverPrec.SelectionChanged + clsRPrec.AddParameter("data_name", Chr(34) & ucrSelectorClimdex.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) + If Not ucrReceiverPrec.IsEmpty Then + clsRPrec.AddParameter("col_name", ucrReceiverPrec.GetVariableNames()) + clsRClimdexInput.AddParameter("prec", clsRFunctionParameter:=clsRPrec) + clsRClimdexInput.AddParameter("prec.dates", "as.PCICt(do.call(paste, climdex_data[,c(" & Chr(34) & "year" & Chr(34) & "," & Chr(34) & "jday" & Chr(34) & ")]), format=" & Chr(34) & "%Y %j" & Chr(34) & ", cal=" & Chr(34) & "gregorian" & Chr(34) & ")") + Else + clsRClimdexInput.RemoveParameterByName("prec") + clsRClimdexInput.RemoveParameterByName("prec.dates") + End If + TestOkEnabled() + End Sub + + Private Sub cmdClimdexIndices_Click(sender As Object, e As EventArgs) Handles cmdClimdexOptions.Click + sdgClimdexIndices.ShowDialog() + End Sub + + Private Sub ucrBaseClimdex_clickok(sender As Object, e As EventArgs) Handles ucrBaseClimdex.ClickOk + sdgClimdexIndices.IndicesOptions() + End Sub + + Private Sub nudYearFromTo_ValueChanged(sender As Object, e As EventArgs) Handles nudYearFrom.ValueChanged, nudYearTo.ValueChanged + clsRClimdexInput.AddParameter("base.range", "c(" & nudYearFrom.Value & "," & nudYearTo.Value & ")") + If nudYearFrom.Value = 1961 AndAlso nudYearTo.Value = 1990 Then + clsRClimdexInput.RemoveParameterByName("base.range") + End If + End Sub + + Private Sub nudN_ValueChanged(sender As Object, e As EventArgs) Handles nudN.ValueChanged + clsRClimdexInput.AddParameter("n", nudN.Value) + If nudN.Value = 5 Then + clsRClimdexInput.RemoveParameterByName("n") + End If + End Sub + + Private Sub chkNHemisphere_CheckedChanged(sender As Object, e As EventArgs) Handles chkNHemisphere.CheckedChanged + If chkNHemisphere.Checked Then + clsRClimdexInput.RemoveParameterByName("northern.hemisphere") + Else + clsRClimdexInput.AddParameter("northern.hemisphere", "FALSE") + End If + End Sub + + Private Sub nudAnnualMaxMissingDays_ValueChanged(sender As Object, e As EventArgs) Handles nudAnnualMissingDays.ValueChanged + clsRMaxMisingDays.AddParameter("annual", nudAnnualMissingDays.Value) + If nudAnnualMissingDays.Value = 15 AndAlso nudMothlyMissingDays.Value = 3 Then + clsRClimdexInput.RemoveParameterByName("max.missing.days") + Else + clsRClimdexInput.AddParameter("max.missing.days", clsRFunctionParameter:=clsRMaxMisingDays) + End If + End Sub + + Private Sub ucrInputFreq_Load(sender As Object, e As EventArgs) Handles ucrInputFreq.Load + + End Sub + + Private Sub nudMonthlyMaxMissingDays_ValueChanged(sender As Object, e As EventArgs) Handles nudMothlyMissingDays.ValueChanged + clsRMaxMisingDays.AddParameter("monthly", nudMothlyMissingDays.Value) + If nudAnnualMissingDays.Value = 15 AndAlso nudMothlyMissingDays.Value = 3 Then + clsRClimdexInput.RemoveParameterByName("max.missing.days") + Else + clsRClimdexInput.AddParameter("max.missing.days", clsRFunctionParameter:=clsRMaxMisingDays) + End If + End Sub + + Private Sub nudMinBaseData_ValueChanged(sender As Object, e As EventArgs) Handles nudMinBaseData.ValueChanged + clsRClimdexInput.AddParameter("min.base.data.fraction.present ", nudMinBaseData.Value) + If nudMinBaseData.Value = 0.1 Then + clsRClimdexInput.RemoveParameterByName("min.base.data.fraction.present ") + End If + End Sub + + Private Sub ucrMultipleInputPrecQtiles_Leave(sender As Object, e As EventArgs) Handles ucrMultipleInputPrecQtiles.Leave + If ucrMultipleInputPrecQtiles.txtNumericItems.Text <> "0.95, 0.99" Then + clsRClimdexInput.AddParameter("prec.qtiles", ucrMultipleInputPrecQtiles.clsNumericList.ToScript) + Else + clsRClimdexInput.RemoveParameterByName("prec.qtiles") + End If + End Sub + + Private Sub ucrMultipleInputTempQtiles_Leave(sender As Object, e As EventArgs) Handles ucrMultipleInputTempQtiles.Leave + If ucrMultipleInputTempQtiles.txtNumericItems.Text <> "0.1, 0.9" Then + clsRClimdexInput.AddParameter("temp.qtiles", ucrMultipleInputTempQtiles.clsNumericList.ToScript) + Else + clsRClimdexInput.RemoveParameterByName("temp.qtiles") + End If + End Sub + + Private Sub ucrInputFreq_Leave(sender As Object, e As EventArgs) Handles ucrInputFreq.Leave + Select Case ucrInputFreq.GetText + Case "annual" + sdgClimdexIndices.clsRTwoArg1.AddParameter("freq", Chr(34) & "annual" & Chr(34)) + sdgClimdexIndices.clsRThreeArg.AddParameter("freq", Chr(34) & "annual" & Chr(34)) + Case "monthly" + sdgClimdexIndices.clsRTwoArg1.AddParameter("freq", Chr(34) & "monthly" & Chr(34)) + sdgClimdexIndices.clsRThreeArg.AddParameter("freq", Chr(34) & "monthly" & Chr(34)) + End Select End Sub End Class \ No newline at end of file diff --git a/instat/dlgWindrose.vb b/instat/dlgWindrose.vb index da515d6cbb6..41ed2643392 100644 --- a/instat/dlgWindrose.vb +++ b/instat/dlgWindrose.vb @@ -16,6 +16,10 @@ ' along with this program. If not, see . Imports instat.Translations Public Class dlgWindrose + Private clsRggplotFunction As New RFunction + Private clsRgeom_barFunction As New RFunction + Private clsRaesFunction As New RFunction + Private clsCoordPolarFunction As New RFunction Private bFirstLoad As Boolean = True Private Sub dlgWindrose_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -32,20 +36,83 @@ Public Class dlgWindrose Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 452 + ucrBase.clsRsyntax.SetOperation("+") + clsRggplotFunction.SetRCommand("ggplot") + clsRgeom_barFunction.SetRCommand("geom_bar") + clsCoordPolarFunction.SetRCommand("coord_polar") + clsRaesFunction.SetRCommand("aes") + clsRggplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRaesFunction) + ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRggplotFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRgeom_barFunction) + clsRgeom_barFunction.AddParameter("stat", Chr(34) & "identity" & Chr(34)) + clsRgeom_barFunction.AddParameter("width", "1") + ucrBase.clsRsyntax.AddOperatorParameter("coord_polar", clsRFunc:=clsCoordPolarFunction) + ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False + + ucrXReceiver.Selector = ucrWindRoseSelector + ucrYReceiver.Selector = ucrWindRoseSelector + ucrFillReceiver.Selector = ucrWindRoseSelector + + ucrSaveWindRose.SetDataFrameSelector(ucrWindRoseSelector.ucrAvailableDataFrames) + ucrSaveWindRose.strPrefix = "Windrose" End Sub Private Sub SetDefaults() - + ucrWindRoseSelector.Reset() + ucrXReceiver.SetMeAsReceiver() + TestOkEnabled() End Sub Private Sub ReopenDialog() End Sub Private Sub TestOkEnabled() - + If (ucrXReceiver.IsEmpty AndAlso ucrYReceiver.IsEmpty) OrElse (ucrSaveWindRose.chkSaveGraph.Checked AndAlso ucrSaveWindRose.ucrInputGraphName.IsEmpty) Then + ucrBase.OKEnabled(False) + Else + ucrBase.OKEnabled(True) + End If End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() End Sub + Private Sub ucrXReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrXReceiver.SelectionChanged + If Not ucrXReceiver.IsEmpty Then + clsRaesFunction.AddParameter("x", ucrXReceiver.GetVariableNames(False)) + Else + clsRaesFunction.RemoveParameterByName("x") + End If + TestOkEnabled() + End Sub + + Private Sub ucrYReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrYReceiver.SelectionChanged + If Not ucrYReceiver.IsEmpty Then + clsRaesFunction.AddParameter("y", ucrYReceiver.GetVariableNames(False)) + + Else + clsRaesFunction.RemoveParameterByName("y") + End If + TestOkEnabled() + End Sub + + Private Sub ucrFillReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrFillReceiver.SelectionChanged + If Not ucrFillReceiver.IsEmpty Then + clsRaesFunction.AddParameter("fill", ucrFillReceiver.GetVariableNames(False)) + Else + clsRaesFunction.RemoveParameterByName("fill") + End If + End Sub + + Private Sub ucrWindRoseSelector_DataFrameChanged() Handles ucrWindRoseSelector.DataFrameChanged + clsRggplotFunction.AddParameter("data", clsRFunctionParameter:=ucrWindRoseSelector.ucrAvailableDataFrames.clsCurrDataFrame) + End Sub + Private Sub ucrSaveWindRose_GraphNameChanged() Handles ucrSaveWindRose.GraphNameChanged, ucrSaveWindRose.SaveGraphCheckedChanged + If ucrSaveWindRose.bSaveGraph Then + ucrBase.clsRsyntax.SetAssignTo(ucrSaveWindRose.strGraphName, strTempDataframe:=ucrWindRoseSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:=ucrSaveWindRose.strGraphName) + Else + ucrBase.clsRsyntax.SetAssignTo("last_graph", strTempDataframe:=ucrWindRoseSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") + End If + TestOkEnabled() + End Sub End Class \ No newline at end of file diff --git a/instat/sdgClimdexIndices.Designer.vb b/instat/sdgClimdexIndices.Designer.vb index ae41c943d9c..7152ad08af0 100644 --- a/instat/sdgClimdexIndices.Designer.vb +++ b/instat/sdgClimdexIndices.Designer.vb @@ -1,9 +1,9 @@ - _ + Partial Class sdgClimdexIndices Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. - _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then @@ -20,33 +20,514 @@ Partial Class sdgClimdexIndices 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. - _ + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container() + Me.chkFrostDays = New System.Windows.Forms.CheckBox() + Me.chkTropicalNights = New System.Windows.Forms.CheckBox() + Me.chkIcingDays = New System.Windows.Forms.CheckBox() + Me.chkSummerDays = New System.Windows.Forms.CheckBox() + Me.panIndices = New System.Windows.Forms.Panel() + Me.chkPrecExceed99Percent = New System.Windows.Forms.CheckBox() + Me.chkMaxWetSpell = New System.Windows.Forms.CheckBox() + Me.chkPrecExceedSpecifiedA = New System.Windows.Forms.CheckBox() + Me.chkMonthlyMax5dayPrec = New System.Windows.Forms.CheckBox() + Me.chkTmaxAbove90Percent = New System.Windows.Forms.CheckBox() + Me.chkTminAbove90Percent = New System.Windows.Forms.CheckBox() + Me.chkPrecExceed95Percent = New System.Windows.Forms.CheckBox() + Me.chkMonthlyMinDailyTMin = New System.Windows.Forms.CheckBox() + Me.chkMonthlyMaxDailyTMax = New System.Windows.Forms.CheckBox() + Me.chkMaxDrySpell = New System.Windows.Forms.CheckBox() + Me.chkPrecExceed20mm = New System.Windows.Forms.CheckBox() + Me.chkSimplePrecII = New System.Windows.Forms.CheckBox() + Me.chkTotalDailyPrec = New System.Windows.Forms.CheckBox() + Me.chkColdSpellDI = New System.Windows.Forms.CheckBox() + Me.chkTmaxBelow10Percent = New System.Windows.Forms.CheckBox() + Me.chkTminBelow10Percent = New System.Windows.Forms.CheckBox() + Me.chkMonthlyMinDailyTMax = New System.Windows.Forms.CheckBox() + Me.chkPrecExceed10mm = New System.Windows.Forms.CheckBox() + Me.chkMonthlyMax1dayPrec = New System.Windows.Forms.CheckBox() + Me.chkMeanDiurnalTempRange = New System.Windows.Forms.CheckBox() + Me.chkWarmSpellDI = New System.Windows.Forms.CheckBox() + Me.chkMonthlyMaxDailyTMin = New System.Windows.Forms.CheckBox() + Me.chkGrowingSeasonLength = New System.Windows.Forms.CheckBox() + Me.ttClimdexIndices = New System.Windows.Forms.ToolTip(Me.components) + Me.grpClimdexIndices = New System.Windows.Forms.GroupBox() Me.ucrButtonsClimdexIndices = New instat.ucrButtonsSubdialogue() + Me.lblThreshold = New System.Windows.Forms.Label() + Me.nudThreshold = New System.Windows.Forms.NumericUpDown() + Me.chkCenterMean = New System.Windows.Forms.CheckBox() + Me.chkMaxSpellSpanYears = New System.Windows.Forms.CheckBox() + Me.chkSpellDISpanYear = New System.Windows.Forms.CheckBox() + Me.panIndices.SuspendLayout() + Me.grpClimdexIndices.SuspendLayout() + CType(Me.nudThreshold, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' + 'chkFrostDays + ' + Me.chkFrostDays.AutoSize = True + Me.chkFrostDays.Location = New System.Drawing.Point(18, 8) + Me.chkFrostDays.Name = "chkFrostDays" + Me.chkFrostDays.Size = New System.Drawing.Size(76, 17) + Me.chkFrostDays.TabIndex = 0 + Me.chkFrostDays.Tag = "Frost_Days" + Me.chkFrostDays.Text = "Frost Days" + Me.chkFrostDays.UseVisualStyleBackColor = True + ' + 'chkTropicalNights + ' + Me.chkTropicalNights.AutoSize = True + Me.chkTropicalNights.Location = New System.Drawing.Point(18, 62) + Me.chkTropicalNights.Name = "chkTropicalNights" + Me.chkTropicalNights.Size = New System.Drawing.Size(97, 17) + Me.chkTropicalNights.TabIndex = 3 + Me.chkTropicalNights.Tag = "Tropical_Nights" + Me.chkTropicalNights.Text = "Tropical Nights" + Me.chkTropicalNights.UseVisualStyleBackColor = True + ' + 'chkIcingDays + ' + Me.chkIcingDays.AutoSize = True + Me.chkIcingDays.Location = New System.Drawing.Point(18, 44) + Me.chkIcingDays.Name = "chkIcingDays" + Me.chkIcingDays.Size = New System.Drawing.Size(76, 17) + Me.chkIcingDays.TabIndex = 2 + Me.chkIcingDays.Tag = "Icing_Days" + Me.chkIcingDays.Text = "Icing Days" + Me.chkIcingDays.UseVisualStyleBackColor = True + ' + 'chkSummerDays + ' + Me.chkSummerDays.AutoSize = True + Me.chkSummerDays.Location = New System.Drawing.Point(18, 26) + Me.chkSummerDays.Name = "chkSummerDays" + Me.chkSummerDays.Size = New System.Drawing.Size(91, 17) + Me.chkSummerDays.TabIndex = 1 + Me.chkSummerDays.Tag = "Summer_Days" + Me.chkSummerDays.Text = "Summer Days" + Me.chkSummerDays.UseVisualStyleBackColor = True + ' + 'panIndices + ' + Me.panIndices.AutoScroll = True + Me.panIndices.Controls.Add(Me.chkPrecExceed99Percent) + Me.panIndices.Controls.Add(Me.chkMaxWetSpell) + Me.panIndices.Controls.Add(Me.chkPrecExceedSpecifiedA) + Me.panIndices.Controls.Add(Me.chkMonthlyMax5dayPrec) + Me.panIndices.Controls.Add(Me.chkTmaxAbove90Percent) + Me.panIndices.Controls.Add(Me.chkTminAbove90Percent) + Me.panIndices.Controls.Add(Me.chkPrecExceed95Percent) + Me.panIndices.Controls.Add(Me.chkMonthlyMinDailyTMin) + Me.panIndices.Controls.Add(Me.chkMonthlyMaxDailyTMax) + Me.panIndices.Controls.Add(Me.chkMaxDrySpell) + Me.panIndices.Controls.Add(Me.chkPrecExceed20mm) + Me.panIndices.Controls.Add(Me.chkSimplePrecII) + Me.panIndices.Controls.Add(Me.chkTotalDailyPrec) + Me.panIndices.Controls.Add(Me.chkColdSpellDI) + Me.panIndices.Controls.Add(Me.chkTmaxBelow10Percent) + Me.panIndices.Controls.Add(Me.chkTminBelow10Percent) + Me.panIndices.Controls.Add(Me.chkMonthlyMinDailyTMax) + Me.panIndices.Controls.Add(Me.chkPrecExceed10mm) + Me.panIndices.Controls.Add(Me.chkMonthlyMax1dayPrec) + Me.panIndices.Controls.Add(Me.chkMeanDiurnalTempRange) + Me.panIndices.Controls.Add(Me.chkWarmSpellDI) + Me.panIndices.Controls.Add(Me.chkMonthlyMaxDailyTMin) + Me.panIndices.Controls.Add(Me.chkGrowingSeasonLength) + Me.panIndices.Controls.Add(Me.chkFrostDays) + Me.panIndices.Controls.Add(Me.chkIcingDays) + Me.panIndices.Controls.Add(Me.chkSummerDays) + Me.panIndices.Controls.Add(Me.chkTropicalNights) + Me.panIndices.Location = New System.Drawing.Point(8, 21) + Me.panIndices.Name = "panIndices" + Me.panIndices.Size = New System.Drawing.Size(354, 130) + Me.panIndices.TabIndex = 0 + ' + 'chkPrecExceed99Percent + ' + Me.chkPrecExceed99Percent.AutoSize = True + Me.chkPrecExceed99Percent.Location = New System.Drawing.Point(18, 456) + Me.chkPrecExceed99Percent.Name = "chkPrecExceed99Percent" + Me.chkPrecExceed99Percent.Size = New System.Drawing.Size(317, 17) + Me.chkPrecExceed99Percent.TabIndex = 25 + Me.chkPrecExceed99Percent.Tag = "Total_Daily_Precipitation_Exceeding_99th_Percentile_Threshold " + Me.chkPrecExceed99Percent.Text = "Total Daily Precipitation Exceeding 99th Percentile Threshold " + Me.chkPrecExceed99Percent.UseVisualStyleBackColor = True + ' + 'chkMaxWetSpell + ' + Me.chkMaxWetSpell.AutoSize = True + Me.chkMaxWetSpell.Location = New System.Drawing.Point(18, 422) + Me.chkMaxWetSpell.Name = "chkMaxWetSpell" + Me.chkMaxWetSpell.Size = New System.Drawing.Size(170, 17) + Me.chkMaxWetSpell.TabIndex = 23 + Me.chkMaxWetSpell.Tag = "Maximum_Length_of_Wet_Spell" + Me.chkMaxWetSpell.Text = "Maximum Length of Wet Spell " + Me.chkMaxWetSpell.UseVisualStyleBackColor = True + ' + 'chkPrecExceedSpecifiedA + ' + Me.chkPrecExceedSpecifiedA.AutoSize = True + Me.chkPrecExceedSpecifiedA.Location = New System.Drawing.Point(18, 388) + Me.chkPrecExceedSpecifiedA.Name = "chkPrecExceedSpecifiedA" + Me.chkPrecExceedSpecifiedA.Size = New System.Drawing.Size(276, 17) + Me.chkPrecExceedSpecifiedA.TabIndex = 21 + Me.chkPrecExceedSpecifiedA.Tag = "Precipitation_Exceeding_a_Specified_Amount_Per_Day" + Me.chkPrecExceedSpecifiedA.Text = "Precipitation Exceeding a Specified Amount Per Day" + Me.chkPrecExceedSpecifiedA.UseVisualStyleBackColor = True + ' + 'chkMonthlyMax5dayPrec + ' + Me.chkMonthlyMax5dayPrec.AutoSize = True + Me.chkMonthlyMax5dayPrec.Location = New System.Drawing.Point(18, 314) + Me.chkMonthlyMax5dayPrec.Name = "chkMonthlyMax5dayPrec" + Me.chkMonthlyMax5dayPrec.Size = New System.Drawing.Size(265, 17) + Me.chkMonthlyMax5dayPrec.TabIndex = 17 + Me.chkMonthlyMax5dayPrec.Tag = "Monthly_Maximum_Consecutive_5-day_Precipitation" + Me.chkMonthlyMax5dayPrec.Text = "Monthly Maximum Consecutive 5-day Precipitation " + Me.chkMonthlyMax5dayPrec.UseVisualStyleBackColor = True + ' + 'chkTmaxAbove90Percent + ' + Me.chkTmaxAbove90Percent.AutoSize = True + Me.chkTmaxAbove90Percent.Location = New System.Drawing.Point(18, 225) + Me.chkTmaxAbove90Percent.Name = "chkTmaxAbove90Percent" + Me.chkTmaxAbove90Percent.Size = New System.Drawing.Size(302, 17) + Me.chkTmaxAbove90Percent.TabIndex = 12 + Me.chkTmaxAbove90Percent.Tag = "Percentage_of_Days_When_Tmax_is_Above_90th_Percentile" + Me.chkTmaxAbove90Percent.Text = "Percentage of Days When Tmax is Above 90th Percentile " + Me.chkTmaxAbove90Percent.UseVisualStyleBackColor = True + ' + 'chkTminAbove90Percent + ' + Me.chkTminAbove90Percent.AutoSize = True + Me.chkTminAbove90Percent.Location = New System.Drawing.Point(18, 207) + Me.chkTminAbove90Percent.Name = "chkTminAbove90Percent" + Me.chkTminAbove90Percent.Size = New System.Drawing.Size(299, 17) + Me.chkTminAbove90Percent.TabIndex = 11 + Me.chkTminAbove90Percent.Tag = "Percentage_of_Days_When_Tmin_is_above_90th_Percentile" + Me.chkTminAbove90Percent.Text = "Percentage of Days When Tmin is Above 90th Percentile " + Me.chkTminAbove90Percent.UseVisualStyleBackColor = True + ' + 'chkPrecExceed95Percent + ' + Me.chkPrecExceed95Percent.AutoSize = True + Me.chkPrecExceed95Percent.Location = New System.Drawing.Point(18, 438) + Me.chkPrecExceed95Percent.Name = "chkPrecExceed95Percent" + Me.chkPrecExceed95Percent.Size = New System.Drawing.Size(317, 17) + Me.chkPrecExceed95Percent.TabIndex = 24 + Me.chkPrecExceed95Percent.Tag = "Total_Daily_Precipitation_Exceeding_95th_Percentile_Threshold " + Me.chkPrecExceed95Percent.Text = "Total Daily Precipitation Exceeding 95th Percentile Threshold " + Me.chkPrecExceed95Percent.UseVisualStyleBackColor = True + ' + 'chkMonthlyMinDailyTMin + ' + Me.chkMonthlyMinDailyTMin.AutoSize = True + Me.chkMonthlyMinDailyTMin.Location = New System.Drawing.Point(18, 152) + Me.chkMonthlyMinDailyTMin.Name = "chkMonthlyMinDailyTMin" + Me.chkMonthlyMinDailyTMin.Size = New System.Drawing.Size(255, 17) + Me.chkMonthlyMinDailyTMin.TabIndex = 8 + Me.chkMonthlyMinDailyTMin.Tag = "Monthly_Minimum_of_Daily_Minimum_Temperature" + Me.chkMonthlyMinDailyTMin.Text = "Monthly Minimum of Daily Minimum Temperature " + Me.chkMonthlyMinDailyTMin.UseVisualStyleBackColor = True + ' + 'chkMonthlyMaxDailyTMax + ' + Me.chkMonthlyMaxDailyTMax.AutoSize = True + Me.chkMonthlyMaxDailyTMax.Location = New System.Drawing.Point(18, 98) + Me.chkMonthlyMaxDailyTMax.Name = "chkMonthlyMaxDailyTMax" + Me.chkMonthlyMaxDailyTMax.Size = New System.Drawing.Size(261, 17) + Me.chkMonthlyMaxDailyTMax.TabIndex = 5 + Me.chkMonthlyMaxDailyTMax.Tag = "Monthly_Maximum_of_Daily_Maximum_Temperature " + Me.chkMonthlyMaxDailyTMax.Text = "Monthly Maximum of Daily Maximum Temperature " + Me.chkMonthlyMaxDailyTMax.UseVisualStyleBackColor = True + ' + 'chkMaxDrySpell + ' + Me.chkMaxDrySpell.AutoSize = True + Me.chkMaxDrySpell.Location = New System.Drawing.Point(18, 404) + Me.chkMaxDrySpell.Name = "chkMaxDrySpell" + Me.chkMaxDrySpell.Size = New System.Drawing.Size(166, 17) + Me.chkMaxDrySpell.TabIndex = 22 + Me.chkMaxDrySpell.Tag = "Maximum_Length_of_Dry_Spell" + Me.chkMaxDrySpell.Text = "Maximum Length of Dry Spell " + Me.chkMaxDrySpell.UseVisualStyleBackColor = True + ' + 'chkPrecExceed20mm + ' + Me.chkPrecExceed20mm.AutoSize = True + Me.chkPrecExceed20mm.Location = New System.Drawing.Point(18, 370) + Me.chkPrecExceed20mm.Name = "chkPrecExceed20mm" + Me.chkPrecExceed20mm.Size = New System.Drawing.Size(212, 17) + Me.chkPrecExceed20mm.TabIndex = 20 + Me.chkPrecExceed20mm.Tag = "Precipitation_Exceeding_20mm_Per_Day " + Me.chkPrecExceed20mm.Text = "Precipitation Exceeding 20mm Per Day " + Me.chkPrecExceed20mm.UseVisualStyleBackColor = True + ' + 'chkSimplePrecII + ' + Me.chkSimplePrecII.AutoSize = True + Me.chkSimplePrecII.Location = New System.Drawing.Point(18, 332) + Me.chkSimplePrecII.Name = "chkSimplePrecII" + Me.chkSimplePrecII.Size = New System.Drawing.Size(189, 17) + Me.chkSimplePrecII.TabIndex = 18 + Me.chkSimplePrecII.Tag = "Simple_Precipitation_Intensity_Index" + Me.chkSimplePrecII.Text = "Simple Precipitation Intensity Index" + Me.chkSimplePrecII.UseVisualStyleBackColor = True + ' + 'chkTotalDailyPrec + ' + Me.chkTotalDailyPrec.AutoSize = True + Me.chkTotalDailyPrec.Location = New System.Drawing.Point(18, 472) + Me.chkTotalDailyPrec.Name = "chkTotalDailyPrec" + Me.chkTotalDailyPrec.Size = New System.Drawing.Size(137, 17) + Me.chkTotalDailyPrec.TabIndex = 26 + Me.chkTotalDailyPrec.Tag = "Total_Daily_Precipitation" + Me.chkTotalDailyPrec.Text = "Total Daily Precipitation" + Me.chkTotalDailyPrec.UseVisualStyleBackColor = True + ' + 'chkColdSpellDI + ' + Me.chkColdSpellDI.AutoSize = True + Me.chkColdSpellDI.Location = New System.Drawing.Point(18, 260) + Me.chkColdSpellDI.Name = "chkColdSpellDI" + Me.chkColdSpellDI.Size = New System.Drawing.Size(148, 17) + Me.chkColdSpellDI.TabIndex = 14 + Me.chkColdSpellDI.Tag = "Cold_Spell_Duration_Index " + Me.chkColdSpellDI.Text = "Cold Spell Duration Index " + Me.chkColdSpellDI.UseVisualStyleBackColor = True + ' + 'chkTmaxBelow10Percent + ' + Me.chkTmaxBelow10Percent.AutoSize = True + Me.chkTmaxBelow10Percent.Location = New System.Drawing.Point(18, 188) + Me.chkTmaxBelow10Percent.Name = "chkTmaxBelow10Percent" + Me.chkTmaxBelow10Percent.Size = New System.Drawing.Size(300, 17) + Me.chkTmaxBelow10Percent.TabIndex = 10 + Me.chkTmaxBelow10Percent.Tag = "Percentage_of_Days_When_Tmax_is_Below_10th_Percentile" + Me.chkTmaxBelow10Percent.Text = "Percentage of Days When Tmax is Below 10th Percentile " + Me.chkTmaxBelow10Percent.UseVisualStyleBackColor = True + ' + 'chkTminBelow10Percent + ' + Me.chkTminBelow10Percent.AutoSize = True + Me.chkTminBelow10Percent.Location = New System.Drawing.Point(18, 170) + Me.chkTminBelow10Percent.Name = "chkTminBelow10Percent" + Me.chkTminBelow10Percent.Size = New System.Drawing.Size(297, 17) + Me.chkTminBelow10Percent.TabIndex = 9 + Me.chkTminBelow10Percent.Tag = "Percentage_of_Days_When_Tmin_is_Below_10th_Percentile" + Me.chkTminBelow10Percent.Text = "Percentage of Days When Tmin is Below 10th Percentile " + Me.chkTminBelow10Percent.UseVisualStyleBackColor = True + ' + 'chkMonthlyMinDailyTMax + ' + Me.chkMonthlyMinDailyTMax.AutoSize = True + Me.chkMonthlyMinDailyTMax.Location = New System.Drawing.Point(18, 134) + Me.chkMonthlyMinDailyTMax.Name = "chkMonthlyMinDailyTMax" + Me.chkMonthlyMinDailyTMax.Size = New System.Drawing.Size(258, 17) + Me.chkMonthlyMinDailyTMax.TabIndex = 7 + Me.chkMonthlyMinDailyTMax.Tag = "Monthly_Minimum_of_Daily_Maximum_Temperature " + Me.chkMonthlyMinDailyTMax.Text = "Monthly Minimum of Daily Maximum Temperature " + Me.chkMonthlyMinDailyTMax.UseVisualStyleBackColor = True + ' + 'chkPrecExceed10mm + ' + Me.chkPrecExceed10mm.AutoSize = True + Me.chkPrecExceed10mm.Location = New System.Drawing.Point(18, 350) + Me.chkPrecExceed10mm.Name = "chkPrecExceed10mm" + Me.chkPrecExceed10mm.Size = New System.Drawing.Size(212, 17) + Me.chkPrecExceed10mm.TabIndex = 19 + Me.chkPrecExceed10mm.Tag = "Precipitation_Exceeding_10mm_Per_Day " + Me.chkPrecExceed10mm.Text = "Precipitation Exceeding 10mm Per Day " + Me.chkPrecExceed10mm.UseVisualStyleBackColor = True + ' + 'chkMonthlyMax1dayPrec + ' + Me.chkMonthlyMax1dayPrec.AutoSize = True + Me.chkMonthlyMax1dayPrec.Location = New System.Drawing.Point(18, 296) + Me.chkMonthlyMax1dayPrec.Name = "chkMonthlyMax1dayPrec" + Me.chkMonthlyMax1dayPrec.Size = New System.Drawing.Size(203, 17) + Me.chkMonthlyMax1dayPrec.TabIndex = 16 + Me.chkMonthlyMax1dayPrec.Tag = "Monthly_Maximum_1-day_Precipitation" + Me.chkMonthlyMax1dayPrec.Text = "Monthly Maximum 1-day Precipitation " + Me.chkMonthlyMax1dayPrec.UseVisualStyleBackColor = True + ' + 'chkMeanDiurnalTempRange + ' + Me.chkMeanDiurnalTempRange.AutoSize = True + Me.chkMeanDiurnalTempRange.Location = New System.Drawing.Point(18, 278) + Me.chkMeanDiurnalTempRange.Name = "chkMeanDiurnalTempRange" + Me.chkMeanDiurnalTempRange.Size = New System.Drawing.Size(187, 17) + Me.chkMeanDiurnalTempRange.TabIndex = 15 + Me.chkMeanDiurnalTempRange.Tag = "Mean_Diurnal_Temperature_Range" + Me.chkMeanDiurnalTempRange.Text = "Mean Diurnal Temperature Range" + Me.chkMeanDiurnalTempRange.UseVisualStyleBackColor = True + ' + 'chkWarmSpellDI + ' + Me.chkWarmSpellDI.AutoSize = True + Me.chkWarmSpellDI.Location = New System.Drawing.Point(18, 242) + Me.chkWarmSpellDI.Name = "chkWarmSpellDI" + Me.chkWarmSpellDI.Size = New System.Drawing.Size(155, 17) + Me.chkWarmSpellDI.TabIndex = 13 + Me.chkWarmSpellDI.Tag = "Warm_Spell_Duration_Index " + Me.chkWarmSpellDI.Text = "Warm Spell Duration Index " + Me.chkWarmSpellDI.UseVisualStyleBackColor = True + ' + 'chkMonthlyMaxDailyTMin + ' + Me.chkMonthlyMaxDailyTMin.AutoSize = True + Me.chkMonthlyMaxDailyTMin.Location = New System.Drawing.Point(18, 116) + Me.chkMonthlyMaxDailyTMin.Name = "chkMonthlyMaxDailyTMin" + Me.chkMonthlyMaxDailyTMin.Size = New System.Drawing.Size(255, 17) + Me.chkMonthlyMaxDailyTMin.TabIndex = 6 + Me.chkMonthlyMaxDailyTMin.Tag = "Monthly_Maximum_of_Daily_Minimum_Temperature" + Me.chkMonthlyMaxDailyTMin.Text = "Monthly Maximum of Daily Minimum Temperature" + Me.chkMonthlyMaxDailyTMin.UseVisualStyleBackColor = True + ' + 'chkGrowingSeasonLength + ' + Me.chkGrowingSeasonLength.AutoSize = True + Me.chkGrowingSeasonLength.Location = New System.Drawing.Point(18, 80) + Me.chkGrowingSeasonLength.Name = "chkGrowingSeasonLength" + Me.chkGrowingSeasonLength.Size = New System.Drawing.Size(140, 17) + Me.chkGrowingSeasonLength.TabIndex = 4 + Me.chkGrowingSeasonLength.Tag = "Growing_Season_Length" + Me.chkGrowingSeasonLength.Text = "Growing Season Length" + Me.chkGrowingSeasonLength.UseVisualStyleBackColor = True + ' + 'grpClimdexIndices + ' + Me.grpClimdexIndices.Controls.Add(Me.panIndices) + Me.grpClimdexIndices.Location = New System.Drawing.Point(12, 11) + Me.grpClimdexIndices.Name = "grpClimdexIndices" + Me.grpClimdexIndices.Size = New System.Drawing.Size(377, 165) + Me.grpClimdexIndices.TabIndex = 0 + Me.grpClimdexIndices.TabStop = False + Me.grpClimdexIndices.Tag = "Climdex_Indices" + Me.grpClimdexIndices.Text = "Climdex Indices" + ' 'ucrButtonsClimdexIndices ' - Me.ucrButtonsClimdexIndices.Location = New System.Drawing.Point(66, 219) + Me.ucrButtonsClimdexIndices.Location = New System.Drawing.Point(119, 243) Me.ucrButtonsClimdexIndices.Name = "ucrButtonsClimdexIndices" Me.ucrButtonsClimdexIndices.Size = New System.Drawing.Size(142, 30) - Me.ucrButtonsClimdexIndices.TabIndex = 0 + Me.ucrButtonsClimdexIndices.TabIndex = 6 + ' + 'lblThreshold + ' + Me.lblThreshold.AutoSize = True + Me.lblThreshold.Location = New System.Drawing.Point(12, 187) + Me.lblThreshold.Name = "lblThreshold" + Me.lblThreshold.Size = New System.Drawing.Size(54, 13) + Me.lblThreshold.TabIndex = 1 + Me.lblThreshold.Tag = "Threshold" + Me.lblThreshold.Text = "Threshold" + ' + 'nudThreshold + ' + Me.nudThreshold.DecimalPlaces = 2 + Me.nudThreshold.Increment = New Decimal(New Integer() {1, 0, 0, 131072}) + Me.nudThreshold.Location = New System.Drawing.Point(80, 184) + Me.nudThreshold.Name = "nudThreshold" + Me.nudThreshold.Size = New System.Drawing.Size(42, 20) + Me.nudThreshold.TabIndex = 2 + Me.nudThreshold.Value = New Decimal(New Integer() {100, 0, 0, 131072}) + ' + 'chkCenterMean + ' + Me.chkCenterMean.AutoSize = True + Me.chkCenterMean.Location = New System.Drawing.Point(12, 216) + Me.chkCenterMean.Name = "chkCenterMean" + Me.chkCenterMean.Size = New System.Drawing.Size(147, 17) + Me.chkCenterMean.TabIndex = 4 + Me.chkCenterMean.Tag = "Center_Mean_ on_Last_Day" + Me.chkCenterMean.Text = "Center Mean on Last Day" + Me.chkCenterMean.UseVisualStyleBackColor = True + ' + 'chkMaxSpellSpanYears + ' + Me.chkMaxSpellSpanYears.AutoSize = True + Me.chkMaxSpellSpanYears.Location = New System.Drawing.Point(199, 185) + Me.chkMaxSpellSpanYears.Name = "chkMaxSpellSpanYears" + Me.chkMaxSpellSpanYears.Size = New System.Drawing.Size(190, 17) + Me.chkMaxSpellSpanYears.TabIndex = 3 + Me.chkMaxSpellSpanYears.Tag = "Maximum_Spell_Length_Span_Years" + Me.chkMaxSpellSpanYears.Text = "Maximum Spell Length Span Years" + Me.chkMaxSpellSpanYears.UseVisualStyleBackColor = True + ' + 'chkSpellDISpanYear + ' + Me.chkSpellDISpanYear.AutoSize = True + Me.chkSpellDISpanYear.Location = New System.Drawing.Point(199, 216) + Me.chkSpellDISpanYear.Name = "chkSpellDISpanYear" + Me.chkSpellDISpanYear.Size = New System.Drawing.Size(179, 17) + Me.chkSpellDISpanYear.TabIndex = 5 + Me.chkSpellDISpanYear.Tag = "Spell_Duration_Index_Span_Years" + Me.chkSpellDISpanYear.Text = "Spell Duration Index Span Years" + Me.chkSpellDISpanYear.UseVisualStyleBackColor = True ' 'sdgClimdexIndices ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(284, 261) + Me.ClientSize = New System.Drawing.Size(398, 274) + Me.Controls.Add(Me.chkSpellDISpanYear) + Me.Controls.Add(Me.chkMaxSpellSpanYears) + Me.Controls.Add(Me.chkCenterMean) + Me.Controls.Add(Me.nudThreshold) + Me.Controls.Add(Me.lblThreshold) + Me.Controls.Add(Me.grpClimdexIndices) Me.Controls.Add(Me.ucrButtonsClimdexIndices) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "sdgClimdexIndices" - Me.Tag = "Climdex_Indices" - Me.Text = "Climdex Indices" + Me.Tag = "Climdex_Options" + Me.Text = "Climdex Options" + Me.panIndices.ResumeLayout(False) + Me.panIndices.PerformLayout() + Me.grpClimdexIndices.ResumeLayout(False) + CType(Me.nudThreshold, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) + Me.PerformLayout() End Sub Friend WithEvents ucrButtonsClimdexIndices As ucrButtonsSubdialogue + Friend WithEvents chkFrostDays As CheckBox + Friend WithEvents chkTropicalNights As CheckBox + Friend WithEvents chkIcingDays As CheckBox + Friend WithEvents chkSummerDays As CheckBox + Friend WithEvents panIndices As Panel + Friend WithEvents ttClimdexIndices As ToolTip + Friend WithEvents chkPrecExceed95Percent As CheckBox + Friend WithEvents chkMonthlyMinDailyTMin As CheckBox + Friend WithEvents chkMonthlyMaxDailyTMax As CheckBox + Friend WithEvents chkMaxDrySpell As CheckBox + Friend WithEvents chkPrecExceed20mm As CheckBox + Friend WithEvents chkSimplePrecII As CheckBox + Friend WithEvents chkTotalDailyPrec As CheckBox + Friend WithEvents chkColdSpellDI As CheckBox + Friend WithEvents chkTmaxBelow10Percent As CheckBox + Friend WithEvents chkTminBelow10Percent As CheckBox + Friend WithEvents chkMonthlyMinDailyTMax As CheckBox + Friend WithEvents chkPrecExceed10mm As CheckBox + Friend WithEvents chkMonthlyMax1dayPrec As CheckBox + Friend WithEvents chkMeanDiurnalTempRange As CheckBox + Friend WithEvents chkWarmSpellDI As CheckBox + Friend WithEvents chkMonthlyMaxDailyTMin As CheckBox + Friend WithEvents chkGrowingSeasonLength As CheckBox + Friend WithEvents chkTmaxAbove90Percent As CheckBox + Friend WithEvents chkTminAbove90Percent As CheckBox + Friend WithEvents chkMonthlyMax5dayPrec As CheckBox + Friend WithEvents chkPrecExceedSpecifiedA As CheckBox + Friend WithEvents chkMaxWetSpell As CheckBox + Friend WithEvents chkPrecExceed99Percent As CheckBox + Friend WithEvents grpClimdexIndices As GroupBox + Friend WithEvents lblThreshold As Label + Friend WithEvents nudThreshold As NumericUpDown + Friend WithEvents chkCenterMean As CheckBox + Friend WithEvents chkMaxSpellSpanYears As CheckBox + Friend WithEvents chkSpellDISpanYear As CheckBox End Class diff --git a/instat/sdgClimdexIndices.resx b/instat/sdgClimdexIndices.resx index 29dcb1b3a35..8ff9684afac 100644 --- a/instat/sdgClimdexIndices.resx +++ b/instat/sdgClimdexIndices.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/instat/sdgClimdexIndices.vb b/instat/sdgClimdexIndices.vb index dd48804cce2..bd7693dcd3e 100644 --- a/instat/sdgClimdexIndices.vb +++ b/instat/sdgClimdexIndices.vb @@ -16,7 +16,207 @@ Imports instat.Translations Public Class sdgClimdexIndices + Public clsROneArg, clsRTwoArg1, clsRTwoArg2, clsRTwoArg3, clsRTwoArg4, clsRTwoArg5, clsRThreeArg As New RFunction + Public bFirstLoad As Boolean = True Private Sub sdgClimdexIndices_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) + If bFirstLoad Then + SetDefaults() + bFirstLoad = False + End If + End Sub + + Private Sub grpClimdexIndices_Enter(sender As Object, e As EventArgs) Handles grpClimdexIndices.Enter + + End Sub + + Private Sub lblThreshold_Click(sender As Object, e As EventArgs) Handles lblThreshold.Click + + End Sub + + Public Sub SetDefaults() + chkFrostDays.Checked = True + chkCenterMean.Checked = False + chkMaxSpellSpanYears.Checked = True + chkSpellDISpanYear.Checked = False + nudThreshold.Value = 1.0 + ttClimdexIndices.SetToolTip(chkFrostDays, "The annual count of days where daily minimum temperature drops below 0 degrees Celsius") + ttClimdexIndices.SetToolTip(chkSummerDays, "The annual count of days where daily maximum temperature exceeds 25 degrees Celsius") + ttClimdexIndices.SetToolTip(chkIcingDays, "The annual count of days where daily maximum temperature is below 0 degrees Celsius") + ttClimdexIndices.SetToolTip(chkTropicalNights, "Annual count of days where daily minimum temperature stays above 20 degrees Celsius. ") + ttClimdexIndices.SetToolTip(chkGrowingSeasonLength, "Is the number of days between the start of the first spell of warm days in the first half of the year, and the start of the first spell of cold days in the second half of the year") + ttClimdexIndices.SetToolTip(chkMonthlyMaxDailyTMax, "Computes the monthly or annual maximum of daily maximum temperature") + ttClimdexIndices.SetToolTip(chkMonthlyMaxDailyTMin, "Computes the monthly or annual maximum of daily minimum temperature") + ttClimdexIndices.SetToolTip(chkMonthlyMinDailyTMax, "Computes the monthly or annual minimum of daily maximum temperature") + ttClimdexIndices.SetToolTip(chkMonthlyMinDailyTMin, "Computes the monthly or annual minimum of daily minimum temperature") + ttClimdexIndices.SetToolTip(chkTminBelow10Percent, "Computes the monthly or annual proportion of minimum temperature below 10th percentile") + ttClimdexIndices.SetToolTip(chkTmaxBelow10Percent, "Computes the monthly or annual proportion of maximum temperature below 10th percentile") + ttClimdexIndices.SetToolTip(chkTminAbove90Percent, "Computes the monthly or annual proportion of minimum temperature above 90th percentile") + ttClimdexIndices.SetToolTip(chkTmaxAbove90Percent, "Computes the monthly or annual proportion of maximum temperature above 90th percentile") + ttClimdexIndices.SetToolTip(chkWarmSpellDI, "Warm spell is defined as a sequence of 6 or more days in which the daily maximum temperature exceeds the 90th percentile of daily maximum temperature for a 5-day running window surrounding this day during the baseline period") + ttClimdexIndices.SetToolTip(chkColdSpellDI, "Cold spell is defined as a sequence of 6 or more days in which the daily minimum temperature is below the 10th percentile of daily minimum temperature for a 5-day running window surrounding this day during the baseline period.") + ttClimdexIndices.SetToolTip(chkMeanDiurnalTempRange, "Computes the mean daily diurnal temperature range. The frequency of observation can be either monthly or annual") + ttClimdexIndices.SetToolTip(chkMonthlyMax1dayPrec, "Computes the climdex index Rx1day: monthly or annual maximum 1-day precipitation") + ttClimdexIndices.SetToolTip(chkMonthlyMax5dayPrec, "Computes the monthly or annual maximum consecutive 5-day precipitation") + ttClimdexIndices.SetToolTip(chkSimplePrecII, "This is defined as the sum of precipitation in wet days (days with preciptitation over 1mm) during the year divided by the number of wet days in the year.") + ttClimdexIndices.SetToolTip(chkPrecExceed10mm, "Computes the annual count of days where daily precipitation is more than 10mm per day") + ttClimdexIndices.SetToolTip(chkPrecExceed20mm, "Computes the annual count of days where daily precipitation is more than 20mm per day") + ttClimdexIndices.SetToolTip(chkPrecExceedSpecifiedA, "Computes the climdex index Rnnmm: the annual count of days where daily precipitation is more than nn mm per day") + ttClimdexIndices.SetToolTip(chkMaxDrySpell, "Maximum number of days when precipitation is less than 1mm.") + ttClimdexIndices.SetToolTip(chkMaxWetSpell, "Maximum number of days when precipitation is greater than 1mm") + ttClimdexIndices.SetToolTip(chkPrecExceed95Percent, "Computes the annual sum of precipitation in days where daily precipitation exceeds the 95th percentile of daily precipitation in the base period ") + ttClimdexIndices.SetToolTip(chkPrecExceed99Percent, "Computes the annual sum of precipitation in days where daily precipitation exceeds the 99th percentile of daily precipitation in the base period ") + ttClimdexIndices.SetToolTip(chkTotalDailyPrec, "Computes the annual sum of precipitation in wet days (days where precipitation is at least 1mm). ") + clsROneArg.AddParameter("ci", clsRFunctionParameter:=dlgClimdex.clsRClimdexInput) + clsRTwoArg1.AddParameter("ci", clsRFunctionParameter:=dlgClimdex.clsRClimdexInput) + clsRTwoArg2.AddParameter("ci", clsRFunctionParameter:=dlgClimdex.clsRClimdexInput) + clsRTwoArg2.AddParameter("gsl.mode", Chr(34) & "GSL" & Chr(34)) + clsRTwoArg3.AddParameter("ci", clsRFunctionParameter:=dlgClimdex.clsRClimdexInput) + clsRTwoArg4.AddParameter("ci", clsRFunctionParameter:=dlgClimdex.clsRClimdexInput) + clsRTwoArg5.AddParameter("ci", clsRFunctionParameter:=dlgClimdex.clsRClimdexInput) + clsRThreeArg.AddParameter("ci", clsRFunctionParameter:=dlgClimdex.clsRClimdexInput) + End Sub + + Private Sub nudThreshold_ValueChanged(sender As Object, e As EventArgs) Handles nudThreshold.ValueChanged + If nudThreshold.Value = 1.0 Then + clsRTwoArg3.RemoveParameterByName("threshold") + Else + clsRTwoArg3.AddParameter("threshold", nudThreshold.Value) + End If + End Sub + + Private Sub chkCenterMean_CheckedChanged(sender As Object, e As EventArgs) Handles chkCenterMean.CheckedChanged + If chkCenterMean.Checked Then + clsRThreeArg.AddParameter("center.mean.on.last.day", "TRUE") + Else + clsRThreeArg.RemoveParameterByName("center.mean.on.last.day") + End If + End Sub + + Private Sub chkSpellDISpanYear_CheckedChanged(sender As Object, e As EventArgs) Handles chkSpellDISpanYear.CheckedChanged + If chkSpellDISpanYear.Checked Then + clsRTwoArg5.AddParameter("spells.can.span.years", "TRUE") + Else + clsRTwoArg5.RemoveParameterByName("spells.can.span.years") + End If + End Sub + + Private Sub chkMaxSpellSpanYears_CheckedChanged(sender As Object, e As EventArgs) Handles chkMaxSpellSpanYears.CheckedChanged + If chkMaxSpellSpanYears.Checked Then + clsRTwoArg4.RemoveParameterByName("spells.can.span.years") + Else + clsRTwoArg4.AddParameter("spells.can.span.years", "FALSE") + End If + End Sub + + Public Sub IndicesOptions() + If (chkFrostDays.Checked = True) Then + clsROneArg.SetRCommand("climdex.fd") + frmMain.clsRLink.RunScript(clsROneArg.ToScript(), 2) + End If + If (chkSummerDays.Checked = True) Then + clsROneArg.SetRCommand("climdex.su") + frmMain.clsRLink.RunScript(clsROneArg.ToScript(), 2) + End If + If (chkIcingDays.Checked = True) Then + clsROneArg.SetRCommand("climdex.id") + frmMain.clsRLink.RunScript(clsROneArg.ToScript(), 2) + End If + If (chkTropicalNights.Checked = True) Then + clsROneArg.SetRCommand("climdex.tr") + frmMain.clsRLink.RunScript(clsROneArg.ToScript(), 2) + End If + If (chkGrowingSeasonLength.Checked = True) Then + clsRTwoArg2.SetRCommand("climdex.gsl") + frmMain.clsRLink.RunScript(clsRTwoArg2.ToScript(), 2) + End If + If (chkMonthlyMaxDailyTMax.Checked = True) Then + clsRTwoArg1.SetRCommand("climdex.txx") + frmMain.clsRLink.RunScript(clsRTwoArg1.ToScript(), 2) + End If + If (chkMonthlyMaxDailyTMin.Checked = True) Then + clsRTwoArg1.SetRCommand("climdex.tnx") + frmMain.clsRLink.RunScript(clsRTwoArg1.ToScript(), 2) + End If + If (chkMonthlyMinDailyTMax.Checked = True) Then + clsRTwoArg1.SetRCommand("climdex.txn") + frmMain.clsRLink.RunScript(clsRTwoArg1.ToScript(), 2) + End If + If (chkMonthlyMinDailyTMin.Checked = True) Then + clsRTwoArg1.SetRCommand("climdex.tnn") + frmMain.clsRLink.RunScript(clsRTwoArg1.ToScript(), 2) + End If + If (chkTminBelow10Percent.Checked = True) Then + clsRTwoArg1.SetRCommand("climdex.tn10p") + frmMain.clsRLink.RunScript(clsRTwoArg1.ToScript(), 2) + End If + If (chkTmaxBelow10Percent.Checked = True) Then + clsRTwoArg1.SetRCommand("climdex.tx10p") + frmMain.clsRLink.RunScript(clsRTwoArg1.ToScript(), 2) + End If + If (chkTminAbove90Percent.Checked = True) Then + clsRTwoArg1.SetRCommand("climdex.tn90p") + frmMain.clsRLink.RunScript(clsRTwoArg1.ToScript(), 2) + End If + If (chkTmaxAbove90Percent.Checked = True) Then + clsRTwoArg1.SetRCommand("climdex.tx90p") + frmMain.clsRLink.RunScript(clsRTwoArg1.ToScript(), 2) + End If + If (chkWarmSpellDI.Checked = True) Then + clsRTwoArg5.SetRCommand("climdex.wsdi") + frmMain.clsRLink.RunScript(clsRTwoArg5.ToScript(), 2) + End If + If (chkColdSpellDI.Checked = True) Then + clsRTwoArg5.SetRCommand("climdex.csdi") + frmMain.clsRLink.RunScript(clsRTwoArg5.ToScript(), 2) + End If + If (chkMeanDiurnalTempRange.Checked = True) Then + clsRTwoArg1.SetRCommand("climdex.dtr") + frmMain.clsRLink.RunScript(clsRTwoArg1.ToScript(), 2) + End If + If (chkMonthlyMax1dayPrec.Checked = True) Then + clsRTwoArg1.SetRCommand("climdex.rx1day") + frmMain.clsRLink.RunScript(clsRTwoArg1.ToScript(), 2) + End If + If (chkMonthlyMax5dayPrec.Checked = True) Then + clsRThreeArg.SetRCommand("climdex.rx5day") + frmMain.clsRLink.RunScript(clsRThreeArg.ToScript(), 2) + End If + If (chkSimplePrecII.Checked = True) Then + clsROneArg.SetRCommand("climdex.sdii") + frmMain.clsRLink.RunScript(clsROneArg.ToScript(), 2) + End If + If (chkPrecExceed10mm.Checked = True) Then + clsROneArg.SetRCommand("climdex.r10mm") + frmMain.clsRLink.RunScript(clsROneArg.ToScript(), 2) + End If + If (chkPrecExceed20mm.Checked = True) Then + clsROneArg.SetRCommand("climdex.r20mm") + frmMain.clsRLink.RunScript(clsROneArg.ToScript(), 2) + End If + If (chkPrecExceedSpecifiedA.Checked = True) Then + clsRTwoArg3.SetRCommand("climdex.rnnmm") + frmMain.clsRLink.RunScript(clsRTwoArg3.ToScript(), 2) + End If + If (chkMaxDrySpell.Checked = True) Then + clsRTwoArg4.SetRCommand("climdex.cdd") + frmMain.clsRLink.RunScript(clsRTwoArg4.ToScript(), 2) + End If + If (chkMaxWetSpell.Checked = True) Then + clsRTwoArg4.SetRCommand("climdex.cwd") + frmMain.clsRLink.RunScript(clsRTwoArg4.ToScript(), 2) + End If + If (chkPrecExceed95Percent.Checked = True) Then + clsROneArg.SetRCommand("climdex.r95ptot") + frmMain.clsRLink.RunScript(clsROneArg.ToScript(), 2) + End If + If (chkPrecExceed99Percent.Checked = True) Then + clsROneArg.SetRCommand("climdex.r99ptot") + frmMain.clsRLink.RunScript(clsROneArg.ToScript(), 2) + End If + If (chkTotalDailyPrec.Checked = True) Then + clsROneArg.SetRCommand("climdex.prcptot") + frmMain.clsRLink.RunScript(clsROneArg.ToScript(), 2) + End If End Sub End Class \ No newline at end of file diff --git a/instat/sdgLayerOptions.Designer.vb b/instat/sdgLayerOptions.Designer.vb index 3844acab459..878737b5c3a 100644 --- a/instat/sdgLayerOptions.Designer.vb +++ b/instat/sdgLayerOptions.Designer.vb @@ -24,8 +24,8 @@ Partial Class sdgLayerOptions Private Sub InitializeComponent() Me.tbcLayers = New System.Windows.Forms.TabControl() Me.tbpAesthetics = New System.Windows.Forms.TabPage() - Me.tbpGeomParameters = New System.Windows.Forms.TabPage() Me.ucrGeomWithAes = New instat.UcrGeomListWithParameters() + Me.tbpGeomParameters = New System.Windows.Forms.TabPage() Me.ucrLayerParameter = New instat.ucrLayerParameters() Me.ucrSdgLayerBase = New instat.ucrButtonsSubdialogue() Me.tbcLayers.SuspendLayout() @@ -40,7 +40,7 @@ Partial Class sdgLayerOptions Me.tbcLayers.Location = New System.Drawing.Point(13, 13) Me.tbcLayers.Name = "tbcLayers" Me.tbcLayers.SelectedIndex = 0 - Me.tbcLayers.Size = New System.Drawing.Size(482, 383) + Me.tbcLayers.Size = New System.Drawing.Size(482, 417) Me.tbcLayers.TabIndex = 1 ' 'tbpAesthetics @@ -49,40 +49,40 @@ Partial Class sdgLayerOptions Me.tbpAesthetics.Location = New System.Drawing.Point(4, 22) Me.tbpAesthetics.Name = "tbpAesthetics" Me.tbpAesthetics.Padding = New System.Windows.Forms.Padding(3) - Me.tbpAesthetics.Size = New System.Drawing.Size(474, 357) + Me.tbpAesthetics.Size = New System.Drawing.Size(474, 391) Me.tbpAesthetics.TabIndex = 0 Me.tbpAesthetics.Text = "Layer Dimensions(Aesthetics)" Me.tbpAesthetics.UseVisualStyleBackColor = True ' + 'ucrGeomWithAes + ' + Me.ucrGeomWithAes.Location = New System.Drawing.Point(6, 6) + Me.ucrGeomWithAes.Name = "ucrGeomWithAes" + Me.ucrGeomWithAes.Size = New System.Drawing.Size(467, 286) + Me.ucrGeomWithAes.TabIndex = 0 + ' 'tbpGeomParameters ' Me.tbpGeomParameters.Controls.Add(Me.ucrLayerParameter) Me.tbpGeomParameters.Location = New System.Drawing.Point(4, 22) Me.tbpGeomParameters.Name = "tbpGeomParameters" Me.tbpGeomParameters.Padding = New System.Windows.Forms.Padding(3) - Me.tbpGeomParameters.Size = New System.Drawing.Size(474, 357) + Me.tbpGeomParameters.Size = New System.Drawing.Size(474, 391) Me.tbpGeomParameters.TabIndex = 1 Me.tbpGeomParameters.Text = "Layer Parameters(Geom Parameters)" Me.tbpGeomParameters.UseVisualStyleBackColor = True ' - 'ucrGeomWithAes - ' - Me.ucrGeomWithAes.Location = New System.Drawing.Point(6, 6) - Me.ucrGeomWithAes.Name = "ucrGeomWithAes" - Me.ucrGeomWithAes.Size = New System.Drawing.Size(467, 286) - Me.ucrGeomWithAes.TabIndex = 0 - ' 'ucrLayerParameter ' Me.ucrLayerParameter.Location = New System.Drawing.Point(3, 3) Me.ucrLayerParameter.Name = "ucrLayerParameter" - Me.ucrLayerParameter.Size = New System.Drawing.Size(308, 355) + Me.ucrLayerParameter.Size = New System.Drawing.Size(308, 385) Me.ucrLayerParameter.TabIndex = 0 Me.ucrLayerParameter.ucrGeomWithAes = Nothing ' 'ucrSdgLayerBase ' - Me.ucrSdgLayerBase.Location = New System.Drawing.Point(186, 395) + Me.ucrSdgLayerBase.Location = New System.Drawing.Point(186, 436) Me.ucrSdgLayerBase.Name = "ucrSdgLayerBase" Me.ucrSdgLayerBase.Size = New System.Drawing.Size(142, 30) Me.ucrSdgLayerBase.TabIndex = 0 @@ -91,7 +91,7 @@ Partial Class sdgLayerOptions ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(507, 425) + Me.ClientSize = New System.Drawing.Size(507, 467) Me.Controls.Add(Me.tbcLayers) Me.Controls.Add(Me.ucrSdgLayerBase) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow diff --git a/instat/static/InstatObject/R/Rsetup.R b/instat/static/InstatObject/R/Rsetup.R index fc5a463f8b9..58d27684dce 100644 --- a/instat/static/InstatObject/R/Rsetup.R +++ b/instat/static/InstatObject/R/Rsetup.R @@ -46,6 +46,7 @@ library(httr) library(jsonlite) library(fitdistrplus) library(visreg) +library(climdex.pcic) setwd(dirname(parent.frame(2)$ofile)) diff --git a/instat/ucrGeom.vb b/instat/ucrGeom.vb index cb9a42fc9b7..9889d30eb85 100644 --- a/instat/ucrGeom.vb +++ b/instat/ucrGeom.vb @@ -199,23 +199,46 @@ Public Class ucrGeom clsgeom_boxplot.SetGeomName("geom_boxplot") - clsgeom_boxplot.AddAesParameter("x", strIncludedDataTypes:={"factor", "numeric"}) + clsgeom_boxplot.AddAesParameter("x") clsgeom_boxplot.AddAesParameter("y", strIncludedDataTypes:={"numeric"}, bIsMandatory:=True) - clsgeom_boxplot.AddAesParameter("fill", strIncludedDataTypes:={"factor"}) - clsgeom_boxplot.AddAesParameter("colour", strIncludedDataTypes:={"factor"}) + 'Warning: When x is continuous, there needs to be a grouping variable... for example cut_width(x,0.25). In our setting, a factor column can be used. If group is empty, R will send a warning message and ignore the x variable (still labels x though). + 'Task: Add a warning message in the front end to explain the necessity to specify group. Give suggestions on how to proceed (use an existing factor, create a new factor column using cut_width...). To do when front-end messages will have been sorted properly. + clsgeom_boxplot.AddAesParameter("group", strIncludedDataTypes:={"factor"}) + + 'Warning: The following aesthetics should be assigned to calculations for the different parameters of a boxplot. Only relevant for sort of summaries. + 'clsgeom_boxplot.AddAesParameter("lower", strIncludedDataTypes:={"numeric"}) + 'clsgeom_boxplot.AddAesParameter("upper", strIncludedDataTypes:={"numeric"}) + 'clsgeom_boxplot.AddAesParameter("middle", strIncludedDataTypes:={"numeric"}) + 'clsgeom_boxplot.AddAesParameter("ymax", strIncludedDataTypes:={"numeric"}) + 'clsgeom_boxplot.AddAesParameter("ymin", strIncludedDataTypes:={"numeric"}) + + clsgeom_boxplot.AddAesParameter("fill", strIncludedDataTypes:={"factor", "numeric"}) + clsgeom_boxplot.AddAesParameter("colour", strIncludedDataTypes:={"factor", "numeric"}) + clsgeom_boxplot.AddAesParameter("alpha", strIncludedDataTypes:={"factor", "numeric"}) clsgeom_boxplot.AddAesParameter("linetype", strIncludedDataTypes:={"factor"}) - clsgeom_boxplot.AddAesParameter("size", strIncludedDataTypes:={"factor"}) + clsgeom_boxplot.AddAesParameter("size", strIncludedDataTypes:={"factor", "numeric"}) clsgeom_boxplot.AddAesParameter("weight", strIncludedDataTypes:={"numeric"}) - clsgeom_boxplot.AddAesParameter("group", strIncludedDataTypes:={"factor"}) + clsgeom_boxplot.AddAesParameter("shape", strIncludedDataTypes:={"factor"}) 'adding layerParameters + 'Main geom_boxplot parameters clsgeom_boxplot.AddLayerParameter("notch", "boolean", "TRUE") - clsgeom_boxplot.AddLayerParameter("notchwidth", "numeric", "0.5", lstParameterStrings:={1}) + clsgeom_boxplot.AddLayerParameter("notchwidth", "numeric", "0.5", lstParameterStrings:={0.1}) 'Question to be discussed: this sets the width of the notch as a proportion of the boxplot width. Values can be anything in ggplot but negative ones just give a silly looking thing (I ve left it in for now, but would suggest we exclude ?), and I don't know if values above 1 make sense ? The notch would then be larger than the boxplot. clsgeom_boxplot.AddLayerParameter("varwidth", "boolean", "TRUE") - clsgeom_boxplot.AddLayerParameter("coef", "numeric", "1.5", lstParameterStrings:={1}) - clsgeom_boxplot.AddLayerParameter("outlier.shape", "numeric", "19", lstParameterStrings:={1, 0, 25}) 'there are other symbols that we can add here + clsgeom_boxplot.AddLayerParameter("coef", "numeric", "1.5", lstParameterStrings:={0.1}) 'Question to be discussed: This parameter is setting the length of the whiskers as a multiple of the IQR. When giving a negative value, the whiskers are simply of length 0. Also the window showing the graph doesn't adapt to the whiskers' length, which means they are simply cut when too long. + clsgeom_boxplot.AddLayerParameter("outlier.shape", "numeric", "19", lstParameterStrings:={1, 0, 25}) 'Warning: there are other symbols that we can add here clsgeom_boxplot.AddLayerParameter("outlier.colour", "colour", "NULL") - clsgeom_boxplot.AddLayerParameter("outlier.stroke ", "numeric", "0.5", lstParameterStrings:={1, 0}) + clsgeom_boxplot.AddLayerParameter("outlier.stroke", "numeric", "0.5", lstParameterStrings:={1, 0}) 'Outlier.stroke parameter gives the size of the outliers. It cannot be negative, this would trigger an error in R. + + 'Global Layer parameters + clsgeom_boxplot.AddLayerParameter("show.legend", "boolean", "TRUE") 'Warning: The default value in R is NA, which only shows legend for that layer if aesthetics are mapped. + clsgeom_boxplot.AddLayerParameter("position", "list", Chr(34) & "dodge" & Chr(34), lstParameterStrings:={Chr(34) & "stack" & Chr(34), Chr(34) & "fill" & Chr(34), Chr(34) & "dodge" & Chr(34), Chr(34) & "jitter" & Chr(34), Chr(34) & "identity" & Chr(34)}) 'Warning: Could add the possiility to adjust the height and width parameters in the position function position_jitter, also width for dodge... Sometimes useful to only jitter in one direction for example... + 'Aesthetics as layer parameters... Used fo fix colour, transparence, ... of the geom on that Layer. + clsgeom_boxplot.AddLayerParameter("fill", "colour", "NULL") + clsgeom_boxplot.AddLayerParameter("colour", "colour", "NULL") + clsgeom_boxplot.AddLayerParameter("linetype", "numeric", "1", lstParameterStrings:={1, 0, 6}) + clsgeom_boxplot.AddLayerParameter("alpha", "numeric", "1", lstParameterStrings:={0.01, 0, 1}) + lstAllGeoms.Add(clsgeom_boxplot) 'clsgeom_contour.SetGeomName("geom_contour") diff --git a/instat/ucrLayerParameters.Designer.vb b/instat/ucrLayerParameters.Designer.vb index a15d8cd1b0b..7170dd1fd6e 100644 --- a/instat/ucrLayerParameters.Designer.vb +++ b/instat/ucrLayerParameters.Designer.vb @@ -31,6 +31,7 @@ Partial Class ucrLayerParameters Me.UcrLayerParamsControls10 = New instat.ucrLayerParamsControls() Me.UcrLayerParamsControls11 = New instat.ucrLayerParamsControls() Me.UcrLayerParamsControls12 = New instat.ucrLayerParamsControls() + Me.UcrLayerParamsControls13 = New instat.ucrLayerParamsControls() Me.SuspendLayout() ' 'UcrLayerParamsControls1 @@ -117,9 +118,17 @@ Partial Class ucrLayerParameters Me.UcrLayerParamsControls12.Size = New System.Drawing.Size(290, 25) Me.UcrLayerParamsControls12.TabIndex = 13 ' + 'UcrLayerParamsControls13 + ' + Me.UcrLayerParamsControls13.Location = New System.Drawing.Point(6, 350) + Me.UcrLayerParamsControls13.Name = "UcrLayerParamsControls13" + Me.UcrLayerParamsControls13.Size = New System.Drawing.Size(290, 25) + Me.UcrLayerParamsControls13.TabIndex = 14 + ' 'ucrLayerParameters ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.Controls.Add(Me.UcrLayerParamsControls13) Me.Controls.Add(Me.UcrLayerParamsControls12) Me.Controls.Add(Me.UcrLayerParamsControls6) Me.Controls.Add(Me.UcrLayerParamsControls11) @@ -133,7 +142,7 @@ Partial Class ucrLayerParameters Me.Controls.Add(Me.UcrLayerParamsControls2) Me.Controls.Add(Me.UcrLayerParamsControls1) Me.Name = "ucrLayerParameters" - Me.Size = New System.Drawing.Size(265, 361) + Me.Size = New System.Drawing.Size(265, 382) Me.Controls.SetChildIndex(Me.UcrLayerParamsControls1, 0) Me.Controls.SetChildIndex(Me.UcrLayerParamsControls2, 0) Me.Controls.SetChildIndex(Me.UcrLayerParamsControls3, 0) @@ -146,6 +155,7 @@ Partial Class ucrLayerParameters Me.Controls.SetChildIndex(Me.UcrLayerParamsControls11, 0) Me.Controls.SetChildIndex(Me.UcrLayerParamsControls6, 0) Me.Controls.SetChildIndex(Me.UcrLayerParamsControls12, 0) + Me.Controls.SetChildIndex(Me.UcrLayerParamsControls13, 0) Me.ResumeLayout(False) Me.PerformLayout() @@ -163,4 +173,5 @@ Partial Class ucrLayerParameters Friend WithEvents UcrLayerParamsControls10 As ucrLayerParamsControls Friend WithEvents UcrLayerParamsControls11 As ucrLayerParamsControls Friend WithEvents UcrLayerParamsControls12 As ucrLayerParamsControls + Friend WithEvents UcrLayerParamsControls13 As ucrLayerParamsControls End Class diff --git a/instat/ucrLayerParameters.vb b/instat/ucrLayerParameters.vb index 71e340880ce..857f9f80888 100644 --- a/instat/ucrLayerParameters.vb +++ b/instat/ucrLayerParameters.vb @@ -27,7 +27,7 @@ Public Class ucrLayerParameters InitializeComponent() ' Add any initialization after the InitializeComponent() call. - lstLayerParameterControl.AddRange({UcrLayerParamsControls1, UcrLayerParamsControls2, UcrLayerParamsControls3, UcrLayerParamsControls4, UcrLayerParamsControls5, UcrLayerParamsControls6, UcrLayerParamsControls7, UcrLayerParamsControls8, UcrLayerParamsControls9, UcrLayerParamsControls10, UcrLayerParamsControls11, UcrLayerParamsControls12}) + lstLayerParameterControl.AddRange({UcrLayerParamsControls1, UcrLayerParamsControls2, UcrLayerParamsControls3, UcrLayerParamsControls4, UcrLayerParamsControls5, UcrLayerParamsControls6, UcrLayerParamsControls7, UcrLayerParamsControls8, UcrLayerParamsControls9, UcrLayerParamsControls10, UcrLayerParamsControls11, UcrLayerParamsControls12, UcrLayerParamsControls13}) End Sub Private Sub ucrLayerParameters_Load(sender As Object, e As EventArgs) Handles MyBase.Load diff --git a/instat/ucrSaveGraph.vb b/instat/ucrSaveGraph.vb index bbf53d56bc2..eb92f76ddaa 100644 --- a/instat/ucrSaveGraph.vb +++ b/instat/ucrSaveGraph.vb @@ -1,6 +1,7 @@ Public Class ucrSaveGraph Public Event SaveGraphCheckedChanged() Public Event GraphNameChanged() + Public Event ContentsChanged() Public bFirstLoad As Boolean Public Sub New() @@ -43,8 +44,12 @@ If chkSaveGraph.Checked Then RaiseEvent GraphNameChanged() End If - End Sub - + End Sub + + Private Sub ucrInputGraphName_ContentsChanged() Handles ucrInputGraphName.ContentsChanged + RaiseEvent ContentsChanged() + End Sub + Public ReadOnly Property bSaveGraph() As Boolean Get Return chkSaveGraph.Checked