private void setGeophysicalNoDataValue() { geophysicalNoDataValue = scale(getNoDataValue()); }
private static boolean isNoDataValue(RasterDataNode raster, float sample) { return !raster.isNoDataValueUsed() && sample == raster.getNoDataValue(); }
private static boolean isNoDataValue(RasterDataNode raster, int sample) { return !raster.isNoDataValueUsed() && sample == raster.getNoDataValue(); }
private Number getTargetNoDataValue(RasterDataNode sourceRaster, int targetDataType) { double targetNoDataValue = Double.NaN; if (noDataValue != null) { targetNoDataValue = noDataValue; } else if (sourceRaster.isNoDataValueUsed()) { targetNoDataValue = sourceRaster.getNoDataValue(); } Number targetNoDataNumber; if (targetDataType == ProductData.TYPE_INT8) { targetNoDataNumber = (byte) targetNoDataValue; } else if (targetDataType == ProductData.TYPE_INT16 || targetDataType == ProductData.TYPE_UINT8) { targetNoDataNumber = (short) targetNoDataValue; } else if (targetDataType == ProductData.TYPE_INT32 || targetDataType == ProductData.TYPE_UINT16) { targetNoDataNumber = (int) targetNoDataValue; } else if (targetDataType == ProductData.TYPE_FLOAT32) { targetNoDataNumber = (float) targetNoDataValue; } else { targetNoDataNumber = targetNoDataValue; } return targetNoDataNumber; }
private boolean isNoDataValue(double sample) { final RasterDataNode rasterDataNode = tile.getRasterDataNode(); if (rasterDataNode.isNoDataValueUsed()) { if (rasterDataNode.isScalingApplied()) { return rasterDataNode.getGeophysicalNoDataValue() == sample; } else { return rasterDataNode.getNoDataValue() == sample; } } return false; } }
private String createValidMaskExpressionForNoDataValue() { final String ref = BandArithmetic.createExternalName(getName()); final double noDataValue = getGeophysicalNoDataValue(); if (Double.isNaN(noDataValue)) { return "!nan(" + ref + ")"; } else if (Double.isInfinite(noDataValue)) { return "!inf(" + ref + ")"; } else { if (ProductData.isIntType(getDataType())) { double rawNoDataValue = getNoDataValue(); String rawSymbol = getName() + ".raw"; String extName = BandArithmetic.createExternalName(rawSymbol); return extName + " != " + rawNoDataValue; } else { return "fneq(" + ref + "," + noDataValue + ")"; } } }
public void testSetNoDataValue_SetNoDataValue_UByte_WithScalingLinkeAeroOptThick_MER_RR__2P() { short noDataValue; double geophysNoDataValue; initNode(ProductData.TYPE_UINT8, 0.0062992126, -0.0062992126, false); noDataValue = 87; _node.setNoDataValue(noDataValue); geophysNoDataValue = _node.getGeophysicalNoDataValue(); _node.setGeophysicalNoDataValue(4f); _node.setGeophysicalNoDataValue(geophysNoDataValue); assertEquals("Expected "+ noDataValue+" but was " + _node.getNoDataValue(), true, noDataValue == _node.getNoDataValue()); noDataValue = 120; _node.setNoDataValue(noDataValue); geophysNoDataValue = _node.getGeophysicalNoDataValue(); _node.setGeophysicalNoDataValue(4f); _node.setGeophysicalNoDataValue(geophysNoDataValue); assertEquals("Expected "+ noDataValue+" but was " + _node.getNoDataValue(), true, noDataValue == _node.getNoDataValue()); }
public void testSetRawNoDataValue_SetNoDataValue_UByte_WithScalingLikeAlgal_MER_RR__2P() { short noDataValue; double geophysNoDataValue; initNode(ProductData.TYPE_UINT8, 0.023622047156095505, -3.0236220359802246, true); noDataValue = 214; _node.setNoDataValue(noDataValue); geophysNoDataValue = _node.getGeophysicalNoDataValue(); _node.setGeophysicalNoDataValue(4f); _node.setGeophysicalNoDataValue(geophysNoDataValue); assertEquals("Expected "+ noDataValue+" but was " + _node.getNoDataValue(), true, noDataValue == _node.getNoDataValue()); noDataValue = 120; _node.setNoDataValue(noDataValue); geophysNoDataValue = _node.getGeophysicalNoDataValue(); _node.setGeophysicalNoDataValue(4f); _node.setGeophysicalNoDataValue(geophysNoDataValue); assertEquals("Expected "+ noDataValue+" but was " + _node.getNoDataValue(), true, noDataValue == _node.getNoDataValue()); }
public void testSetRawNoDataValue_SetNoDataValue_UShort_WithScalingLikeReflec_MER_RR__2P() { int noDataValue; double geophysNoDataValue; initNode(ProductData.TYPE_UINT16, 1.5259255E-5, -1.5259255E-5, false); noDataValue = 1214; _node.setNoDataValue(noDataValue); geophysNoDataValue = _node.getGeophysicalNoDataValue(); _node.setGeophysicalNoDataValue(4f); _node.setGeophysicalNoDataValue(geophysNoDataValue); assertEquals("Expected "+ noDataValue+" but was " + _node.getNoDataValue(), true, noDataValue == _node.getNoDataValue()); noDataValue = 120; _node.setNoDataValue(noDataValue); geophysNoDataValue = _node.getGeophysicalNoDataValue(); _node.setGeophysicalNoDataValue(4f); _node.setGeophysicalNoDataValue(geophysNoDataValue); assertEquals("Expected "+ noDataValue+" but was " + _node.getNoDataValue(), true, noDataValue == _node.getNoDataValue()); }
public void testSetRawNoDataValue_SetNoDataValue_UShort_WithScalingLikeTotalSusp_MER_RR__2P() { int noDataValue; double geophysNoDataValue; initNode(ProductData.TYPE_UINT16, 0.015748031, -2.015748, true); noDataValue = 1214; _node.setNoDataValue(noDataValue); geophysNoDataValue = _node.getGeophysicalNoDataValue(); _node.setGeophysicalNoDataValue(4f); _node.setGeophysicalNoDataValue(geophysNoDataValue); assertEquals("Expected "+ noDataValue+" but was " + _node.getNoDataValue(), true, noDataValue == _node.getNoDataValue()); noDataValue = 120; _node.setNoDataValue(noDataValue); geophysNoDataValue = _node.getGeophysicalNoDataValue(); _node.setGeophysicalNoDataValue(4f); _node.setGeophysicalNoDataValue(geophysNoDataValue); assertEquals("Expected "+ noDataValue+" but was " + _node.getNoDataValue(),true, noDataValue == _node.getNoDataValue()); }
public void testSetRawNoDataValue_SetNoDataValue_UShort_WithScalingLikeRadiance5_MER_RR__1P() { int noDataValue; double geophysNoDataValue; initNode(ProductData.TYPE_UINT16, 0.00940664, 0, false); noDataValue = 1214; _node.setNoDataValue(noDataValue); geophysNoDataValue = _node.getGeophysicalNoDataValue(); _node.setGeophysicalNoDataValue(4f); _node.setGeophysicalNoDataValue(geophysNoDataValue); assertEquals("Expected "+ noDataValue+" but was " + _node.getNoDataValue(), true, noDataValue == _node.getNoDataValue()); noDataValue = 120; _node.setNoDataValue(noDataValue); geophysNoDataValue = _node.getGeophysicalNoDataValue(); _node.setGeophysicalNoDataValue(4f); _node.setGeophysicalNoDataValue(geophysNoDataValue); assertEquals("Expected "+ noDataValue+" but was " + _node.getNoDataValue(),true, noDataValue == _node.getNoDataValue()); }
if (noData == null || getNoDataValue() != noDataValue) { if (noData == null) { noData = createCompatibleProductData(1);
variable.addAttribute(Constants.ADD_OFFSET_ATT_NAME, scalingOffset); noDataValue = rasterDataNode.getNoDataValue(); } else {
targetRaster.setLog10Scaled(sourceRaster.isLog10Scaled()); targetRaster.setNoDataValueUsed(sourceRaster.isNoDataValueUsed()); targetRaster.setNoDataValue(sourceRaster.getNoDataValue()); targetRaster.setValidPixelExpression(sourceRaster.getValidPixelExpression()); if (sourceRaster instanceof Band && targetRaster instanceof Band) {