@Override public void configureSourceSamples( SampleConfigurer sampleConfigurer, Product sourceProduct, String spectralBandPrefix) { for (int i = 0; i < MODIS_L1B_NUM_SPECTRAL_BANDS; i++) { if (sourceProduct.containsBand(MODIS_L1B_SPECTRAL_BAND_NAMES[i])) { sampleConfigurer.defineSample(i, MODIS_L1B_SPECTRAL_BAND_NAMES[i], sourceProduct); } else { sampleConfigurer.defineSample( i, MODIS_L1B_SPECTRAL_BAND_NAMES[i].replace(".", "_"), sourceProduct); } } for (int i = 0; i < MODIS_L1B_NUM_EMISSIVE_BANDS; i++) { if (sourceProduct.containsBand(MODIS_L1B_EMISSIVE_BAND_NAMES[i])) { sampleConfigurer.defineSample( OccciConstants.MODIS_SRC_RAD_OFFSET + i, MODIS_L1B_EMISSIVE_BAND_NAMES[i], sourceProduct); } else { final String newEmissiveBandName = MODIS_L1B_EMISSIVE_BAND_NAMES[i].replace(".", "_"); final Band emissiveBand = sourceProduct.getBand(newEmissiveBandName); emissiveBand.setScalingFactor( 1.0); // todo: we do this to come back to counts with SeaDAS reader, // as the NN was also trained with counts emissiveBand.setScalingOffset(0.0); sampleConfigurer.defineSample( OccciConstants.MODIS_SRC_RAD_OFFSET + i, newEmissiveBandName, sourceProduct); } } }
/** * Adds a land mask sample definition to a configurator used in a point operator * * @param configurator - the configurator * @param index - the sample index * @param sourceProduct - the source product */ public static void setSeaiceMaskSourceSample( SampleConfigurer configurator, int index, Product sourceProduct) { BandMathsOp seaiceOp = BandMathsOp.createBooleanExpressionBand( AlbedoInversionConstants.seaiceMaskExpression, sourceProduct); Product seaiceProduct = seaiceOp.getTargetProduct(); configurator.defineSample(index, seaiceProduct.getBandAt(0).getName(), seaiceProduct); }
/** * Adds a land mask sample definition to a configurator used in a point operator * * @param configurator - the configurator * @param index - the sample index * @param sourceProduct - the source product */ public static void setLandMaskSourceSample( SampleConfigurer configurator, int index, Product sourceProduct, boolean computeSeaice) { if ((sourceProduct.getProductType().startsWith("MER") || sourceProduct.getName().startsWith("MER")) || computeSeaice) { BandMathsOp landOp = BandMathsOp.createBooleanExpressionBand( AlbedoInversionConstants.merisLandMaskExpression, sourceProduct); Product landMaskProduct = landOp.getTargetProduct(); configurator.defineSample(index, landMaskProduct.getBandAt(0).getName(), landMaskProduct); } else if ((sourceProduct.getProductType().startsWith("VGT") || sourceProduct.getName().startsWith("VGT"))) { configurator.defineSample(index, AlbedoInversionConstants.BBDR_VGT_SM_NAME, sourceProduct); } else { BandMathsOp landOp = BandMathsOp.createBooleanExpressionBand( AlbedoInversionConstants.aatsrLandMaskExpression, sourceProduct); Product landMaskProduct = landOp.getTargetProduct(); configurator.defineSample(index, landMaskProduct.getBandAt(0).getName(), landMaskProduct); } }