Skip to content

Commit

Permalink
chore: move sample depth variable back to underscore, as its only use…
Browse files Browse the repository at this point in the history
…d internally
  • Loading branch information
Nibble-Byte committed Jun 1, 2024
1 parent 49f0136 commit 2b8a3bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions SVSModel.Tests/Configuration/FieldConfigTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void Test_FieldConfig_Excel_Gets_Values_Correctly()
Assert.Equal(fieldConfig.Rocks, Rocks / 100);
Assert.Equal(fieldConfig.SampleDepthFactor, Constants.SampleDepthFactor[SampleDepth]);
Assert.Equal(fieldConfig.BulkDensity, Constants.BulkDensity(SoilCategory, Texture));
Assert.Equal(fieldConfig.AWC, 3 * Constants.AWCpct[Texture] * (1 - Rocks / 100));
Assert.Equal(fieldConfig.AWC, 3 * Constants.AWCPercent[Texture] * (1 - Rocks / 100));
Assert.Equal(fieldConfig.PrePlantRainFactor, Constants.PPRainFactors[PrePlantRain]);
Assert.Equal(fieldConfig.InCropRainFactor, Constants.ICRainFactors[InCropRain]);
Assert.Equal(fieldConfig.IrrigationTrigger, Constants.IrrigationTriggers[Irrigation]);
Expand All @@ -62,7 +62,7 @@ public void Test_FieldConfig_Both_Constructors_Match()
PMN = PMN,
Splits = Splits,
_rawRocks = Rocks,
SampleDepth = SampleDepth,
_sampleDepth = SampleDepth,
_prePlantRain = PrePlantRain,
_inCropRain = InCropRain,
_irrigation = Irrigation
Expand Down
10 changes: 4 additions & 6 deletions SVSModel/Configuration/FieldConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
// Author: Hamish Brown.
// Copyright (c) 2024 The New Zealand Institute for Plant and Food Research Limited

using System;
using System.Collections.Generic;
using static SVSModel.Configuration.InputCategories;

namespace SVSModel.Configuration
{
Expand All @@ -21,16 +19,16 @@ public class FieldConfig
public double PMN { get; init; }
public int Splits { get; init; }
public double _rawRocks { internal get; init; }
public string SampleDepth { internal get; init; }
public string _sampleDepth { internal get; init; }
public string _prePlantRain { internal get; init; }
public string _inCropRain { internal get; init; }
public string _irrigation { internal get; init; }

// Calculated fields
public double Rocks => _rawRocks / 100;
public double SampleDepthFactor => Constants.SampleDepthFactor[SampleDepth];
public double BulkDensity => Constants.BulkDensity(Category, Texture);
public double AWC => 3 * Constants.AWCpct[Texture] * (1 - Rocks);
public double AWC => 3 * Constants.AWCPercent[Texture] * (1 - Rocks);
public double SampleDepthFactor => Constants.SampleDepthFactor[_sampleDepth];
public double PrePlantRainFactor => Constants.PPRainFactors[_prePlantRain];
public double InCropRainFactor => Constants.ICRainFactors[_inCropRain];
public double IrrigationTrigger => Constants.IrrigationTriggers[_irrigation];
Expand All @@ -54,7 +52,7 @@ public FieldConfig(Dictionary<string, object> c)
Splits = int.Parse(c["Splits"].ToString());

_rawRocks = Functions.Num(c["Rocks"]);
SampleDepth = c["SampleDepth"].ToString();
_sampleDepth = c["SampleDepth"].ToString();
_prePlantRain = c["PrePlantRain"].ToString();
_inCropRain = c["InCropRain"].ToString();
_irrigation = c["Irrigation"].ToString();
Expand Down

0 comments on commit 2b8a3bd

Please sign in to comment.