Commit 3cc9dc26 authored by SAPONE Alann's avatar SAPONE Alann

Bug correction : sky brightness

parent d1d219b8
......@@ -2,8 +2,10 @@ package org.cnrs.lam.dis.etc.calculator.wavelengthrange;
import java.util.ArrayList;
import org.cnrs.lam.cesam.util.calculator.CalculationException;
import org.cnrs.lam.dis.etc.calculator.DatasetProviderHolder;
import org.cnrs.lam.dis.etc.calculator.ResultsHolder;
import org.cnrs.lam.dis.etc.calculator.ValidationError;
import org.cnrs.lam.dis.etc.datamodel.CalculationResults;
import org.cnrs.lam.dis.etc.datamodel.DatasetInfo;
import org.cnrs.lam.dis.etc.datamodel.Session;
......@@ -23,20 +25,19 @@ public class CommonRangeFactory {
return CommonRangeFactory.session;
}
/*
// To avoid multiple error on calculation range
private static boolean canDisplayRangeError = true;
public static void setCanDisplayRangeError(boolean canDisplayRangeError) {
CommonRangeFactory.canDisplayRangeError = canDisplayRangeError;
}
public static boolean getCanDisplayRangeError() {
return canDisplayRangeError;
}
*/
public static Pair<Double, Double> getCalculableRange(Session session, Pair<Double, Double> calculableRange) {
/*
* // To avoid multiple error on calculation range private static boolean
* canDisplayRangeError = true;
*
* public static void setCanDisplayRangeError(boolean canDisplayRangeError)
* { CommonRangeFactory.canDisplayRangeError = canDisplayRangeError; }
*
* public static boolean getCanDisplayRangeError() { return
* canDisplayRangeError; }
*/
public static Pair<Double, Double> getCalculableRange(Session session, Pair<Double, Double> calculableRange)
throws CalculationException {
ArrayList<Triplet<Double, Double, String>> ranges = new ArrayList<Triplet<Double, Double, String>>();
/* Instrumental limitations */
......@@ -55,12 +56,15 @@ public class CommonRangeFactory {
/* Sites limitations */
/*
// Sky brightness
Triplet<Double, Double, String> skyBrightnessRange = getRange(Type.SKY_EMISSION,
session.getSite().getSkyEmission(), session.getSite().getSkyEmissionSelectedOption(),
"Site > Sky brightness");
session.getSite().getSkyEmission(), null,
"Site > Sky emission");
if (skyBrightnessRange != null)
ranges.add(skyBrightnessRange);
System.out.println(skyBrightnessRange);
*/
// Sky absorption
Triplet<Double, Double, String> skyAbsorptionRange = getRange(Type.SKY_ABSORPTION,
......@@ -73,6 +77,8 @@ public class CommonRangeFactory {
session.getSite().getSkyExtinction(), null, "Site > Sky extinction");
if (skyExtinctionRange != null)
ranges.add(skyExtinctionRange);
/*
*/
/* Sources limitations */
......@@ -97,19 +103,18 @@ public class CommonRangeFactory {
}
calculableRange = new Pair<Double, Double>(newMin, newMax);
}
if (rangeErrors.size() > 0) {
ResultsHolder.getResults().addResult(
new CalculationResults.StringResult("TRUNCATED_CALCULATION_RANGE", "[" + calculableRange.getValue0() + ", " + calculableRange.getValue1() + "]"),
CalculationResults.Level.FINAL
);
new CalculationResults.StringResult("TRUNCATED_CALCULATION_RANGE",
"[" + calculableRange.getValue0() + ", " + calculableRange.getValue1() + "]"),
CalculationResults.Level.FINAL);
for (String rangeError : rangeErrors) {
ResultsHolder.getResults().addResult(
new CalculationResults.StringResult("TRUNCATED_CALCULATION_RANGE_CAUSE", rangeError),
CalculationResults.Level.FINAL
);
new CalculationResults.StringResult("TRUNCATED_CALCULATION_RANGE_CAUSE", rangeError),
CalculationResults.Level.FINAL);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment