GaseousAbsorptionAux { double convolve(double lower, double upper, List<double[]> coeffhighres) { double[] o3absorption = coeffhighres.get(1); double[] O3wavelength = coeffhighres.get(0); int length = o3absorption.length; int weight = 0; double totalValue = 0.0; for (int i = 0; i < length; i++) { if (O3wavelength[i] >= lower && O3wavelength[i] <= upper) { weight += 1; totalValue += o3absorption[i]; } } return weight > 0 ? (totalValue / weight) : 0.0; } GaseousAbsorptionAux(); static GaseousAbsorptionAux getInstance(); List<double[]> getOzoneHighs(); List<double[]> getCoeffhighres(List<double[]> ozoneHighs); double[] absorptionOzone(String instrument);  }
@Test public void testGetConvolve() throws Exception { ArrayList<double[]> coeffhighres = new ArrayList<>(); coeffhighres.add(new double[]{1, 2, 3, 4, 5, 6, 7, 8}); coeffhighres.add(new double[]{1, 2, 3, 4, 5, 6, 7, 8}); assertEquals(3.5, absorptionAuxII.convolve(3, 4, coeffhighres)); assertEquals(4.0, absorptionAuxII.convolve(3, 5, coeffhighres)); assertEquals(3.0, absorptionAuxII.convolve(1, 5, coeffhighres)); }