private String getSampleType(final MetadataElement globalElem) { if (globalElem.getAttributeInt("Samples_per_Pixel", 0) > 1) { isComplex = true; return "COMPLEX"; } isComplex = false; return "DETECTED"; }
/** * Get subset x and y offsets from abstract metadata. */ private void getSubsetOffset() { subsetOffsetX = absRoot.getAttributeInt(AbstractMetadata.subset_offset_x); subsetOffsetY = absRoot.getAttributeInt(AbstractMetadata.subset_offset_y); }
/** * Get subset x and y offsets from abstract metadata. */ private void getSubsetOffset() { subsetOffsetX = absRoot.getAttributeInt(AbstractMetadata.subset_offset_x); subsetOffsetY = absRoot.getAttributeInt(AbstractMetadata.subset_offset_y); }
private String getSampleType(final MetadataElement globalElem) { if (globalElem.getAttributeInt("Samples_per_Pixel", 0) > 1) { isComplex = true; return "COMPLEX"; } isComplex = false; return "DETECTED"; }
/** * Get subset x and y offsets from abstract metadata. */ private void getSubsetOffset() { subsetOffsetX = absRoot.getAttributeInt(AbstractMetadata.subset_offset_x); subsetOffsetY = absRoot.getAttributeInt(AbstractMetadata.subset_offset_y); }
/** * Compute theoretical coefficient of variance. */ private void computeTheoreticalCoefficientOfVariance() { final int azimuthLooks = absRoot.getAttributeInt(AbstractMetadata.azimuth_looks); final int rangeLooks = absRoot.getAttributeInt(AbstractMetadata.range_looks); c = 1.0 / (azimuthLooks + rangeLooks); }
private static Dimension getBandDimension(final MetadataElement newRoot, final String name) { final MetadataElement absRoot = newRoot.getElement(AbstractMetadata.ABSTRACT_METADATA_ROOT); final int width = absRoot.getAttributeInt(AbstractMetadata.num_samples_per_line); final int height = absRoot.getAttributeInt(AbstractMetadata.num_output_lines); return new Dimension(width, height); }
protected Dimension getBandDimensions(final MetadataElement newRoot, final String bandMetadataName) { final MetadataElement absRoot = newRoot.getElement(AbstractMetadata.ABSTRACT_METADATA_ROOT); final MetadataElement bandMetadata = absRoot.getElement(bandMetadataName); final int width, height; if(bandMetadata != null) { width = bandMetadata.getAttributeInt(AbstractMetadata.num_samples_per_line); height = bandMetadata.getAttributeInt(AbstractMetadata.num_output_lines); } else { width = absRoot.getAttributeInt(AbstractMetadata.num_samples_per_line); height = absRoot.getAttributeInt(AbstractMetadata.num_output_lines); } return new Dimension(width, height); }
protected Dimension getProductDimensions(final MetadataElement newRoot) { final MetadataElement absRoot = newRoot.getElement(AbstractMetadata.ABSTRACT_METADATA_ROOT); final int sceneWidth = absRoot.getAttributeInt(AbstractMetadata.num_samples_per_line); final int sceneHeight = absRoot.getAttributeInt(AbstractMetadata.num_output_lines); return new Dimension(sceneWidth, sceneHeight); }
private String writeImageGeometry() { if (absRoot.getAttributeString(AbstractMetadata.sample_type).equals("COMPLEX") || absRoot.getAttributeInt(AbstractMetadata.srgr_flag, 0) == 0) { return "SLANT_RANGE"; } return "GROUND_RANGE"; }
private static boolean isBiStaticStack(final Product product) { final MetadataElement absRoot = AbstractMetadata.getAbstractedMetadata(product); return absRoot != null && absRoot.getAttributeInt(AbstractMetadata.bistatic_stack, 0) == 1; }
protected void updateData(final Product product) { if (product != null) { data[0] = product.getName(); data[1] = product.getProductType(); final MetadataElement absRoot = AbstractMetadata.getAbstractedMetadata(product); if (absRoot != null) { data[2] = OperatorUtils.getAcquisitionDate(absRoot); data[3] = String.valueOf(absRoot.getAttributeInt(AbstractMetadata.REL_ORBIT, 0)); data[4] = String.valueOf(absRoot.getAttributeInt(AbstractMetadata.ABS_ORBIT, 0)); } } } }
protected void updateData() { if (file != null) { data[0] = file.getName(); } else if (entry != null) { data[0] = entry.getName(); data[1] = entry.getProductType(); data[2] = entry.getFirstLineTime().format(); final MetadataElement meta = entry.getMetadata(); if (meta != null) { data[3] = String.valueOf(meta.getAttributeInt(AbstractMetadata.REL_ORBIT, 0)); data[4] = String.valueOf(meta.getAttributeInt(AbstractMetadata.ABS_ORBIT, 0)); } } }
private void determineProductDimensions(final MetadataElement absRoot) throws IOException { int totalWidth = 0, maxHeight = 0, k = 0; String pol = null; for (Map.Entry<String, ImageIOFile> stringImageIOFileEntry : bandImageFileMap.entrySet()) { final ImageIOFile img = stringImageIOFileEntry.getValue(); final String imgName = img.getName().toLowerCase(); final String bandMetadataName = imgBandMetadataMap.get(imgName); if (bandMetadataName == null) { throw new IOException("Metadata for measurement dataset " + imgName + " not found"); } if (k == 0) { pol = bandMetadataName.substring(bandMetadataName.lastIndexOf("_") + 1); } else if (!bandMetadataName.substring(bandMetadataName.lastIndexOf("_") + 1).equals(pol)) { continue; } k++; final MetadataElement bandMetadata = absRoot.getElement(bandMetadataName); int width = bandMetadata.getAttributeInt(AbstractMetadata.num_samples_per_line); int height = bandMetadata.getAttributeInt(AbstractMetadata.num_output_lines); totalWidth += width; if (height > maxHeight) { maxHeight = height; } } if (isSLC() && isTOPSAR()) { // approximate does not account for overlap absRoot.setAttributeInt(AbstractMetadata.num_samples_per_line, totalWidth); absRoot.setAttributeInt(AbstractMetadata.num_output_lines, maxHeight); } }
/** * Get the number of output lines of a given swath. * * @param origProdRoot Root of the original metadata of the source product. * @param polarization Polarization of the given swath. * @param swath Swath name. * @return The number of output lines. */ public static int getNumOfLines(final MetadataElement origProdRoot, final String polarization, final String swath) { final MetadataElement annotationElem = origProdRoot.getElement("annotation"); final MetadataElement[] annotationDataSetListElem = annotationElem.getElements(); for (MetadataElement dataSetListElem : annotationDataSetListElem) { final String elemName = dataSetListElem.getName(); if (elemName.contains(swath.toLowerCase()) && elemName.contains(polarization.toLowerCase())) { final MetadataElement productElem = dataSetListElem.getElement("product"); final MetadataElement imageAnnotationElem = productElem.getElement("imageAnnotation"); final MetadataElement imageInformationElem = imageAnnotationElem.getElement("imageInformation"); return imageInformationElem.getAttributeInt("numberOfLines"); } } return -1; }
private void masterMetaMapPut(final MetadataElement mstRoot, final Product product, final Map<String, CplxContainer> map) throws Exception { final String mapKey = Integer.toString(mstRoot.getAttributeInt(AbstractMetadata.ABS_ORBIT)); final String date = OperatorUtils.getAcquisitionDate(mstRoot); final Orbit orbit = new Orbit(mstRoot, orbitDegree);
public SpectraDataAsar(final Product product, final WaveProductType waveProductType) { super(product); setWaveProductType(waveProductType); final MetadataElement root = AbstractMetadata.getOriginalProductMetadata(product); final MetadataElement sph = root.getElement("SPH"); numDirBins = sph.getAttributeInt("NUM_DIR_BINS", 0); numWLBins = sph.getAttributeInt("NUM_WL_BINS", 0); firstDirBins = (float) sph.getAttributeDouble("FIRST_DIR_BIN", 0); dirBinStep = (float) sph.getAttributeDouble("DIR_BIN_STEP", 0); firstWLBin = (float) sph.getAttributeDouble("FIRST_WL_BIN", 0); lastWLBin = (float) sph.getAttributeDouble("LAST_WL_BIN", 0); final RasterDataNode rasterNode = product.getBandAt(0); numRecords = rasterNode.getRasterHeight() - 1; recordLength = rasterNode.getRasterWidth(); if (waveProductType == WaveProductType.WAVE_SPECTRA) { spectraMetadataRoot = root.getElement("OCEAN_WAVE_SPECTRA_MDS"); } else { spectraMetadataRoot = root.getElement("CROSS_SPECTRA_MDS"); } }
@Override public Product createProduct() throws IOException { final MetadataElement newRoot = addMetaData(); findImages(newRoot); final MetadataElement absRoot = newRoot.getElement(AbstractMetadata.ABSTRACT_METADATA_ROOT); determineProductDimensions(absRoot); final int sceneWidth = absRoot.getAttributeInt(AbstractMetadata.num_samples_per_line); final int sceneHeight = absRoot.getAttributeInt(AbstractMetadata.num_output_lines); final Product product = new Product(getProductName(), getProductType(), sceneWidth, sceneHeight); updateProduct(product, newRoot); addBands(product); addGeoCoding(product); product.setName(getProductName()); //product.setProductType(getProductType()); product.setDescription(getProductDescription()); ReaderUtils.addMetadataIncidenceAngles(product); ReaderUtils.addMetadataProductSize(product); return product; } }
@Override public Product createProduct() throws IOException { final MetadataElement newRoot = addMetaData(); addBinaryDataToProduct(newRoot); findImages(newRoot); final MetadataElement absRoot = newRoot.getElement(AbstractMetadata.ABSTRACT_METADATA_ROOT); final int sceneWidth = absRoot.getAttributeInt(AbstractMetadata.num_samples_per_line); final int sceneHeight = absRoot.getAttributeInt(AbstractMetadata.num_output_lines); final Product product = new Product(getProductName(), getProductType(), sceneWidth, sceneHeight); updateProduct(product, newRoot); addTiePointGrids(product); // empty addBands(product); addGeoCoding(product); product.setName(getProductName()); product.setProductType(getProductType()); product.setDescription(getProductDescription()); product.setFileLocation(getBaseDir()); ReaderUtils.addMetadataProductSize(product); return product; } }
private void addOrbitStateVectors(final MetadataElement absRoot, final MetadataElement globalElem) { final MetadataElement orbitVectorListElem = absRoot.getElement(AbstractMetadata.orbit_state_vectors); final ProductData.UTC referenceUTC = ReaderUtils.getTime(globalElem, "Reference_UTC", standardDateFormat); final int numPoints = globalElem.getAttributeInt("Number_of_State_Vectors"); for (int i = 0; i < numPoints; i++) { final double stateVectorTime = globalElem.getAttribute("State_Vectors_Times").getData().getElemDoubleAt(i); final ProductData.UTC orbitTime = new ProductData.UTC(referenceUTC.getMJD() + stateVectorTime / Constants.secondsInDay); final ProductData pos = globalElem.getAttribute("ECEF_Satellite_Position").getData(); final ProductData vel = globalElem.getAttribute("ECEF_Satellite_Velocity").getData(); final double satellitePositionX = pos.getElemDoubleAt(3 * i); final double satellitePositionY = pos.getElemDoubleAt(3 * i + 1); final double satellitePositionZ = pos.getElemDoubleAt(3 * i + 2); final double satelliteVelocityX = vel.getElemDoubleAt(3 * i); final double satelliteVelocityY = vel.getElemDoubleAt(3 * i + 1); final double satelliteVelocityZ = vel.getElemDoubleAt(3 * i + 2); final MetadataElement orbitVectorElem = new MetadataElement(AbstractMetadata.orbit_vector + (i + 1)); orbitVectorElem.setAttributeUTC(AbstractMetadata.orbit_vector_time, orbitTime); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_pos, satellitePositionX); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_pos, satellitePositionY); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_pos, satellitePositionZ); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_x_vel, satelliteVelocityX); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_y_vel, satelliteVelocityY); orbitVectorElem.setAttributeDouble(AbstractMetadata.orbit_vector_z_vel, satelliteVelocityZ); orbitVectorListElem.addElement(orbitVectorElem); } }