# HG changeset patch # User Raimund Renkert # Date 1364211626 -3600 # Node ID aaf810d4ec8251419dfc5aba94cf9960c53788af # Parent 5a55c5372fe16c4cef8e0516ccb2e0f0e98fb1a7 Use new state 'outlier mehtod selection' in SQ-relation. The outlier method is no more configurable in conf.xml. The user can now select the method in SQ-relation parameters. diff -r 5a55c5372fe1 -r aaf810d4ec82 flys-artifacts/doc/conf/artifacts/minfo.xml --- a/flys-artifacts/doc/conf/artifacts/minfo.xml Mon Mar 25 12:35:08 2013 +0100 +++ b/flys-artifacts/doc/conf/artifacts/minfo.xml Mon Mar 25 12:40:26 2013 +0100 @@ -127,7 +127,7 @@ - + @@ -189,10 +189,6 @@ - - - - @@ -252,16 +248,29 @@ + + + + - - + + + + + + + + + + + diff -r 5a55c5372fe1 -r aaf810d4ec82 flys-artifacts/doc/conf/conf.xml --- a/flys-artifacts/doc/conf/conf.xml Mon Mar 25 12:35:08 2013 +0100 +++ b/flys-artifacts/doc/conf/conf.xml Mon Mar 25 12:40:26 2013 +0100 @@ -401,11 +401,6 @@ - - - - - /path/to/rivers/ diff -r 5a55c5372fe1 -r aaf810d4ec82 flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/SQRelationAccess.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/SQRelationAccess.java Mon Mar 25 12:35:08 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/SQRelationAccess.java Mon Mar 25 12:40:26 2013 +0100 @@ -18,6 +18,8 @@ protected Double outliers; + private String method; + public SQRelationAccess() { } @@ -60,5 +62,15 @@ } return outliers; } + + public String getOutlierMethod() { + if (method == null) { + method = getString("outlier-method"); + } + if (log.isDebugEnabled()) { + log.debug("outlier-method: " + method); + } + return method; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 5a55c5372fe1 -r aaf810d4ec82 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Fitting.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Fitting.java Mon Mar 25 12:35:08 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Fitting.java Mon Mar 25 12:40:26 2013 +0100 @@ -124,7 +124,7 @@ return good; } - public boolean fit(List sqs, Callback callback) { + public boolean fit(List sqs, String method, Callback callback) { sqs = onlyValid(sqs); @@ -136,7 +136,7 @@ this.callback = callback; try { - Outlier.detectOutliers(this, sqs, stdDevFactor); + Outlier.detectOutliers(this, sqs, stdDevFactor, method); } catch (MathException me) { log.warn(me); diff -r 5a55c5372fe1 -r aaf810d4ec82 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Outlier.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Outlier.java Mon Mar 25 12:35:08 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Outlier.java Mon Mar 25 12:40:26 2013 +0100 @@ -19,7 +19,7 @@ private static final String OUTLIER_METHOD = "/artifact-database/options/minfo-sq/outlier-method/@name"; - private static final String GRUBBS = "grubbs"; + private static final String GRUBBS = "outlier.method.grubbs"; //private static final String STD_DEV = "std-dev"; @@ -39,14 +39,13 @@ public static void detectOutliers( Callback callback, List sqs, - double stdDevFactor + double stdDevFactor, + String method ) throws MathException { boolean debug = log.isDebugEnabled(); - String method = Config.getStringXPath(OUTLIER_METHOD); - if (method == null) { method = "std-dev"; } diff -r 5a55c5372fe1 -r aaf810d4ec82 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SQRelationCalculation.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SQRelationCalculation.java Mon Mar 25 12:35:08 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SQRelationCalculation.java Mon Mar 25 12:40:26 2013 +0100 @@ -28,6 +28,7 @@ protected double location; protected DateRange period; protected double outliers; + private String method; public SQRelationCalculation() { } @@ -38,6 +39,7 @@ Double location = access.getLocation(); DateRange period = access.getPeriod(); Double outliers = access.getOutliers(); + String method = access.getOutlierMethod(); //river = "Rhein"; @@ -61,11 +63,17 @@ addProblem("sq.missing.outliers"); } + if (method == null) { + //TODO: i18n + addProblem("sq.missing.method"); + } + if (!hasProblems()) { this.river = river; this.location = location; this.period = period; this.outliers = outliers; + this.method = method; } } @@ -140,6 +148,7 @@ boolean success = new Fitting(function, outliers).fit( sqs, + method, new Fitting.Callback() { @Override public void afterIteration(