GaseousAbsorptionAlgo { float[] getTransmissionGas(String bandName, float[] sza, float[] oza) { float[] calMassAirs = getMassAir(sza, oza); String[] gasesToCompute = gasToComputeForBand(bandName); final ArrayList<float[]> arrayListExponential = new ArrayList<>(); for (String gas : gasesToCompute) { final float calAtmosphericGas = getAtmosphericGas(gas); final float normalizedConcentration = getNormalizedConcentration(gas); final float[] calExponential = new float[oza.length]; for (int i = 0; i < sza.length; i++) { calExponential[i] = getExponential(calAtmosphericGas, normalizedConcentration, calMassAirs[i]); } arrayListExponential.add(calExponential); } final int size = arrayListExponential.size(); float[] transmissionGas = new float[0]; if (size == 1) { transmissionGas = arrayListExponential.get(0); } else if (size == 2) { transmissionGas = SmileCorrectionUtils.multiple2ArrayFloat(arrayListExponential.get(0), arrayListExponential.get(1)); } else if (size == 3) { transmissionGas = SmileCorrectionUtils.multiple3ArrayFloat(arrayListExponential.get(0), arrayListExponential.get(1), arrayListExponential.get(2)); } return transmissionGas; }    }
@Test public void testGetTransmissionGasKnownBand() { GaseousAbsorptionAlgo algorithm = new GaseousAbsorptionAlgo(); float[] oza = {4, 5, 6}; float[] sza = {1, 2, 3}; float[] oa01_radians = algorithm.getTransmissionGas("gaseous_absorp_01", sza, oza); assertEquals(3, oa01_radians.length); assertEquals(0.13498464f, oa01_radians[0], 1.0e-6); assertEquals(0.13473716f, oa01_radians[1], 1.0e-6); assertEquals(0.1344073f, oa01_radians[2], 1.0e-6); }
@Test(expected = IllegalArgumentException.class) public void testGetTransmissionGasUnKnownBand() { GaseousAbsorptionAlgo algorithm = new GaseousAbsorptionAlgo(); algorithm.getTransmissionGas("dummy", new float[]{1, 2, 3}, new float[]{4, 5, 6}); }