Skip to content

Commit

Permalink
changes to the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalis95 committed Jun 24, 2024
1 parent 4fac676 commit eda90e1
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions instat/sdgDefineAnnualRainfall.vb
Original file line number Diff line number Diff line change
Expand Up @@ -225,21 +225,6 @@ Public Class sdgDefineAnnualRainfall
clsReformatTempSummariesFunction = clsNewReformatTempSummariesFunction
clsExportRinstatToBucketFunction = clsNewExportRinstatToBucketFunction

ucrReceiverSeasonalLength.AddAdditionalCodeParameterPair(clsExportRinstatToBucketFunction, New RParameter("season_length_col", 12), iAdditionalPairNo:=1)
ucrReceiverEndSeasonDate.AddAdditionalCodeParameterPair(clsExportRinstatToBucketFunction, New RParameter("end_season_date_col", 8), iAdditionalPairNo:=1)
ucrReceiverEndSeasonDOY.AddAdditionalCodeParameterPair(clsExportRinstatToBucketFunction, New RParameter("end_season_doy_col", 7), iAdditionalPairNo:=1)
ucrReceiverStartRainDOY.AddAdditionalCodeParameterPair(clsExportRinstatToBucketFunction, New RParameter("start_rains_doy_col", 3), iAdditionalPairNo:=1)
ucrReceiverStartRainDate.AddAdditionalCodeParameterPair(clsExportRinstatToBucketFunction, New RParameter("start_rains_date_col", 4), iAdditionalPairNo:=1)
ucrReceiverEndRainsDate.AddAdditionalCodeParameterPair(clsExportRinstatToBucketFunction, New RParameter("end_rains_date_col", 6), iAdditionalPairNo:=1)
ucrReceiverEndRainsDOY.AddAdditionalCodeParameterPair(clsExportRinstatToBucketFunction, New RParameter("end_rains_date_col", 6), iAdditionalPairNo:=1)

ucrReceiverMinMaxAnnual.AddAdditionalCodeParameterPair(clsExportRinstatToBucketFunction, New RParameter("min_tmax_col", 7), iAdditionalPairNo:=1)
ucrReceiverMaxMaxAnnual.AddAdditionalCodeParameterPair(clsExportRinstatToBucketFunction, New RParameter("max_tmax_col", 8), iAdditionalPairNo:=1)
ucrReceiverMeanMaxAnnual.AddAdditionalCodeParameterPair(clsExportRinstatToBucketFunction, New RParameter("mean_tmax_col", 6), iAdditionalPairNo:=1)
ucrReceiverMeanAnnual.AddAdditionalCodeParameterPair(clsExportRinstatToBucketFunction, New RParameter("mean_tmin_col", 3), iAdditionalPairNo:=1)
ucrReceiverMinMinAnnual.AddAdditionalCodeParameterPair(clsExportRinstatToBucketFunction, New RParameter("min_tmin_col", 4), iAdditionalPairNo:=1)
ucrReceiverMaxMinAnnual.AddAdditionalCodeParameterPair(clsExportRinstatToBucketFunction, New RParameter("max_tmin_col", 5), iAdditionalPairNo:=1)

ucrReceiverAnnualRain.SetRCode(clsReforMattAnnualSummariesFunction, bReset)
ucrReceiverEndRainsDate.SetRCode(clsReforMattAnnualSummariesFunction, bReset)
ucrReceiverEndRainsDOY.SetRCode(clsReforMattAnnualSummariesFunction, bReset)
Expand Down Expand Up @@ -301,16 +286,25 @@ Public Class sdgDefineAnnualRainfall
ucrReceiverEndSeasonDate.IsEmpty AndAlso ucrReceiverEndSeasonDOY.IsEmpty AndAlso ucrReceiverRainDaysSeason.IsEmpty AndAlso ucrReceiverRainDaysYear.IsEmpty AndAlso ucrReceiverStartRainDate.IsEmpty AndAlso
ucrReceiverStartRainDOY.IsEmpty AndAlso ucrReceiverStation.IsEmpty AndAlso ucrReceiverYear.IsEmpty) Then
clsExportRinstatToBucketFunction.AddParameter("annual_rainfall_data", clsRFunctionParameter:=clsReforMattAnnualSummariesFunction, iPosition:=1)
clsExportRinstatToBucketFunction.AddParameter("start_rains", "start_rains_column", iPosition:=2, bIncludeArgumentName:=False)
clsExportRinstatToBucketFunction.AddParameter("end_rains", "end_rains_column", iPosition:=3, bIncludeArgumentName:=False)
clsExportRinstatToBucketFunction.AddParameter("end_season_rains", "end_season_column", iPosition:=4, bIncludeArgumentName:=False)
clsExportRinstatToBucketFunction.AddParameter("seasonal_rains", "seasonal_length_column", iPosition:=5, bIncludeArgumentName:=False)

Else
clsExportRinstatToBucketFunction.RemoveParameterByName("annual_rainfall_data")
clsExportRinstatToBucketFunction.RemoveParameterByName("start_rains")
clsExportRinstatToBucketFunction.RemoveParameterByName("end_rains")
clsExportRinstatToBucketFunction.RemoveParameterByName("end_season_rains")
clsExportRinstatToBucketFunction.RemoveParameterByName("seasonal_rains")
End If
End Sub

Private Sub ucrReceiverStationCrop_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverStationCrop.ControlValueChanged, ucrReceiverTotalRain.ControlValueChanged, ucrReceiverPlantingDay.ControlValueChanged, ucrReceiverPlantingLenghth.ControlValueChanged,
ucrReceiverPropSuccess.ControlValueChanged

If Not (ucrReceiverStationCrop.IsEmpty AndAlso ucrReceiverTotalRain.IsEmpty AndAlso ucrReceiverPlantingDay.IsEmpty AndAlso ucrReceiverPlantingLenghth.IsEmpty AndAlso ucrReceiverPropSuccess.IsEmpty) Then
clsExportRinstatToBucketFunction.AddParameter("crop_success_data", clsRFunctionParameter:=clsReformatCropSuccessFunction, iPosition:=2)
clsExportRinstatToBucketFunction.AddParameter("crop_success_data", clsRFunctionParameter:=clsReformatCropSuccessFunction, iPosition:=6)
Else
clsExportRinstatToBucketFunction.RemoveParameterByName("crop_success_data")
End If
Expand All @@ -319,7 +313,7 @@ Public Class sdgDefineAnnualRainfall
Private Sub ucrReceiverSeasonStationProb_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSeasonStationProb.ControlValueChanged, ucrReceiverSeasonPlantingDay.ControlValueChanged, ucrReceiverPlantingDayCondition.ControlValueChanged, ucrReceiverSeasonYear.ControlValueChanged

If Not (ucrReceiverSeasonStationProb.IsEmpty AndAlso ucrReceiverSeasonPlantingDay.IsEmpty AndAlso ucrReceiverPlantingDayCondition.IsEmpty AndAlso ucrReceiverSeasonYear.IsEmpty) Then
clsExportRinstatToBucketFunction.AddParameter("season_start_data", clsRFunctionParameter:=clsReformatSeasonStartFunction, iPosition:=3)
clsExportRinstatToBucketFunction.AddParameter("season_start_data", clsRFunctionParameter:=clsReformatSeasonStartFunction, iPosition:=7)
Else
clsExportRinstatToBucketFunction.RemoveParameterByName("season_start_data")
End If
Expand All @@ -328,16 +322,27 @@ Public Class sdgDefineAnnualRainfall
Private Sub ucrReceiverAnnualTempStation_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverAnnualTempStation.ControlValueChanged, ucrReceiverAnnualTempYr.ControlValueChanged, ucrReceiverMaxMaxAnnual.ControlValueChanged, ucrReceiverMaxMinAnnual.ControlValueChanged, ucrReceiverMeanAnnual.ControlValueChanged, ucrReceiverMeanMaxAnnual.ControlValueChanged, ucrReceiverMinMaxAnnual.ControlValueChanged, ucrReceiverMinMinAnnual.ControlValueChanged
If Not (ucrReceiverAnnualTempStation.IsEmpty AndAlso ucrReceiverAnnualTempYr.IsEmpty AndAlso ucrReceiverMaxMaxAnnual.IsEmpty AndAlso
ucrReceiverMaxMinAnnual.IsEmpty AndAlso ucrReceiverMeanAnnual.IsEmpty AndAlso ucrReceiverMeanMaxAnnual.IsEmpty AndAlso ucrReceiverMinMaxAnnual.IsEmpty AndAlso ucrReceiverMinMinAnnual.IsEmpty) Then
clsExportRinstatToBucketFunction.AddParameter("annual_temperature_data", clsRFunctionParameter:=clsReformatTempSummariesFunction, iPosition:=4)
clsExportRinstatToBucketFunction.AddParameter("annual_temperature_data", clsRFunctionParameter:=clsReformatTempSummariesFunction, iPosition:=8)
clsExportRinstatToBucketFunction.AddParameter("min_tmax", "min_tmax_column", iPosition:=9, bIncludeArgumentName:=False)
clsExportRinstatToBucketFunction.AddParameter("min_tmax_col", "max_tmax_column", iPosition:=10, bIncludeArgumentName:=False)
clsExportRinstatToBucketFunction.AddParameter("mean_tmax", "mean_tmax_column", iPosition:=11, bIncludeArgumentName:=False)
clsExportRinstatToBucketFunction.AddParameter("min_tmin", "min_tmin_column", iPosition:=12, bIncludeArgumentName:=False)
clsExportRinstatToBucketFunction.AddParameter("min_tmin_col", "max_tmin_column", iPosition:=13, bIncludeArgumentName:=False)
clsExportRinstatToBucketFunction.AddParameter("mean_tmin", "mean_tmin_column", iPosition:=14, bIncludeArgumentName:=False)
Else

clsExportRinstatToBucketFunction.RemoveParameterByName("annual_temperature_data")
clsExportRinstatToBucketFunction.RemoveParameterByName("min_tmax")
clsExportRinstatToBucketFunction.RemoveParameterByName("min_tmax_col")
clsExportRinstatToBucketFunction.RemoveParameterByName("mean_tmax")
clsExportRinstatToBucketFunction.RemoveParameterByName("min_tmin")
clsExportRinstatToBucketFunction.RemoveParameterByName("min_tmin_col")
clsExportRinstatToBucketFunction.RemoveParameterByName("mean_tmin")
End If
End Sub

Private Sub ucrReceiverMonthlyTemp_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverMonthlyTemp.ControlValueChanged, ucrReceiverYearMonthly.ControlValueChanged, ucrReceiverMonthMonthly.ControlValueChanged, ucrReceiverMeanmaxMonthly.ControlValueChanged, ucrReceiverMeanminMontly.ControlValueChanged, ucrReceiverMinMaxMonthly.ControlValueChanged, ucrReceiverMinMinMonthly.ControlValueChanged, ucrReceiverMaxMinMonthly.ControlValueChanged, ucrReceiverMaxMaxMonthly.ControlValueChanged
If Not (ucrReceiverMonthlyTemp.IsEmpty AndAlso ucrReceiverYearMonthly.IsEmpty AndAlso ucrReceiverMonthMonthly.IsEmpty AndAlso ucrReceiverMeanmaxMonthly.IsEmpty AndAlso ucrReceiverMeanminMontly.IsEmpty AndAlso ucrReceiverMinMaxMonthly.IsEmpty AndAlso ucrReceiverMinMinMonthly.IsEmpty AndAlso ucrReceiverMaxMinMonthly.IsEmpty AndAlso ucrReceiverMaxMaxMonthly.IsEmpty) Then
clsExportRinstatToBucketFunction.AddParameter("monthly_temperature_data", clsRFunctionParameter:=clsReformatMonthlyTempSummaries, iPosition:=5)
clsExportRinstatToBucketFunction.AddParameter("monthly_temperature_data", clsRFunctionParameter:=clsReformatMonthlyTempSummaries, iPosition:=15)
Else
clsExportRinstatToBucketFunction.RemoveParameterByName("monthly_temperature_data")
End If
Expand Down

0 comments on commit eda90e1

Please sign in to comment.