public static void setNewBandProperties(Band band, String description, String unit, double noDataValue, boolean useNoDataValue) { band.setDescription(description); band.setUnit(unit); band.setNoDataValue(noDataValue); band.setNoDataValueUsed(useNoDataValue); }
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 Band createBand(String bandName, String description, String unit) { Band band = targetProduct.addBand(bandName, ProductData.TYPE_FLOAT32); band.setDescription(description); band.setUnit(unit); band.setNoDataValue(-9999.); band.setNoDataValueUsed(true); return band; }
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 Band createTargetBand(AotConsts bandFeat, int rasterWidth, int rasterHeight) { Band targetBand = new Band(bandFeat.name, bandFeat.type, rasterWidth, rasterHeight); targetBand.setDescription(bandFeat.description); targetBand.setNoDataValue(bandFeat.noDataValue); targetBand.setNoDataValueUsed(bandFeat.noDataUsed); targetBand.setUnit(bandFeat.unit); targetBand.setScalingFactor(bandFeat.scale); targetBand.setScalingOffset(bandFeat.offset); return targetBand; }
private void addDetectorBands(Product product, Map<String, L1BBandInfo> stringBandInfoMap, MultiLevelImageFactory mlif) throws IOException { product.setPreferredTileSize(S2Config.DEFAULT_JAI_TILE_SIZE, S2Config.DEFAULT_JAI_TILE_SIZE); product.setNumResolutionsMax(getConfig().getTileLayout(getProductResolution().resolution).numResolutions); product.setAutoGrouping("D01:D02:D03:D04:D05:D06:D07:D08:D09:D10:D11:D12"); ArrayList<String> bandIndexes = new ArrayList<>(stringBandInfoMap.keySet()); Collections.sort(bandIndexes); if (bandIndexes.isEmpty()) { throw new IOException("No valid bands found."); } for (String bandIndex : bandIndexes) { L1BBandInfo tileBandInfo = stringBandInfoMap.get(bandIndex); if (isMultiResolution() || tileBandInfo.getBandInformation().getResolution() == this.getProductResolution()) { TileLayout thisBandTileLayout = tileBandInfo.getImageLayout(); TileLayout productTileLayout = getConfig().getTileLayout(getProductResolution()); float factorX = (float) productTileLayout.width / thisBandTileLayout.width; float factorY = (float) productTileLayout.height / thisBandTileLayout.height; Dimension dimension = new Dimension(Math.round(product.getSceneRasterWidth() / factorX), Math.round(product.getSceneRasterHeight() / factorY)); Band band = addBand(product, tileBandInfo, dimension); band.setDescription(tileBandInfo.getBandInformation().getDescription()); band.setSourceImage(mlif.createSourceImage(tileBandInfo)); } } }
protected Band createBand(final Product product, String name, final String unit, final int bitsPerSample) { int dataType = ProductData.TYPE_UINT16; if (bitsPerSample == 16) { dataType = isProductSLC ? ProductData.TYPE_INT16 : ProductData.TYPE_UINT16; } else if (bitsPerSample == 32) { dataType = ProductData.TYPE_FLOAT32; } else if (bitsPerSample == 8) { dataType = isProductSLC ? ProductData.TYPE_INT8 : ProductData.TYPE_UINT8; } if(product.getBand(name) != null) { int cnt = 0; for(String bandName : product.getBandNames()) { if(bandName.startsWith(name)) { ++cnt; } } name += "_" + cnt; } final Band band = new Band(name, dataType, sceneWidth, sceneHeight); band.setDescription(name); band.setUnit(unit); band.setNoDataValue(0); band.setNoDataValueUsed(true); product.addBand(band); return band; }
targetBand.setImageInfo(srcBand.getImageInfo()); if (prefix.equals("Flat")) { targetBand.setDescription(String.format("Ground reflectance with the correction of slope effects, band %s", bandId)); } else if (prefix.equals("Surface")) { targetBand.setDescription(String.format("Ground reflectance without the correction of slope effects, band %s", bandId));
private void writeUnwrappedBandHeader(final Product sourceProduct) throws IOException { Band phaseBand = null; for (Band band : sourceProduct.getBands()) { if (band.getUnit()!= null && band.getUnit().contains(Unit.PHASE)) { phaseBand = band; break; } } if(phaseBand == null) { throw new IOException("SNAPHU writer requires a wrapped phase band"); } String bandName = UNWRAPPED_PREFIX + phaseBand.getName() + SNAPHU_HEADER_EXTENSION; File unwrappedHeaderFile = new File(_outputDir, bandName); Band newBand = new Band(UNWRAPPED_PREFIX+phaseBand.getName(), phaseBand.getDataType(), phaseBand.getRasterWidth(), phaseBand.getRasterHeight()); newBand.setDescription("Unwrapped "+phaseBand.getDescription()); EnviHeader.createPhysicalFile(unwrappedHeaderFile, newBand, newBand.getRasterWidth(), newBand.getRasterHeight(), 0); }
static private SpectrumBand createBand(int index) { final Band band = new Band("Radiance_" + (index + 1), ProductData.TYPE_INT16, 100, 100); band.setDescription("Radiance for band " + (index + 1)); band.setSpectralWavelength((float) Math.random()); band.setSpectralBandwidth((float) Math.random()); band.setUnit("sr^-1"); if (index == 7) { band.setUnit("dl"); } return new SpectrumBand(band, true); }
private void addDeltaBands() { final Band deltaLonBand = targetProduct.addBand("delta_lon_angular", "longitude - LON"); deltaLonBand.setUnit("deg"); deltaLonBand.setDescription("Delta between old longitude and new longitude in degree"); deltaLonBand.setNoDataValueUsed(true); deltaLonBand.setNoDataValue(noDataValue == null ? Double.NaN : noDataValue); deltaLonBand.setImageInfo(createDeltaBandImageInfo(-0.015, +0.015)); final Band deltaLatBand = targetProduct.addBand("delta_lat_angular", "latitude - LAT"); deltaLatBand.setUnit("deg"); deltaLatBand.setDescription("Delta between old latitude and new latitude in degree"); deltaLatBand.setNoDataValueUsed(true); deltaLatBand.setNoDataValue(noDataValue == null ? Double.NaN : noDataValue); deltaLatBand.setImageInfo(createDeltaBandImageInfo(-0.01, +0.01)); final Band deltaLonMetBand = targetProduct.addBand("delta_lon_metric", "cos(rad(LAT)) * 6378137 * rad(longitude - LON)"); deltaLonMetBand.setUnit("m"); deltaLonMetBand.setDescription("Delta between old longitude and new longitude in meters"); deltaLonMetBand.setNoDataValueUsed(true); deltaLonMetBand.setNoDataValue(noDataValue == null ? Double.NaN : noDataValue); deltaLonMetBand.setImageInfo(createDeltaBandImageInfo(-1500.0, +1500.0)); final Band deltaLatMetBand = targetProduct.addBand("delta_lat_metric", "6378137 * rad(latitude - LAT)"); deltaLatMetBand.setUnit("m"); deltaLatMetBand.setDescription("Delta between old latitude and new latitude in meters"); deltaLatMetBand.setNoDataValueUsed(true); deltaLatMetBand.setNoDataValue(noDataValue == null ? Double.NaN : noDataValue); deltaLatMetBand.setImageInfo(createDeltaBandImageInfo(-1000.0, +1000.0)); }
@Override protected void configureTargetProduct(ProductConfigurer productConfigurer) { super.configureTargetProduct(productConfigurer); final Band lineHeightBand = productConfigurer.addBand(lineHeightBandName, ProductData.TYPE_FLOAT32); final Band signalBand = sourceProduct.getBand(signalBandName); lineHeightBand.setUnit(signalBand.getUnit()); lineHeightBand.setDescription("Line height band"); lineHeightBand.setNoDataValueUsed(true); lineHeightBand.setNoDataValue(invalidMciValue); ProductUtils.copySpectralBandProperties(signalBand, lineHeightBand); if (slope) { final Band slopeBand = productConfigurer.addBand(slopeBandName, ProductData.TYPE_FLOAT32); slopeBand.setUnit(signalBand.getUnit() + " nm-1"); slopeBand.setDescription("Baseline slope band"); slopeBand.setNoDataValueUsed(true); slopeBand.setNoDataValue(invalidMciValue); } ProductUtils.copyFlagBands(sourceProduct, productConfigurer.getTargetProduct(), true); }
private void addAOTImage(Product product, String pathString) { Band srcBand = getTifBand(pathString, 1); if (srcBand == null) { logger.warning(String.format("Image %s not added", pathString)); return; } MuscateMetadata.Geoposition geoposition = getGeoposition(srcBand.getRasterWidth(), srcBand.getRasterHeight()); if (geoposition == null) { logger.warning(String.format("Unrecognized geometry of image %s, it will not be added to the product %s.", pathString, product.getName())); return; } String bandName = "AOT_" + geoposition.id; Band targetBand = new Band(bandName, srcBand.getDataType(), srcBand.getRasterWidth(), srcBand.getRasterHeight()); product.addBand(targetBand); ProductUtils.copyGeoCoding(srcBand, targetBand); targetBand.setNoDataValue(metadata.getAOTNoDataValue()); targetBand.setNoDataValueUsed(true); targetBand.setScalingFactor(1.0d / metadata.getAOTQuantificationValue()); targetBand.setScalingOffset(0.0d); targetBand.setSampleCoding(srcBand.getSampleCoding()); targetBand.setImageInfo(srcBand.getImageInfo()); targetBand.setDescription(String.format("Aerosol Optical Thickness at %.0fm resolution", geoposition.xDim)); targetBand.setSourceImage(srcBand.getSourceImage()); }
private static void addElevationBand(Product product, ElevationModel dem, String elevationBandName) { final GeoCoding geoCoding = product.getSceneGeoCoding(); ElevationModelDescriptor demDescriptor = dem.getDescriptor(); final float noDataValue = dem.getDescriptor().getNoDataValue(); final Band elevationBand = product.addBand(elevationBandName, ProductData.TYPE_FLOAT32); elevationBand.setNoDataValueUsed(true); elevationBand.setNoDataValue(noDataValue); elevationBand.setUnit(Unit.METERS); elevationBand.setDescription(demDescriptor.getName()); elevationBand.setSourceImage(createElevationSourceImage(dem, geoCoding, elevationBand)); }
private void addWVCImage(Product product, String pathString) { Band srcBand = getTifBand(pathString, 0); if (srcBand == null) { logger.warning(String.format("Image %s not added", pathString)); return; } MuscateMetadata.Geoposition geoposition = getGeoposition(srcBand.getRasterWidth(), srcBand.getRasterHeight()); if (geoposition == null) { logger.warning(String.format("Unrecognized geometry of image %s, it will not be added to the product %s.", pathString, product.getName())); return; } String bandName = "WVC_" + geoposition.id; Band targetBand = new Band(bandName, srcBand.getDataType(), srcBand.getRasterWidth(), srcBand.getRasterHeight()); product.addBand(targetBand); ProductUtils.copyGeoCoding(srcBand, targetBand); targetBand.setNoDataValue(metadata.getWVCNoDataValue()); targetBand.setNoDataValueUsed(true); targetBand.setScalingFactor(1.0d / metadata.getWVCQuantificationValue()); targetBand.setScalingOffset(0.0d); targetBand.setUnit("cm"); //TODO verify targetBand.setSampleCoding(srcBand.getSampleCoding()); targetBand.setImageInfo(srcBand.getImageInfo()); targetBand.setDescription(String.format("Water vapor content at %.0fm resolution in %s", geoposition.xDim, targetBand.getUnit())); targetBand.setSourceImage(srcBand.getSourceImage()); }
public static Band createBand(final Variable variable, final int rasterWidth, final int rasterHeight, int dataType) { final NcAttributeMap attMap = NcAttributeMap.create(variable); final Band band = new Band(variable.getShortName(), (dataType == ProductData.TYPE_UNDEFINED) ? getRasterDataType(variable) : dataType, rasterWidth, rasterHeight); band.setDescription(getDescription(variable, attMap)); band.setUnit(getUnit(variable, attMap)); band.setScalingFactor(getScalingFactor(attMap)); band.setScalingOffset(getAddOffset(attMap)); final Number noDataValue = getNoDataValue(attMap); if (noDataValue != null) { band.setNoDataValue(noDataValue.doubleValue()); band.setNoDataValueUsed(true); } return band; }
Dimension dimension = sceneDescription.getSceneDimension(bandInfo.getBandInformation().getResolution()); Band band = addBand(product, bandInfo, dimension); band.setDescription(bandInfo.getBandInformation().getDescription()); band.setUnit(bandInfo.getBandInformation().getUnit());
targetBand.setNoDataValue(srcBand.getNoDataValue()); targetBand.setNoDataValueUsed(srcBand.isNoDataValueUsed()); targetBand.setDescription(srcBand.getDescription()); targetProduct.addBand(targetBand);
private void setBandProperties(Band targetBand, Band band) { targetBand.setSpectralBandIndex(band.getSpectralBandIndex()); targetBand.setSpectralWavelength(band.getSpectralWavelength()); targetBand.setSpectralBandwidth(band.getSpectralBandwidth()); targetBand.setSolarFlux(band.getSolarFlux()); targetBand.setUnit(band.getUnit()); targetBand.setNoDataValue(band.getNoDataValue()); targetBand.setNoDataValueUsed(true); targetBand.setScalingFactor(band.getScalingFactor()); targetBand.setScalingOffset(band.getScalingOffset()); targetBand.setUnit(band.getUnit()); targetBand.setDescription(band.getDescription()); }
@Override public void initialize() throws OperatorException { final int rasterWidth = sourceProduct.getSceneRasterWidth(); final int rasterHeight = sourceProduct.getSceneRasterHeight(); geoCoding = sourceProduct.getSceneGeoCoding(); targetProduct = new Product("Elevation Product", "Elevation", rasterWidth, rasterHeight); targetProduct.setDescription("Elevation for " + sourceProduct.getName()); ProductUtils.copyTiePointGrids(sourceProduct, targetProduct); ProductUtils.copyGeoCoding(sourceProduct, targetProduct); targetProduct.setPointingFactory(sourceProduct.getPointingFactory()); final ElevationModelRegistry elevationModelRegistry = ElevationModelRegistry.getInstance(); ElevationModelDescriptor demDescriptor = elevationModelRegistry.getDescriptor("GMTED2010_30"); if (demDescriptor == null || !demDescriptor.canBeDownloaded()) { demDescriptor = elevationModelRegistry.getDescriptor("GETASSE30"); if (demDescriptor == null || !demDescriptor.canBeDownloaded()) { throw new OperatorException(" No DEM installed (neither GETASSE30 nor GMTED2010_30)."); } } getLogger().info("Dsing DEM: " + demDescriptor.getName()); dem = demDescriptor.createDem(Resampling.BILINEAR_INTERPOLATION); noDataValue = dem.getDescriptor().getNoDataValue(); String elevName = "elevation"; Band elevBand = targetProduct.addBand(elevName, ProductData.TYPE_INT16); elevBand.setNoDataValue(noDataValue); elevBand.setNoDataValueUsed(true); elevBand.setUnit("meters"); elevBand.setDescription(demDescriptor.getName()); setTargetProduct(targetProduct); }