Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformer.cs
===================================================================
diff -u -r2947e0c629f21f58380b39ac8ac51a2082a1a40c -r38940fd430501da3c19ac8c90f660b21f8938909
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformer.cs (.../MacroStabilityInwardsPreconsolidationStressTransformer.cs) (revision 2947e0c629f21f58380b39ac8ac51a2082a1a40c)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformer.cs (.../MacroStabilityInwardsPreconsolidationStressTransformer.cs) (revision 38940fd430501da3c19ac8c90f660b21f8938909)
@@ -27,6 +27,7 @@
using Ringtoets.Common.IO.SoilProfile;
using Ringtoets.MacroStabilityInwards.Data.SoilProfile;
using Ringtoets.MacroStabilityInwards.IO.Properties;
+using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources;
namespace Ringtoets.MacroStabilityInwards.IO.SoilProfiles
{
@@ -56,11 +57,10 @@
throw new ArgumentNullException(nameof(preconsolidationStress));
}
- var location = new Point2D(preconsolidationStress.XCoordinate,
- preconsolidationStress.ZCoordinate);
+ DistributionHelper.ValidateIsNonShiftedLogNormal(preconsolidationStress.StressDistributionType,
+ preconsolidationStress.StressShift,
+ Resources.PreconsolidationStress_DisplayName);
- ValidateDistribution(preconsolidationStress, location);
-
try
{
var distribution = new VariationCoefficientLogNormalDistribution
@@ -69,47 +69,21 @@
CoefficientOfVariation = (RoundedDouble) preconsolidationStress.StressCoefficientOfVariation
};
+ var location = new Point2D(preconsolidationStress.XCoordinate,
+ preconsolidationStress.ZCoordinate);
+
return new MacroStabilityInwardsPreconsolidationStress(location, distribution);
}
catch (ArgumentOutOfRangeException e)
{
- string errorMessage = CreateErrorMessage(location, e.Message);
+ string errorMessage = string.Format(RingtoetsCommonIOResources.Stochastic_parameter_0_has_no_lognormal_distribution,
+ Resources.PreconsolidationStress_DisplayName);
throw new ImportedDataTransformException(errorMessage, e);
}
catch (ArgumentException e)
{
throw new ImportedDataTransformException(e.Message, e);
}
}
-
- private static string CreateErrorMessage(Point2D location, string errorMessage)
- {
- return string.Format(Resources.Transform_PreconsolidationStressLocation_0_has_invalid_configuration_ErrorMessage_1_,
- location,
- errorMessage);
- }
-
- ///
- /// Validates whether the values of the
- /// are correct for creating the log normal distribution of a reconsolidation stress.
- ///
- /// The to validate.
- /// The location of the
- /// Thrown when the stochastic parameters
- /// are not defined as a log normal distribution.
- private static void ValidateDistribution(PreconsolidationStress preconsolidationStress, Point2D location)
- {
- try
- {
- DistributionHelper.ValidateLogNormalDistribution(preconsolidationStress.StressDistributionType,
- preconsolidationStress.StressShift,
- Resources.PreconsolidationStress_DisplayName);
- }
- catch (ImportedDataTransformException e)
- {
- string errorMessage = CreateErrorMessage(location, e.Message);
- throw new ImportedDataTransformException(errorMessage, e);
- }
- }
}
}
\ No newline at end of file