@Override public void setInvalidPixelExpression(Band band) { band.setNoDataValueUsed(false); band.setNoDataValue(0); }
private static void setNoDataValue(final Element element, final Band band) { final String noDataValue = element.getChildTextTrim(DimapProductConstants.TAG_NO_DATA_VALUE); if (noDataValue != null) { band.setNoDataValue(Double.parseDouble(noDataValue)); } }
@Override public void setInvalidPixelExpression(Band band) { band.setNoDataValueUsed(false); band.setNoDataValue(0); }
private static void addElevationBand(Product product, ElevationModel dem, String elevationBandName) { final GeoCoding geoCoding = product.getGeoCoding(); ElevationModelDescriptor demDescriptor = dem.getDescriptor(); final float noDataValue = dem.getDescriptor().getNoDataValue(); final Band elevationBand = product.addBand(elevationBandName, ProductData.TYPE_INT16); elevationBand.setSynthetic(true); elevationBand.setNoDataValue(noDataValue); elevationBand.setUnit("m"); elevationBand.setDescription(demDescriptor.getName()); elevationBand.setSourceImage(createElevationSourceImage(dem, geoCoding, elevationBand)); }
@Override void setInvalidPixelExpression(Band band) { band.setNoDataValueUsed(true); band.setNoDataValue(0); }
public void testSetGeophysicalNoDataValueWithLogScaling() { final Band b = createBand(p, ProductData.TYPE_UINT16, 2.3, -1.8, true); final int rawValue = 0; final double geoValue = Math.pow(10.0, -1.8 + 2.3 * rawValue); b.setNoDataValue(rawValue); assertEquals(rawValue, b.getNoDataValue(), 1e-10); assertEquals(geoValue, b.getGeophysicalNoDataValue(), 1e-10); b.setGeophysicalNoDataValue(geoValue); assertEquals(rawValue, b.getNoDataValue(), 1e-10); assertEquals(geoValue, b.getGeophysicalNoDataValue(), 1e-10); }
@Override void setInvalidPixelExpression(Band band) { if (band.getName().startsWith("reflec_")) { band.setNoDataValueUsed(true); band.setNoDataValue(0); } else { band.setNoDataValueUsed(false); band.setNoDataValue(0); } }
@Override void setInvalidPixelExpression(Band band) { if (band.isFlagBand()) { band.setNoDataValueUsed(false); } else { band.setNoDataValueUsed(true); band.setNoDataValue(-2); } }
@Override public Band addBand(String name, String expression, double noDataValue) { Band band = addBand(name, expression); band.setNoDataValue(noDataValue); band.setNoDataValueUsed(true); return band; }
@Override public Band addBand(String name, int dataType, double noDataValue) { Band band = addBand(name, dataType); band.setNoDataValue(noDataValue); band.setNoDataValueUsed(true); return band; }
public void addGeocoding(final Product product) throws ProductIOException { final String longitude = "longitude"; final String latitude = "latitude"; Band latBand = product.getBand(latitude); Band lonBand = product.getBand(longitude); latBand.setNoDataValue(-999.); lonBand.setNoDataValue(-999.); latBand.setNoDataValueUsed(true); lonBand.setNoDataValueUsed(true); product.setGeoCoding(GeoCodingFactory.createPixelGeoCoding(latBand, lonBand, null, 5)); } }
private static void configureBand(Band band05X, ImageInfo imageInfo, String unit, String description) { band05X.setUnit(unit); band05X.setDescription(description); band05X.setImageInfo(imageInfo); band05X.setNoDataValue(Double.NaN); band05X.setNoDataValueUsed(true); }
private void createProbabilityBands() { probabilityBands = new Band[clusterCount]; for (int i = 0; i < clusterCount; ++i) { final Band targetBand = targetProduct.addBand("probability_" + i, ProductData.TYPE_FLOAT32); targetBand.setUnit("dl"); targetBand.setDescription("Cluster posterior probabilities"); targetBand.setNoDataValue(NO_DATA_VALUE); targetBand.setNoDataValueUsed(true); probabilityBands[i] = targetBand; } }
private void addTargetBands(Product product) { final String bandNamePrefix = getTargetBandNamePrefix(); for (Integer percentile : percentiles) { final String name = getTargetPercentileBandName(bandNamePrefix, percentile); final Band band = product.addBand(name, ProductData.TYPE_FLOAT32); band.setNoDataValue(Double.NaN); band.setNoDataValueUsed(true); } product.addBand(COUNT_BAND_NAME, ProductData.TYPE_UINT16); }
private void setBandProperties(H5ScalarDS ds, Band band) throws HDF5Exception { band.setDescription(ProbaVUtils.getStringAttributeValue(ds.getMetadata(), "DESCRIPTION")); band.setUnit(ProbaVUtils.getStringAttributeValue(ds.getMetadata(), "UNITS")); band.setNoDataValue(ProbaVUtils.getFloatAttributeValue(ds.getMetadata(), "NO_DATA")); band.setNoDataValueUsed(true); setSpectralProperties(band); }
@Test public void testNoDataParameter_WithValue() throws IOException { parameterMap.put("crs", UTM33N_CODE); parameterMap.put("noDataValue", 42.0); final Band srcBand = sourceProduct.getBand(FLOAT_BAND_NAME); srcBand.setNoDataValue(299); srcBand.setNoDataValueUsed(true); final Product targetPoduct = createReprojectedProduct(); assertNoDataValue(targetPoduct.getBand(FLOAT_BAND_NAME), new PixelPos(23.5f, 13.5f), 42.0, 42.0); }
public void testIsPixelValid() throws Exception { Band b = p.addBand("b", ProductData.TYPE_FLOAT32); assertTrue(b.isPixelValid(-10, -3)); b.setNoDataValue(12.34); b.setNoDataValueUsed(true); assertFalse(b.isPixelValid(-10, -3)); }
@Test public void testNoDataIfBandNoDataIsGiven_Int() throws IOException { parameterMap.put("crs", UTM33N_CODE); final Band srcBand = sourceProduct.getBand(INT_BAND_NAME); srcBand.setNoDataValue(299); srcBand.setNoDataValueUsed(true); final Product targetPoduct = createReprojectedProduct(); assertNoDataValue(targetPoduct.getBand(INT_BAND_NAME), new PixelPos(23.5f, 13.5f), 299.0, 299); }
@Test public void testNoDataParameter_WithExpressionAndValue() throws IOException { parameterMap.put("crs", UTM33N_CODE); parameterMap.put("noDataValue", 42.0); final Band srcBand = sourceProduct.getBand(FLOAT_BAND_NAME); srcBand.setNoDataValue(299); srcBand.setNoDataValueUsed(true); srcBand.setValidPixelExpression("fneq("+FLOAT_BAND_NAME + ",299)"); final Product targetPoduct = createReprojectedProduct(); assertNoDataValue(targetPoduct.getBand(FLOAT_BAND_NAME), new PixelPos(23.5f, 13.5f), 42.0, 42.0); }
private void testDataType(int productDataType, double v1, double v2, String validMask) { Product p = new Product("p", "t", 1, 2); Band b = p.addBand("b", productDataType); ProductData pData = ProductData.createInstance(productDataType, 2); pData.setElemDoubleAt(0, v1); pData.setElemDoubleAt(1, v2); b.setData(pData); b.setNoDataValue(v2); b.setNoDataValueUsed(true); assertTrue(b.isPixelValid(0, 0)); assertFalse(b.isPixelValid(0, 1)); assertEquals(validMask, b.getValidMaskExpression()); }