RatioCalculator { static boolean[] getRatioVariables(VariableContext variableContext, String[] l3MeanFeatureNames) { List<String> l3Names = new ArrayList<>(); Collections.addAll(l3Names, l3MeanFeatureNames); boolean[] isRatioVariable = new boolean[variableContext.getVariableCount()]; for (int i = 0; i < isRatioVariable.length; i++) { String l2VariableName = variableContext.getVariableName(i); if (l3Names.contains(l2VariableName + "_mean")) { isRatioVariable[i] = true; } } return isRatioVariable; } RatioCalculator(VariableContext variableContext, String[] l3MeanFeatureNames, Map<Long, float[]> l3MeanValues); Observation calculateRatio(long l3BinIndex, Observation l2Observation);  }
@Test public void testIsRatioVariable() throws Exception { VariableContextImpl l2VariableContext = new VariableContextImpl(); l2VariableContext.defineVariable("xaxis"); l2VariableContext.defineVariable("radiance_1"); l2VariableContext.defineVariable("radiance_2"); String[] l3FeatureNames = new String[]{"radiance_1_mean", "radiance_1_sigma", "radiance_2_mean"}; boolean[] ratioVariables = RatioCalculator.getRatioVariables(l2VariableContext, l3FeatureNames); assertEquals(3, ratioVariables.length); assertEquals(false, ratioVariables[0]); assertEquals(true, ratioVariables[1]); assertEquals(true, ratioVariables[2]); }