private void setBandProperties(Band band, String validMaskExpression) { band.setDescription(bandDescription); band.setUnit(bandUnit); band.setSpectralWavelength(bandWavelength); band.setGeophysicalNoDataValue(noDataValue); band.setNoDataValueUsed(noDataValueUsed); band.setValidPixelExpression(validMaskExpression); }
public static void setMasterValidPixelExpression(final Product targetProduct, final boolean maskOutAreaWithoutElevation) { if(maskOutAreaWithoutElevation) { Band slvBand = null; for(Band tgtBand : targetProduct.getBands()) { if(StackUtils.isSlaveBand(tgtBand, targetProduct)) { slvBand = tgtBand; break; } } if(slvBand != null) { for (Band tgtBand : targetProduct.getBands()) { if (StackUtils.isMasterBand(tgtBand, targetProduct)) { tgtBand.setValidPixelExpression(slvBand.getName()); } } } } }
private void createTargetProductBands() { aotBand = AerosolUtils.createTargetBand(AotConsts.aot, tarRasterWidth, tarRasterHeight); targetProduct.addBand(aotBand); aotErrorBand = AerosolUtils.createTargetBand(AotConsts.aotErr, tarRasterWidth, tarRasterHeight); aotErrorBand.setValidPixelExpression(InstrumentConsts.VALID_RETRIEVAL_EXPRESSION); targetProduct.addBand(aotErrorBand); latBand = new Band("latitude", ProductData.TYPE_FLOAT32, tarRasterWidth, tarRasterHeight); targetProduct.addBand(latBand); lonBand = new Band("longitude", ProductData.TYPE_FLOAT32, tarRasterWidth, tarRasterHeight); targetProduct.addBand(lonBand); }
@Test public void testAdaptResamplingComboBoxModel() { final Product product = new Product("name", "type", 10, 10); final Band band1 = product.addBand("band1", ProductData.TYPE_INT32); final Band band2 = product.addBand("band2", ProductData.TYPE_INT32); DefaultComboBoxModel<ResamplingType> resamplingComboBoxModel = new DefaultComboBoxModel<>(ResamplingType.values()); boolean validPixelExpressionUsed = CollocationForm.isValidPixelExpressionUsed(product); assertFalse(validPixelExpressionUsed); CollocationForm.adaptResamplingComboBoxModel(resamplingComboBoxModel, validPixelExpressionUsed); assertEquals(5, resamplingComboBoxModel.getSize()); band1.setValidPixelExpression("true"); validPixelExpressionUsed = CollocationForm.isValidPixelExpressionUsed(product); assertTrue(validPixelExpressionUsed); CollocationForm.adaptResamplingComboBoxModel(resamplingComboBoxModel, validPixelExpressionUsed); assertEquals(1, resamplingComboBoxModel.getSize()); assertEquals(ResamplingType.NEAREST_NEIGHBOUR, resamplingComboBoxModel.getSelectedItem()); band1.setValidPixelExpression(null); band2.setValidPixelExpression(" "); validPixelExpressionUsed = CollocationForm.isValidPixelExpressionUsed(product); assertFalse(validPixelExpressionUsed); CollocationForm.adaptResamplingComboBoxModel(resamplingComboBoxModel, validPixelExpressionUsed); assertEquals(5, resamplingComboBoxModel.getSize()); assertEquals(ResamplingType.NEAREST_NEIGHBOUR, resamplingComboBoxModel.getSelectedItem()); } }
band.setImageInfo(indexBandInfo.getImageInfo()); band.setDescription(bandInfo.getBandInformation().getDescription()); band.setValidPixelExpression(String.format("%s.raw > 0",bandInfo.getBandInformation().getPhysicalBand()));
band.setValidPixelExpression(String.format("%s.raw > %s", bandInfo.getBandName(), S2Config.RAW_NO_DATA_THRESHOLD));
band.setUnit(bandInfo.getBandInformation().getUnit()); band.setValidPixelExpression(String.format("%s.raw > 0",bandInfo.getBandInformation().getPhysicalBand()));
targetBand.setLog10Scaled(firstSourceBand.isLog10Scaled()); targetBand.setNoDataValue(firstSourceBand.getNoDataValue()); targetBand.setValidPixelExpression(firstSourceBand.getValidPixelExpression()); targetBand.setSpectralWavelength(firstSourceBand.getSpectralWavelength()); targetBand.setSpectralBandwidth(firstSourceBand.getSpectralBandwidth());
realBand.setValidPixelExpression(computedBand.getValidPixelExpression()); realBand.setUnit(computedBand.getUnit()); realBand.setSpectralWavelength(computedBand.getSpectralWavelength());