private String createDescription(Band computedBand) { if (computedBand instanceof VirtualBand) { VirtualBand virtualBand = (VirtualBand) computedBand; String oldDescription = virtualBand.getDescription(); String newDescription = oldDescription == null ? "" : oldDescription.trim(); String formerExpressionDescription = "(expression was '" + virtualBand.getExpression() + "')"; newDescription = newDescription.isEmpty() ? formerExpressionDescription : newDescription + " " + formerExpressionDescription; return newDescription; } else { return computedBand.getDescription(); } }
private void addBandCheckers(final StringBuffer description, final JPanel checkersPane, final GridBagConstraints gbc, final ActionListener checkListener) { for (int i = 0; i < allBands.length; i++) { Band band = allBands[i]; boolean checked = false; for (Band selectedBand : selectedBands) { if (band == selectedBand) { checked = true; numSelected++; break; } } description.setLength(0); description.append(band.getDescription() == null ? "" : band.getDescription()); if (band.getSpectralWavelength() > 0.0) { description.append(" ("); description.append(band.getSpectralWavelength()); description.append(" nm)"); } final JCheckBox check = new JCheckBox(getRasterDisplayName(band), checked); check.setFont(SMALL_PLAIN_FONT); check.addActionListener(checkListener); final JLabel label = new JLabel(description.toString()); label.setFont(SMALL_ITALIC_FONT); gbc.gridy++; GridBagUtils.addToPanel(checkersPane, check, gbc, "weightx=0,gridx=0"); GridBagUtils.addToPanel(checkersPane, label, gbc, "weightx=1,gridx=1"); checkBoxes[i] = check; } }
private String createToolTip(final Band band) { StringBuilder tooltip = new StringBuilder(); append(tooltip, band.getDescription()); if (band.getSpectralWavelength() > 0.0) { append(tooltip, String.format("%s nm", band.getSpectralWavelength())); if (band.getSpectralBandwidth() > 0.0) { append(tooltip, String.format("+/-%s nm", 0.5 * band.getSpectralBandwidth())); } } append(tooltip, String.format("%d x %d pixels", band.getRasterWidth(), band.getRasterHeight())); if (band instanceof VirtualBand) { append(tooltip, String.format("Expr.: %s", ((VirtualBand) band).getExpression())); } if (band.getUnit() != null) { append(tooltip, String.format(" (%s)", band.getUnit())); } return tooltip.toString(); }
expression); virtBand.setUnit(unit); virtBand.setDescription(band.getDescription()); virtBand.setNoDataValueUsed(true); product.addBand(virtBand);
spectrumData[i][band_selected_index] = selected; spectrumData[i][band_name_index] = spectralBand.getName(); spectrumData[i][band_description_index] = spectralBand.getDescription(); spectrumData[i][band_wavelength_index] = spectralBand.getSpectralWavelength(); spectrumData[i][band_bandwidth_ndex] = spectralBand.getSpectralBandwidth();
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); }
targetBand.setDescription(srcBand.getDescription()); targetBand.setNoDataValue(srcBand.getNoDataValue()); targetBand.setNoDataValueUsed(true);
targetBand.setDescription(srcBand.getDescription()); targetBand.setNoDataValue(srcBand.getNoDataValue()); targetBand.setNoDataValueUsed(srcBand.isNoDataValueUsed());
private static void applyScaling(final Product product, final Band band, final double gain, final double bias, final double exp, final boolean isLog) { final String bandName = band.getName(); final String unit = band.getUnit(); String expression = gain + " * " + bandName + " + " + bias; String targetName = bandName + "_Scaled"; int cnt = 0; while (product.getBand(targetName) != null) { ++cnt; targetName = bandName + "_Scaled" + cnt; } if (exp != 1) { expression = "pow( " + expression + ", " + exp + " )"; } if (isLog) { expression = bandName + "==0 ? 0 : " + "log10( " + expression + " )"; } final VirtualBand virtBand = new VirtualBand(targetName, ProductData.TYPE_FLOAT32, band.getRasterWidth(), band.getRasterHeight(), expression); virtBand.setUnit(unit); virtBand.setDescription(band.getDescription()); virtBand.setNoDataValueUsed(true); product.addBand(virtBand); }
public static void convert(final Product product, final Band band, final boolean toAmplitude) { String bandName = band.getName(); String unit; String expression; if (toAmplitude) { expression = "sqrt(" + bandName + ')'; bandName = replaceName(bandName, "Intensity", "Amplitude"); unit = Unit.AMPLITUDE; } else { expression = bandName + " * " + bandName; bandName = replaceName(bandName, "Amplitude", "Intensity"); unit = Unit.INTENSITY; } final VirtualBand virtBand = new VirtualBand(bandName, ProductData.TYPE_FLOAT32, band.getRasterWidth(), band.getRasterHeight(), expression); virtBand.setUnit(unit); virtBand.setDescription(band.getDescription()); virtBand.setNoDataValueUsed(true); product.addBand(virtBand); }
if (targetBand.getDescription() == null) if (srcBand.getDescription() == null) targetBand.setDescription("Combined " + targetBand.getName() + " from underlying components"); else targetBand.setDescription(srcBand.getDescription());
addEntry("Name:", band.getName(), ""); addEntry("Type:", "Band", ""); addEntry("Description:", band.getDescription(), ""); addEntry("Geophysical unit:", band.getUnit(), ""); addEntry("Geophysical data type:", ProductData.getTypeString(band.getGeophysicalDataType()), "");
targetBand.setNoDataValue(srcBand.getNoDataValue()); targetBand.setNoDataValueUsed(srcBand.isNoDataValueUsed()); targetBand.setDescription(srcBand.getDescription()); targetProduct.addBand(targetBand);
targetBand.setScalingFactor(bandGain); targetBand.setScalingOffset(band.getScalingOffset()); targetBand.setDescription(band.getDescription()); if (band.getGeoCoding() != null) { targetBand.setGeoCoding(band.getGeoCoding());
targetBand.setImageInfo(srcBand.getImageInfo()); targetBand.setSpectralBandIndex(srcBand.getSpectralBandIndex()); targetBand.setDescription(srcBand.getDescription());
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()); }
targetBand.setDescription(srcBand.getDescription()); targetProduct.addBand(targetBand); targetBandToSlaveBandMap.put(targetBand, srcBand);
targetBand.setDescription(srcBand.getDescription()); targetBand.setSourceImage(srcBand.getSourceImage());
rootGroup.findDimension(NetcdfConstants.LON_VAR_NAMES[0])} ); if (band.getDescription() != null) netCDFWriteable.addVariableAttribute(name, "description", band.getDescription()); if (band.getUnit() != null) netCDFWriteable.addVariableAttribute(name, "unit", band.getUnit());