GaseousAbsorptionAux { public double[] absorptionOzone(String instrument) { List<Number> o3absorpInstrument = new ArrayList<>(); double[] lamC; if (instrument.equals("MERIS")) { lamC = new double[]{412.5, 442.0, 490.0, 510.0, 560.0, 620.0, 665.0, 681.25, 708.75, 753.0, 761.25, 779.0, 865.0, 885.0, 900}; double[] lamW = new double[]{10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 3.075, 10.0, 20.0, 20.0, 40.0}; for (int i = 0; i < lamC.length; i++) { double lower = lamC[i] - lamW[i] / 2; double upper = lamC[i] + lamW[i] / 2; o3absorpInstrument.add(convolve(lower, upper, this.coeffhighres)); } } if (instrument.equals("OLCI")) { lamC = new double[]{ 400.0, 412.5, 442.0, 490.0, 510.0, 560.0, 620.0, 665.0, 673.75, 681.25, 708.75, 753.75, 761.25, 764.375, 767.5, 778.75, 865.0, 885.0, 900.0, 940.0, 1020.0}; double[] lamW = new double[]{15.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 7.05, 7.05, 10.0, 7.05, 2.05, 3.075, 2.05, 15.0, 20.0, 10.0, 10.0, 20.0, 40.0}; for (int i = 0; i < lamC.length; i++) { double lower = lamC[i] - lamW[i] / 2; double upper = lamC[i] + lamW[i] / 2; o3absorpInstrument.add(convolve(lower, upper, this.coeffhighres)); } } if (instrument.equals("S2_MSI")) { lamC = new double[]{ 442.0, 490.0, 560.0, 665.0, 705.0, 740.0, 783.0, 842.0, 865.0, 945.0, 1375.0, 1610.0, 2190.0}; double[] lamW = new double[]{20.0, 65.0, 35.0, 30.0, 15.0, 15.0, 20.0, 115.0, 20.0, 20.0, 30.0, 90.0, 180.0}; for (int i = 0; i < lamC.length; i++) { double lower = lamC[i] - lamW[i] / 2; double upper = lamC[i] + lamW[i] / 2; o3absorpInstrument.add(convolve(lower, upper, this.coeffhighres)); } } return Doubles.toArray(o3absorpInstrument); } GaseousAbsorptionAux(); static GaseousAbsorptionAux getInstance(); List<double[]> getOzoneHighs(); List<double[]> getCoeffhighres(List<double[]> ozoneHighs); double[] absorptionOzone(String instrument);  }
@Test public void testGetAbsorptionOLCI() throws Exception { double[] olciAbsorption = absorptionAuxII.absorptionOzone("OLCI"); double[] expectedArrays = new double[]{ 6.666666666666667E-6, 3.1E-4, 0.003181818181818182, 0.021318181818181816, 0.04210909090909091, 0.10538181818181819, 0.10820909090909091, 0.050372727272727284, 0.041042857142857145, 0.035614285714285716, 0.019549999999999998, 0.009142857142857144, 0.0071, 0.006966666666666667, 0.0067, 0.007673333333333333, 0.002142857142857143, 0.001227272727272727, 0.0015, 7.095238095238095E-4, 0.0 }; assertEquals(21, olciAbsorption.length); Assert.assertArrayEquals(expectedArrays, olciAbsorption, 1e-8); }