/** * Tests whether the data type of this node is a floating point type. * * @return true, if so */ public boolean isFloatingPointType() { return ProductData.isFloatingPointType(dataType); }
private boolean mustReplaceNaN(RasterDataNode sourceRaster, int targetDataType, double targetNoDataValue) { final boolean isFloat = ProductData.isFloatingPointType(targetDataType); final boolean isNoDataGiven = sourceRaster.isNoDataValueUsed() || noDataValue != null; final boolean isNoDataNaN = Double.isNaN(targetNoDataValue); return isFloat && isNoDataGiven && !isNoDataNaN; }
private static int computeSymbolType(RasterDataNode raster, Source source) { if (raster instanceof Mask) { return Term.TYPE_B; } int dataType = raster.getDataType(); boolean isFloatingPointType = ProductData.isFloatingPointType(dataType); boolean isScaled = raster.isScalingApplied(); switch (source) { case RAW: return isFloatingPointType ? Term.TYPE_D : Term.TYPE_I; case GEOPHYSICAL: return isScaled || isFloatingPointType ? Term.TYPE_D : Term.TYPE_I; } throw new IllegalArgumentException("Source not supported: " + source); }
private Interpolation getResampling(Band band) { int resampleType = getResampleType(); if (!ProductData.isFloatingPointType(band.getDataType())) { resampleType = Interpolation.INTERP_NEAREST; } return Interpolation.getInstance(resampleType); }
public void testIsFloatingPointType() { assertEquals(false, ProductData.isFloatingPointType(ProductData.TYPE_ASCII)); assertEquals(true, ProductData.isFloatingPointType(ProductData.TYPE_FLOAT32)); assertEquals(true, ProductData.isFloatingPointType(ProductData.TYPE_FLOAT64)); assertEquals(false, ProductData.isFloatingPointType(ProductData.TYPE_INT16)); assertEquals(false, ProductData.isFloatingPointType(ProductData.TYPE_INT32)); assertEquals(false, ProductData.isFloatingPointType(ProductData.TYPE_INT8)); assertEquals(false, ProductData.isFloatingPointType(ProductData.TYPE_UINT16)); assertEquals(false, ProductData.isFloatingPointType(ProductData.TYPE_UINT32)); assertEquals(false, ProductData.isFloatingPointType(ProductData.TYPE_UINT8)); assertEquals(false, ProductData.isFloatingPointType(ProductData.TYPE_UTC)); }
if (ProductData.isFloatingPointType(dt)) { maxFloatType = Math.max(maxFloatType, dt);
if (ProductData.isFloatingPointType(dt)) { maxFloatType = Math.max(maxFloatType, dt);
private Namespace createNamespace() { WritableNamespace namespace = BandArithmetic.createDefaultNamespace(sourceProducts, 0, new SourceProductPrefixProvider()); if (variables != null) { for (Variable variable : variables) { if (ProductData.isFloatingPointType(ProductData.getType(variable.type))) { Symbol symbol = SymbolFactory.createConstant(variable.name, Double.parseDouble(variable.value)); namespace.registerSymbol(symbol); } else if (ProductData.isIntType(ProductData.getType(variable.type))) { Symbol symbol = SymbolFactory.createConstant(variable.name, Long.parseLong(variable.value)); namespace.registerSymbol(symbol); } else if ("boolean".equals(variable.type)) { Symbol symbol = SymbolFactory.createConstant(variable.name, Boolean.parseBoolean(variable.value)); namespace.registerSymbol(symbol); } } } return namespace; }
final double stdDev = stdDevNumber != null ? stdDevNumber.doubleValue() : Double.NaN; final boolean intHistogram = !ProductData.isFloatingPointType(band.getGeophysicalDataType());
private static Stx createStx(Band band, Element bandStatisticsElem) { final Double minSample = getElemDouble(bandStatisticsElem, DimapProductConstants.TAG_STX_MIN); final Double maxSample = getElemDouble(bandStatisticsElem, DimapProductConstants.TAG_STX_MAX); final Double mean = getElemDouble(bandStatisticsElem, DimapProductConstants.TAG_STX_MEAN); final Double stdDev = getElemDouble(bandStatisticsElem, DimapProductConstants.TAG_STX_STDDEV); final Integer level = getElemInt(bandStatisticsElem, DimapProductConstants.TAG_STX_LEVEL); final int[] bins = getHistogramBins(bandStatisticsElem); boolean intHistogram = !ProductData.isFloatingPointType(band.getGeophysicalDataType()); if (minSample != null && maxSample != null) { return new StxFactory() .withMinimum(minSample) .withMaximum(maxSample) .withMean(mean) .withStandardDeviation(stdDev) .withIntHistogram(intHistogram) .withHistogramBins(bins == null ? new int[0] : bins) .withResolutionLevel(level).create(); } return null; }