Index: Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs =================================================================== diff -u -r30baf70ea42def18e66d1ec3c71aa0e54a89229a -re40a14c4d5b76ae6e2d9c13407e231b8929f800a --- Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 30baf70ea42def18e66d1ec3c71aa0e54a89229a) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision e40a14c4d5b76ae6e2d9c13407e231b8929f800a) @@ -1694,16 +1694,6 @@ } /// - /// Looks up a localized string similar to Ondergrondschematisatie '{0}' is meerdere keren gevonden in ondergrondmodel '{1}'. Kansen van voorkomen worden opgeteld.. - /// - public static string SoilModelTransformer_GetUniqueStochasticSoilProfiles_StochasticSoilProfile_0_has_multiple_occurences_in_SoilModel_1_Probability_Summed { - get { - return ResourceManager.GetString("SoilModelTransformer_GetUniqueStochasticSoilProfiles_StochasticSoilProfile_0_has_" + - "multiple_occurences_in_SoilModel_1_Probability_Summed", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Het uitlezen van de ondergrondschematisatie is mislukt.. /// public static string SoilProfile1DReader_ReadSoilProfile_Failed_to_construct_profile_from_read_data { @@ -1883,6 +1873,16 @@ } /// + /// Looks up a localized string similar to Ondergrondschematisatie '{0}' is meerdere keren gevonden in ondergrondmodel '{1}'. Kansen van voorkomen worden opgeteld.. + /// + public static string StochasticSoilProfileHelper_GetUniqueStochasticSoilProfiles_StochasticSoilProfile_0_has_multiple_occurences_in_SoilModel_1_Probability_Summed { + get { + return ResourceManager.GetString("StochasticSoilProfileHelper_GetUniqueStochasticSoilProfiles_StochasticSoilProfile" + + "_0_has_multiple_occurences_in_SoilModel_1_Probability_Summed", resourceCulture); + } + } + + /// /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><!-- ///Copyright (C) Stichting Deltares 2017. All rights reserved. /// Index: Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx =================================================================== diff -u -r30baf70ea42def18e66d1ec3c71aa0e54a89229a -re40a14c4d5b76ae6e2d9c13407e231b8929f800a --- Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx (.../Resources.resx) (revision 30baf70ea42def18e66d1ec3c71aa0e54a89229a) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx (.../Resources.resx) (revision e40a14c4d5b76ae6e2d9c13407e231b8929f800a) @@ -889,7 +889,7 @@ Kon geen grensspanningen verkrijgen uit de database. - + Ondergrondschematisatie '{0}' is meerdere keren gevonden in ondergrondmodel '{1}'. Kansen van voorkomen worden opgeteld. \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj =================================================================== diff -u -rc5c91f8ca724aef52a6cd9055a2a32bcd6bc0c03 -re40a14c4d5b76ae6e2d9c13407e231b8929f800a --- Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision c5c91f8ca724aef52a6cd9055a2a32bcd6bc0c03) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision e40a14c4d5b76ae6e2d9c13407e231b8929f800a) @@ -160,6 +160,7 @@ + Fisheye: Tag c5c91f8ca724aef52a6cd9055a2a32bcd6bc0c03 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilProfileHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj =================================================================== diff -u -rc5c91f8ca724aef52a6cd9055a2a32bcd6bc0c03 -re40a14c4d5b76ae6e2d9c13407e231b8929f800a --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision c5c91f8ca724aef52a6cd9055a2a32bcd6bc0c03) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision e40a14c4d5b76ae6e2d9c13407e231b8929f800a) @@ -140,6 +140,7 @@ + Fisheye: Tag c5c91f8ca724aef52a6cd9055a2a32bcd6bc0c03 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/StochasticSoilProfileHelperTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsStochasticSoilModelTransformer.cs =================================================================== diff -u -rbe51145e1b013ea9e1353a6b8618bdc6fd855ff8 -re40a14c4d5b76ae6e2d9c13407e231b8929f800a --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsStochasticSoilModelTransformer.cs (.../MacroStabilityInwardsStochasticSoilModelTransformer.cs) (revision be51145e1b013ea9e1353a6b8618bdc6fd855ff8) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsStochasticSoilModelTransformer.cs (.../MacroStabilityInwardsStochasticSoilModelTransformer.cs) (revision e40a14c4d5b76ae6e2d9c13407e231b8929f800a) @@ -22,7 +22,6 @@ using System; using System.Collections.Generic; using System.Linq; -using log4net; using Ringtoets.Common.IO.Exceptions; using Ringtoets.Common.IO.SoilProfile; using Ringtoets.Common.IO.SoilProfile.Schema; @@ -36,7 +35,6 @@ /// public class MacroStabilityInwardsStochasticSoilModelTransformer : IStochasticSoilModelTransformer { - private static readonly ILog log = LogManager.GetLogger(typeof(MacroStabilityInwardsStochasticSoilModelTransformer)); private readonly Dictionary soilProfiles = new Dictionary(); public MacroStabilityInwardsStochasticSoilModel Transform(StochasticSoilModel stochasticSoilModel) @@ -81,12 +79,12 @@ IEnumerable stochasticSoilProfiles, string soilModelName) { - MacroStabilityInwardsStochasticSoilProfile[] transformedProfiles = stochasticSoilProfiles.Select( - ssp => MacroStabilityInwardsStochasticSoilProfileTransformer.Transform( - ssp, - GetTransformedSoilProfile(ssp.SoilProfile))).ToArray(); - - return GetUniqueStochasticSoilProfiles(transformedProfiles, soilModelName); + IEnumerable uniqueStochasticSoilProfiles = StochasticSoilProfileHelper.GetUniqueStochasticSoilProfiles(stochasticSoilProfiles, + soilModelName); + return uniqueStochasticSoilProfiles.Select(ssp => + MacroStabilityInwardsStochasticSoilProfileTransformer.Transform( + ssp, GetTransformedSoilProfile(ssp.SoilProfile))) + .ToArray(); } /// @@ -110,48 +108,5 @@ } return macroStabilityInwardsSoilProfile; } - - /// - /// Filters a collection of to determine which items - /// are unique. - /// - /// The collection of - /// to filter. - /// The name of the soil model. - /// A collection of unique . - /// Thrown when summing the probabilities of - /// with the same - /// results in an invalid probability. - private static IEnumerable GetUniqueStochasticSoilProfiles( - IEnumerable stochasticSoilProfiles, - string soilModelName) - { - List uniqueStochasticSoilProfiles = stochasticSoilProfiles.ToList(); - MacroStabilityInwardsStochasticSoilProfile[] allStochasticSoilProfiles = uniqueStochasticSoilProfiles.ToArray(); - - try - { - for (var i = 1; i < allStochasticSoilProfiles.Length; i++) - { - MacroStabilityInwardsStochasticSoilProfile previousProfile = allStochasticSoilProfiles[i - 1]; - MacroStabilityInwardsStochasticSoilProfile currentProfile = allStochasticSoilProfiles[i]; - if (ReferenceEquals(currentProfile.SoilProfile, previousProfile.SoilProfile)) - { - log.Warn(string.Format(RingtoetsCommonIOResources.SoilModelTransformer_GetUniqueStochasticSoilProfiles_StochasticSoilProfile_0_has_multiple_occurences_in_SoilModel_1_Probability_Summed, - previousProfile.SoilProfile.Name, - soilModelName)); - - previousProfile.AddProbability(currentProfile.Probability); - uniqueStochasticSoilProfiles.Remove(currentProfile); - } - } - } - catch (ArgumentOutOfRangeException e) - { - throw new ImportedDataTransformException(e.Message, e); - } - - return uniqueStochasticSoilProfiles; - } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingStochasticSoilModelTransformer.cs =================================================================== diff -u -rbe51145e1b013ea9e1353a6b8618bdc6fd855ff8 -re40a14c4d5b76ae6e2d9c13407e231b8929f800a --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingStochasticSoilModelTransformer.cs (.../PipingStochasticSoilModelTransformer.cs) (revision be51145e1b013ea9e1353a6b8618bdc6fd855ff8) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingStochasticSoilModelTransformer.cs (.../PipingStochasticSoilModelTransformer.cs) (revision e40a14c4d5b76ae6e2d9c13407e231b8929f800a) @@ -22,7 +22,6 @@ using System; using System.Collections.Generic; using System.Linq; -using log4net; using Ringtoets.Common.IO.Exceptions; using Ringtoets.Common.IO.SoilProfile; using Ringtoets.Common.IO.SoilProfile.Schema; @@ -37,7 +36,6 @@ /// public class PipingStochasticSoilModelTransformer : IStochasticSoilModelTransformer { - private static readonly ILog log = LogManager.GetLogger(typeof(PipingStochasticSoilModel)); private readonly Dictionary soilProfiles = new Dictionary(); public PipingStochasticSoilModel Transform(StochasticSoilModel stochasticSoilModel) @@ -78,10 +76,12 @@ private IEnumerable TransformStochasticSoilProfiles(IEnumerable stochasticSoilProfiles, string soilModelName) { - PipingStochasticSoilProfile[] transformedProfiles = stochasticSoilProfiles.Select(ssp => PipingStochasticSoilProfileTransformer.Transform( - ssp, - GetTransformedPipingSoilProfile(ssp.SoilProfile))).ToArray(); - return GetUniqueStochasticSoilProfiles(transformedProfiles, soilModelName); + IEnumerable uniqueStochasticSoilProfiles = StochasticSoilProfileHelper.GetUniqueStochasticSoilProfiles(stochasticSoilProfiles, + soilModelName); + return uniqueStochasticSoilProfiles.Select(ssp => + PipingStochasticSoilProfileTransformer.Transform( + ssp, GetTransformedPipingSoilProfile(ssp.SoilProfile))) + .ToArray(); } /// @@ -105,48 +105,5 @@ } return pipingSoilProfile; } - - /// - /// Filters a collection of to determine which items - /// are unique. - /// - /// The collection of - /// to filter. - /// The name of the soil model. - /// A collection of unique . - /// Thrown when summing the probabilities of - /// with the same - /// results in an invalid probability. - private static IEnumerable GetUniqueStochasticSoilProfiles( - IEnumerable stochasticSoilProfiles, - string soilModelName) - { - List uniqueStochasticSoilProfiles = stochasticSoilProfiles.ToList(); - PipingStochasticSoilProfile[] allStochasticSoilProfiles = uniqueStochasticSoilProfiles.ToArray(); - - try - { - for (var i = 1; i < allStochasticSoilProfiles.Length; i++) - { - PipingStochasticSoilProfile previousProfile = allStochasticSoilProfiles[i - 1]; - PipingStochasticSoilProfile currentProfile = allStochasticSoilProfiles[i]; - if (ReferenceEquals(currentProfile.SoilProfile, previousProfile.SoilProfile)) - { - log.Warn(string.Format(RingtoetsCommonIOResources.SoilModelTransformer_GetUniqueStochasticSoilProfiles_StochasticSoilProfile_0_has_multiple_occurences_in_SoilModel_1_Probability_Summed, - previousProfile.SoilProfile.Name, - soilModelName)); - - previousProfile.AddProbability(currentProfile.Probability); - uniqueStochasticSoilProfiles.Remove(currentProfile); - } - } - } - catch (ArgumentOutOfRangeException e) - { - throw new ImportedDataTransformException(e.Message, e); - } - - return uniqueStochasticSoilProfiles; - } } } \ No newline at end of file