@Test public void testIt() throws Exception { C2rccModisAlgorithm algo = new C2rccModisAlgorithm(); C2rccModisAlgorithm.Result result1 = algo.processPixel( new double[]{ 0.17401233, 0.14464998, 0.109189205, 0.07873539, 0.07067424, 0.041668475, 0.040452786, 0.032773286, 0.024377074 }, 64.19979, 158.32169, 24.818445, 102.8721, 1019.4312, 277.9019); assertNotNull(result1); assertEquals(9, result1.rw.length); assertEquals(5, result1.iops.length); }
public Result processPixel(double[] toa_ref, double sun_zeni, double sun_azi, double sensor_zeni, double view_azi, double atm_press, double ozone) { final double cos_sun_zen = cos(toRadians(sun_zeni)); final double cos_sensor_zen = cos(toRadians(sensor_zeni)); final double sin_sun = sin(toRadians(sun_zeni)); final double sin_sensor_zen = sin(toRadians(sensor_zeni)); final double azi_diff_rad = toRadians(view_azi - sun_azi); final double cos_azi_diff = cos(azi_diff_rad); final double sin_azi_diff = sin(azi_diff_rad); final double azi_diff_deg = toDegrees(azi_diff_rad); double x = sin_sensor_zen * cos_azi_diff; double y = sin_sensor_zen * sin_azi_diff; double z = cos_sensor_zen; double[] r_tosa = new double[toa_ref.length]; for (int i = 0; i < toa_ref.length; i++) { double trans_ozoned12 = exp(-(k_oz_per_wl[i] * ozone / 1000.0) / cos_sun_zen); double trans_ozoneu12 = exp(-(k_oz_per_wl[i] * ozone / 1000.0) / cos_sensor_zen); double trans_ozone12 = trans_ozoned12 * trans_ozoneu12; r_tosa[i] = toa_ref[i] / trans_ozone12; } double[] log_rtosa = a_log(r_tosa); double[] nn_in = new double[7 + log_rtosa.length]; nn_in[0] = sun_zeni; nn_in[1] = x; nn_in[2] = y; nn_in[3] = z; nn_in[4] = temperature; nn_in[5] = salinity; nn_in[6] = atm_press; System.arraycopy(log_rtosa, 0, nn_in, 7, log_rtosa.length); double[] log_rw = rtoa_rw_nn3.get().calc(nn_in); double[] rw = a_exp(log_rw); double[] log_rtosa_aann = rtoa_aaNN7.get().calc(nn_in); double[] rtosa_aann = a_exp(log_rtosa_aann); double[] rtosa_aaNNrat = a_div(rtosa_aann, r_tosa); int flags = 0; double rtosa_aaNNrat_min = a_min(rtosa_aaNNrat); double rtosa_aaNNrat_max = a_max(rtosa_aaNNrat); boolean flag_rtosa = false; if (rtosa_aaNNrat_min < thresh_rtosaaaNNrat[0] || rtosa_aaNNrat_max > thresh_rtosaaaNNrat[1]) { flag_rtosa = true; } flags = BitSetter.setFlag(flags, FLAG_INDEX_RTOSA_OOS, flag_rtosa); double[] mi = rtoa_aaNN7.get().getInmin(); double[] ma = rtoa_aaNN7.get().getInmax(); boolean tosa_oor_flag = false; for (int iv = 0; iv < nn_in.length; iv++) { if (nn_in[iv] < mi[iv] || nn_in[iv] > ma[iv]) { tosa_oor_flag = true; } } flags = BitSetter.setFlag(flags, FLAG_INDEX_RTOSA_OOR, tosa_oor_flag); double[] nn_in_inv = new double[5 + 10]; nn_in_inv[0] = sun_zeni; nn_in_inv[1] = sensor_zeni; nn_in_inv[2] = azi_diff_deg; nn_in_inv[3] = temperature; nn_in_inv[4] = salinity; System.arraycopy(log_rw, 0, nn_in_inv, 5, log_rw.length - 1); double[] log_iops_nn1 = rw_IOP.get().calc(nn_in_inv); double[] iops_nn1 = a_exp(log_iops_nn1); mi = rw_IOP.get().getInmin(); ma = rw_IOP.get().getInmax(); boolean rw_oor_flag = false; for (int iv = 0; iv < mi.length; iv++) { if (nn_in_inv[iv] < mi[iv] | nn_in_inv[iv] > ma[iv]) { rw_oor_flag = true; } } flags = BitSetter.setFlag(flags, FLAG_INDEX_RHOW_OOR, rw_oor_flag); return new Result(rw, iops_nn1, r_tosa, rtosa_aann, rtosa_aaNNrat_min, rtosa_aaNNrat_max, flags); }
C2rccModisAlgorithm { public Result processPixel(double[] toa_ref, double sun_zeni, double sun_azi, double sensor_zeni, double view_azi, double atm_press, double ozone) { final double cos_sun_zen = cos(toRadians(sun_zeni)); final double cos_sensor_zen = cos(toRadians(sensor_zeni)); final double sin_sun = sin(toRadians(sun_zeni)); final double sin_sensor_zen = sin(toRadians(sensor_zeni)); final double azi_diff_rad = toRadians(view_azi - sun_azi); final double cos_azi_diff = cos(azi_diff_rad); final double sin_azi_diff = sin(azi_diff_rad); final double azi_diff_deg = toDegrees(azi_diff_rad); double x = sin_sensor_zen * cos_azi_diff; double y = sin_sensor_zen * sin_azi_diff; double z = cos_sensor_zen; double[] r_tosa = new double[toa_ref.length]; for (int i = 0; i < toa_ref.length; i++) { double trans_ozoned12 = exp(-(k_oz_per_wl[i] * ozone / 1000.0) / cos_sun_zen); double trans_ozoneu12 = exp(-(k_oz_per_wl[i] * ozone / 1000.0) / cos_sensor_zen); double trans_ozone12 = trans_ozoned12 * trans_ozoneu12; r_tosa[i] = toa_ref[i] / trans_ozone12; } double[] log_rtosa = a_log(r_tosa); double[] nn_in = new double[7 + log_rtosa.length]; nn_in[0] = sun_zeni; nn_in[1] = x; nn_in[2] = y; nn_in[3] = z; nn_in[4] = temperature; nn_in[5] = salinity; nn_in[6] = atm_press; System.arraycopy(log_rtosa, 0, nn_in, 7, log_rtosa.length); double[] log_rw = rtoa_rw_nn3.get().calc(nn_in); double[] rw = a_exp(log_rw); double[] log_rtosa_aann = rtoa_aaNN7.get().calc(nn_in); double[] rtosa_aann = a_exp(log_rtosa_aann); double[] rtosa_aaNNrat = a_div(rtosa_aann, r_tosa); int flags = 0; double rtosa_aaNNrat_min = a_min(rtosa_aaNNrat); double rtosa_aaNNrat_max = a_max(rtosa_aaNNrat); boolean flag_rtosa = false; if (rtosa_aaNNrat_min < thresh_rtosaaaNNrat[0] || rtosa_aaNNrat_max > thresh_rtosaaaNNrat[1]) { flag_rtosa = true; } flags = BitSetter.setFlag(flags, FLAG_INDEX_RTOSA_OOS, flag_rtosa); double[] mi = rtoa_aaNN7.get().getInmin(); double[] ma = rtoa_aaNN7.get().getInmax(); boolean tosa_oor_flag = false; for (int iv = 0; iv < nn_in.length; iv++) { if (nn_in[iv] < mi[iv] || nn_in[iv] > ma[iv]) { tosa_oor_flag = true; } } flags = BitSetter.setFlag(flags, FLAG_INDEX_RTOSA_OOR, tosa_oor_flag); double[] nn_in_inv = new double[5 + 10]; nn_in_inv[0] = sun_zeni; nn_in_inv[1] = sensor_zeni; nn_in_inv[2] = azi_diff_deg; nn_in_inv[3] = temperature; nn_in_inv[4] = salinity; System.arraycopy(log_rw, 0, nn_in_inv, 5, log_rw.length - 1); double[] log_iops_nn1 = rw_IOP.get().calc(nn_in_inv); double[] iops_nn1 = a_exp(log_iops_nn1); mi = rw_IOP.get().getInmin(); ma = rw_IOP.get().getInmax(); boolean rw_oor_flag = false; for (int iv = 0; iv < mi.length; iv++) { if (nn_in_inv[iv] < mi[iv] | nn_in_inv[iv] > ma[iv]) { rw_oor_flag = true; } } flags = BitSetter.setFlag(flags, FLAG_INDEX_RHOW_OOR, rw_oor_flag); return new Result(rw, iops_nn1, r_tosa, rtosa_aann, rtosa_aaNNrat_min, rtosa_aaNNrat_max, flags); } }
C2rccModisAlgorithm { public Result processPixel(double[] toa_ref, double sun_zeni, double sun_azi, double sensor_zeni, double view_azi, double atm_press, double ozone) { final double cos_sun_zen = cos(toRadians(sun_zeni)); final double cos_sensor_zen = cos(toRadians(sensor_zeni)); final double sin_sun = sin(toRadians(sun_zeni)); final double sin_sensor_zen = sin(toRadians(sensor_zeni)); final double azi_diff_rad = toRadians(view_azi - sun_azi); final double cos_azi_diff = cos(azi_diff_rad); final double sin_azi_diff = sin(azi_diff_rad); final double azi_diff_deg = toDegrees(azi_diff_rad); double x = sin_sensor_zen * cos_azi_diff; double y = sin_sensor_zen * sin_azi_diff; double z = cos_sensor_zen; double[] r_tosa = new double[toa_ref.length]; for (int i = 0; i < toa_ref.length; i++) { double trans_ozoned12 = exp(-(k_oz_per_wl[i] * ozone / 1000.0) / cos_sun_zen); double trans_ozoneu12 = exp(-(k_oz_per_wl[i] * ozone / 1000.0) / cos_sensor_zen); double trans_ozone12 = trans_ozoned12 * trans_ozoneu12; r_tosa[i] = toa_ref[i] / trans_ozone12; } double[] log_rtosa = a_log(r_tosa); double[] nn_in = new double[7 + log_rtosa.length]; nn_in[0] = sun_zeni; nn_in[1] = x; nn_in[2] = y; nn_in[3] = z; nn_in[4] = temperature; nn_in[5] = salinity; nn_in[6] = atm_press; System.arraycopy(log_rtosa, 0, nn_in, 7, log_rtosa.length); double[] log_rw = rtoa_rw_nn3.get().calc(nn_in); double[] rw = a_exp(log_rw); double[] log_rtosa_aann = rtoa_aaNN7.get().calc(nn_in); double[] rtosa_aann = a_exp(log_rtosa_aann); double[] rtosa_aaNNrat = a_div(rtosa_aann, r_tosa); int flags = 0; double rtosa_aaNNrat_min = a_min(rtosa_aaNNrat); double rtosa_aaNNrat_max = a_max(rtosa_aaNNrat); boolean flag_rtosa = false; if (rtosa_aaNNrat_min < thresh_rtosaaaNNrat[0] || rtosa_aaNNrat_max > thresh_rtosaaaNNrat[1]) { flag_rtosa = true; } flags = BitSetter.setFlag(flags, FLAG_INDEX_RTOSA_OOS, flag_rtosa); double[] mi = rtoa_aaNN7.get().getInmin(); double[] ma = rtoa_aaNN7.get().getInmax(); boolean tosa_oor_flag = false; for (int iv = 0; iv < nn_in.length; iv++) { if (nn_in[iv] < mi[iv] || nn_in[iv] > ma[iv]) { tosa_oor_flag = true; } } flags = BitSetter.setFlag(flags, FLAG_INDEX_RTOSA_OOR, tosa_oor_flag); double[] nn_in_inv = new double[5 + 10]; nn_in_inv[0] = sun_zeni; nn_in_inv[1] = sensor_zeni; nn_in_inv[2] = azi_diff_deg; nn_in_inv[3] = temperature; nn_in_inv[4] = salinity; System.arraycopy(log_rw, 0, nn_in_inv, 5, log_rw.length - 1); double[] log_iops_nn1 = rw_IOP.get().calc(nn_in_inv); double[] iops_nn1 = a_exp(log_iops_nn1); mi = rw_IOP.get().getInmin(); ma = rw_IOP.get().getInmax(); boolean rw_oor_flag = false; for (int iv = 0; iv < mi.length; iv++) { if (nn_in_inv[iv] < mi[iv] | nn_in_inv[iv] > ma[iv]) { rw_oor_flag = true; } } flags = BitSetter.setFlag(flags, FLAG_INDEX_RHOW_OOR, rw_oor_flag); return new Result(rw, iops_nn1, r_tosa, rtosa_aann, rtosa_aaNNrat_min, rtosa_aaNNrat_max, flags); } C2rccModisAlgorithm(); }
C2rccModisAlgorithm { public Result processPixel(double[] toa_ref, double sun_zeni, double sun_azi, double sensor_zeni, double view_azi, double atm_press, double ozone) { final double cos_sun_zen = cos(toRadians(sun_zeni)); final double cos_sensor_zen = cos(toRadians(sensor_zeni)); final double sin_sun = sin(toRadians(sun_zeni)); final double sin_sensor_zen = sin(toRadians(sensor_zeni)); final double azi_diff_rad = toRadians(view_azi - sun_azi); final double cos_azi_diff = cos(azi_diff_rad); final double sin_azi_diff = sin(azi_diff_rad); final double azi_diff_deg = toDegrees(azi_diff_rad); double x = sin_sensor_zen * cos_azi_diff; double y = sin_sensor_zen * sin_azi_diff; double z = cos_sensor_zen; double[] r_tosa = new double[toa_ref.length]; for (int i = 0; i < toa_ref.length; i++) { double trans_ozoned12 = exp(-(k_oz_per_wl[i] * ozone / 1000.0) / cos_sun_zen); double trans_ozoneu12 = exp(-(k_oz_per_wl[i] * ozone / 1000.0) / cos_sensor_zen); double trans_ozone12 = trans_ozoned12 * trans_ozoneu12; r_tosa[i] = toa_ref[i] / trans_ozone12; } double[] log_rtosa = a_log(r_tosa); double[] nn_in = new double[7 + log_rtosa.length]; nn_in[0] = sun_zeni; nn_in[1] = x; nn_in[2] = y; nn_in[3] = z; nn_in[4] = temperature; nn_in[5] = salinity; nn_in[6] = atm_press; System.arraycopy(log_rtosa, 0, nn_in, 7, log_rtosa.length); double[] log_rw = rtoa_rw_nn3.get().calc(nn_in); double[] rw = a_exp(log_rw); double[] log_rtosa_aann = rtoa_aaNN7.get().calc(nn_in); double[] rtosa_aann = a_exp(log_rtosa_aann); double[] rtosa_aaNNrat = a_div(rtosa_aann, r_tosa); int flags = 0; double rtosa_aaNNrat_min = a_min(rtosa_aaNNrat); double rtosa_aaNNrat_max = a_max(rtosa_aaNNrat); boolean flag_rtosa = false; if (rtosa_aaNNrat_min < thresh_rtosaaaNNrat[0] || rtosa_aaNNrat_max > thresh_rtosaaaNNrat[1]) { flag_rtosa = true; } flags = BitSetter.setFlag(flags, FLAG_INDEX_RTOSA_OOS, flag_rtosa); double[] mi = rtoa_aaNN7.get().getInmin(); double[] ma = rtoa_aaNN7.get().getInmax(); boolean tosa_oor_flag = false; for (int iv = 0; iv < nn_in.length; iv++) { if (nn_in[iv] < mi[iv] || nn_in[iv] > ma[iv]) { tosa_oor_flag = true; } } flags = BitSetter.setFlag(flags, FLAG_INDEX_RTOSA_OOR, tosa_oor_flag); double[] nn_in_inv = new double[5 + 10]; nn_in_inv[0] = sun_zeni; nn_in_inv[1] = sensor_zeni; nn_in_inv[2] = azi_diff_deg; nn_in_inv[3] = temperature; nn_in_inv[4] = salinity; System.arraycopy(log_rw, 0, nn_in_inv, 5, log_rw.length - 1); double[] log_iops_nn1 = rw_IOP.get().calc(nn_in_inv); double[] iops_nn1 = a_exp(log_iops_nn1); mi = rw_IOP.get().getInmin(); ma = rw_IOP.get().getInmax(); boolean rw_oor_flag = false; for (int iv = 0; iv < mi.length; iv++) { if (nn_in_inv[iv] < mi[iv] | nn_in_inv[iv] > ma[iv]) { rw_oor_flag = true; } } flags = BitSetter.setFlag(flags, FLAG_INDEX_RHOW_OOR, rw_oor_flag); return new Result(rw, iops_nn1, r_tosa, rtosa_aann, rtosa_aaNNrat_min, rtosa_aaNNrat_max, flags); } C2rccModisAlgorithm(); void setTemperature(double temperature); void setSalinity(double salinity); Result processPixel(double[] toa_ref,
                               double sun_zeni,
                               double sun_azi,
                               double sensor_zeni,
                               double view_azi,
                               double atm_press,
                               double ozone); }
C2rccModisAlgorithm { public Result processPixel(double[] toa_ref, double sun_zeni, double sun_azi, double sensor_zeni, double view_azi, double atm_press, double ozone) { final double cos_sun_zen = cos(toRadians(sun_zeni)); final double cos_sensor_zen = cos(toRadians(sensor_zeni)); final double sin_sun = sin(toRadians(sun_zeni)); final double sin_sensor_zen = sin(toRadians(sensor_zeni)); final double azi_diff_rad = toRadians(view_azi - sun_azi); final double cos_azi_diff = cos(azi_diff_rad); final double sin_azi_diff = sin(azi_diff_rad); final double azi_diff_deg = toDegrees(azi_diff_rad); double x = sin_sensor_zen * cos_azi_diff; double y = sin_sensor_zen * sin_azi_diff; double z = cos_sensor_zen; double[] r_tosa = new double[toa_ref.length]; for (int i = 0; i < toa_ref.length; i++) { double trans_ozoned12 = exp(-(k_oz_per_wl[i] * ozone / 1000.0) / cos_sun_zen); double trans_ozoneu12 = exp(-(k_oz_per_wl[i] * ozone / 1000.0) / cos_sensor_zen); double trans_ozone12 = trans_ozoned12 * trans_ozoneu12; r_tosa[i] = toa_ref[i] / trans_ozone12; } double[] log_rtosa = a_log(r_tosa); double[] nn_in = new double[7 + log_rtosa.length]; nn_in[0] = sun_zeni; nn_in[1] = x; nn_in[2] = y; nn_in[3] = z; nn_in[4] = temperature; nn_in[5] = salinity; nn_in[6] = atm_press; System.arraycopy(log_rtosa, 0, nn_in, 7, log_rtosa.length); double[] log_rw = rtoa_rw_nn3.get().calc(nn_in); double[] rw = a_exp(log_rw); double[] log_rtosa_aann = rtoa_aaNN7.get().calc(nn_in); double[] rtosa_aann = a_exp(log_rtosa_aann); double[] rtosa_aaNNrat = a_div(rtosa_aann, r_tosa); int flags = 0; double rtosa_aaNNrat_min = a_min(rtosa_aaNNrat); double rtosa_aaNNrat_max = a_max(rtosa_aaNNrat); boolean flag_rtosa = false; if (rtosa_aaNNrat_min < thresh_rtosaaaNNrat[0] || rtosa_aaNNrat_max > thresh_rtosaaaNNrat[1]) { flag_rtosa = true; } flags = BitSetter.setFlag(flags, FLAG_INDEX_RTOSA_OOS, flag_rtosa); double[] mi = rtoa_aaNN7.get().getInmin(); double[] ma = rtoa_aaNN7.get().getInmax(); boolean tosa_oor_flag = false; for (int iv = 0; iv < nn_in.length; iv++) { if (nn_in[iv] < mi[iv] || nn_in[iv] > ma[iv]) { tosa_oor_flag = true; } } flags = BitSetter.setFlag(flags, FLAG_INDEX_RTOSA_OOR, tosa_oor_flag); double[] nn_in_inv = new double[5 + 10]; nn_in_inv[0] = sun_zeni; nn_in_inv[1] = sensor_zeni; nn_in_inv[2] = azi_diff_deg; nn_in_inv[3] = temperature; nn_in_inv[4] = salinity; System.arraycopy(log_rw, 0, nn_in_inv, 5, log_rw.length - 1); double[] log_iops_nn1 = rw_IOP.get().calc(nn_in_inv); double[] iops_nn1 = a_exp(log_iops_nn1); mi = rw_IOP.get().getInmin(); ma = rw_IOP.get().getInmax(); boolean rw_oor_flag = false; for (int iv = 0; iv < mi.length; iv++) { if (nn_in_inv[iv] < mi[iv] | nn_in_inv[iv] > ma[iv]) { rw_oor_flag = true; } } flags = BitSetter.setFlag(flags, FLAG_INDEX_RHOW_OOR, rw_oor_flag); return new Result(rw, iops_nn1, r_tosa, rtosa_aann, rtosa_aaNNrat_min, rtosa_aaNNrat_max, flags); } C2rccModisAlgorithm(); void setTemperature(double temperature); void setSalinity(double salinity); Result processPixel(double[] toa_ref,
                               double sun_zeni,
                               double sun_azi,
                               double sensor_zeni,
                               double view_azi,
                               double atm_press,
                               double ozone); static final int FLAG_INDEX_RTOSA_OOS; static final int FLAG_INDEX_RTOSA_OOR; static final int FLAG_INDEX_RHOW_OOR; static final int FLAG_INDEX_VALID_PE; final static int[] NN_INPUT_REFLEC_WAVELENGTHS; final static int[] ALL_REFLEC_WAVELENGTHS; final static double[] k_oz_per_wl; }