Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformer.cs
===================================================================
diff -u -rbe96823492563605254378dd0a11d77ab5fb2004 -r2947e0c629f21f58380b39ac8ac51a2082a1a40c
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformer.cs (.../MacroStabilityInwardsPreconsolidationStressTransformer.cs) (revision be96823492563605254378dd0a11d77ab5fb2004)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformer.cs (.../MacroStabilityInwardsPreconsolidationStressTransformer.cs) (revision 2947e0c629f21f58380b39ac8ac51a2082a1a40c)
@@ -27,7 +27,6 @@
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
{
@@ -57,10 +56,11 @@
throw new ArgumentNullException(nameof(preconsolidationStress));
}
- DistributionHelper.ValidateLogNormalDistribution(preconsolidationStress.StressDistributionType,
- preconsolidationStress.StressShift,
- Resources.PreconsolidationStress_DisplayName);
+ var location = new Point2D(preconsolidationStress.XCoordinate,
+ preconsolidationStress.ZCoordinate);
+ ValidateDistribution(preconsolidationStress, location);
+
try
{
var distribution = new VariationCoefficientLogNormalDistribution
@@ -69,21 +69,47 @@
CoefficientOfVariation = (RoundedDouble) preconsolidationStress.StressCoefficientOfVariation
};
- var location = new Point2D(preconsolidationStress.XCoordinate,
- preconsolidationStress.ZCoordinate);
-
return new MacroStabilityInwardsPreconsolidationStress(location, distribution);
}
catch (ArgumentOutOfRangeException e)
{
- string errorMessage = string.Format(RingtoetsCommonIOResources.Stochastic_parameter_0_must_be_a_lognormal_distribution_with_zero_shift,
- Resources.PreconsolidationStress_DisplayName);
+ string errorMessage = CreateErrorMessage(location, e.Message);
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