public void assignMetadataTo(final MetadataElement root, final String suffix) { final MetadataElement elem = createMetadataElement("FilePointerRecord", suffix); root.addElement(elem); super.assignMetadataTo(elem); } }
private static MetadataElement getBaselinesElem(final MetadataElement abstractedMetadata) { MetadataElement baselinesElem = abstractedMetadata.getElement("Baselines"); if (baselinesElem == null) { baselinesElem = new MetadataElement("Baselines"); abstractedMetadata.addElement(baselinesElem); } return baselinesElem; }
public void assignMetadataTo(MetadataElement rootElem, int count) { final MetadataElement imgDescElem = new MetadataElement("Image Descriptor " + count); imageFDR.assignMetadataTo(imgDescElem); rootElem.addElement(imgDescElem); if (imageRecords.length > 0 && imageRecords[0] != null) { final MetadataElement imgRecElem = new MetadataElement("Image Record "); imageRecords[0].assignMetadataTo(imgRecElem); imgDescElem.addElement(imgRecElem); } }
public MetadataElement getRootElement() { if (rootElement.getNumElements() == 0) { for (SpotDimapMetadata mf : componentMetadata) { rootElement.addElement(mf.getRootElement()); } } return rootElement; }
public static void addMetadata(MetadataElement sphElem, BinaryRecord rec, String name) { if (rec != null) { final MetadataElement metadata = new MetadataElement(name); rec.assignMetadataTo(metadata); sphElem.addElement(metadata); } } }
public MetadataElement toMetadataElement() { if (!isParsed) { parse(); } MetadataElement element = new MetadataElement("JP2 Metadata"); if (imageInfo != null) { element.addElement(imageInfo.toMetadataElement()); } if (codeStreamInfo != null) { element.addElement(codeStreamInfo.toMetadataElement()); } return element; }
public static MetadataElement read(NITFReader reader) throws IOException, NITFException { MetadataElement root = new MetadataElement("NITF Metadata"); Record record = reader.getRecord(); // File header FileHeader header = record.getHeader(); root.addElement(readHeader(header)); // Image subheaders ImageSegment[] imageSegments = record.getImages(); root.addElement(readImageSubheaders(imageSegments)); // RPC00B TRE DESegment[] dataExtensions = record.getDataExtensions(); root.addElement(readDataExtensions(dataExtensions)); return root; }
private void addBandAbstractedMetadata(final MetadataElement origProdRoot) throws IOException { MetadataElement annotationElement = origProdRoot.getElement("annotation"); if (annotationElement == null) { annotationElement = new MetadataElement("annotation"); origProdRoot.addElement(annotationElement); } if (OCNReader != null) { // add netcdf metadata for OCN product OCNReader.addNetCDFMetadata(annotationElement); } }
public static MetadataElement addAttributes(final MetadataElement parentElem, final String elemName, final List<Attribute> attribList) { final MetadataElement globalElem = new MetadataElement(elemName); parentElem.addElement(globalElem); for (Attribute at : attribList) { createMetadataAttributes(globalElem, at, at.getName()); } return globalElem; }
public static Product createProduct4() { Product product = new Product("Test_Product_4", "Test_Type_4", 512, 512); product.getMetadataRoot().addElement(new MetadataElement("Global_Attributes")); product.getMetadataRoot().addElement(new MetadataElement("Local_Attributes")); product.setModified(false); double sx = 10.0 / product.getSceneRasterWidth(); VirtualBand band4 = new VirtualBand("Band_4", ProductData.TYPE_FLOAT64, 512, 512, "cos(ampl((X-256)/100, (Y-256)/100))"); product.addBand(band4); AffineTransform at4 = new AffineTransform(); at4.scale(0.5 * sx, 0.5 * sx); at4.rotate(-0.2, 5.0, 5.0); at4.translate(256, 256); product.setSceneGeoCoding(new ATGeoCoding(at4)); return product; }
private static void addDopCoef(final MetadataElement dopListElem, final BinaryRecord rec, final String tag, int cnt) { final MetadataElement coefElem = new MetadataElement(AbstractMetadata.coefficient + '.' + cnt); dopListElem.addElement(coefElem); AbstractMetadata.addAbstractedAttribute(coefElem, AbstractMetadata.dop_coef, ProductData.TYPE_FLOAT64, "", tag); AbstractMetadata.setAttribute(coefElem, AbstractMetadata.dop_coef, rec.getAttributeDouble(tag)); }
protected static void addSRGRCoef(final MetadataElement srgrListElem, final BinaryRecord rec, final String tag, int cnt) { final MetadataElement coefElem = new MetadataElement(AbstractMetadata.coefficient + '.' + cnt); srgrListElem.addElement(coefElem); AbstractMetadata.addAbstractedAttribute(coefElem, AbstractMetadata.srgr_coef, ProductData.TYPE_FLOAT64, "", "SRGR Coefficient"); AbstractMetadata.setAttribute(coefElem, AbstractMetadata.srgr_coef, rec.getAttributeDouble(tag)); }
public static void addGroups(final MetadataElement parentElem, final Group parentGroup) { final List<Group> groupList = parentGroup.getGroups(); for (Group grp : groupList) { final MetadataElement newElem = new MetadataElement(grp.getShortName()); parentElem.addElement(newElem); // recurse addGroups(newElem, grp); } addAttributes(parentElem, parentGroup); }
public MetadataElement toMetadataElement() { MetadataElement element = new MetadataElement("Image Info"); element.addAttribute(new MetadataAttribute("x0", ProductData.ASCII.createInstance(String.valueOf(x0)), false)); element.addAttribute(new MetadataAttribute("y0", ProductData.ASCII.createInstance(String.valueOf(y0)), false)); element.addAttribute(new MetadataAttribute("width", ProductData.ASCII.createInstance(String.valueOf(width)), false)); element.addAttribute(new MetadataAttribute("height", ProductData.ASCII.createInstance(String.valueOf(height)), false)); element.addAttribute(new MetadataAttribute("numComponents", ProductData.ASCII.createInstance(String.valueOf(getNumComponents())), false)); for (ImageInfoComponent component : components) { element.addElement(component.toMetadataElement()); } return element; }
private void addMetaData(final Product product) throws IOException { final MetadataElement root = AbstractMetadata.addOriginalProductMetadata(product.getMetadataRoot()); final MetadataElement leadMetadata = new MetadataElement("Leader"); leaderFile.addLeaderMetadata(leadMetadata); root.addElement(leadMetadata); final MetadataElement volMetadata = new MetadataElement("Volume"); volumeDirectoryFile.assignMetadataTo(volMetadata); root.addElement(volMetadata); int c = 1; for (final ERSImageFile imageFile : imageFiles) { imageFile.assignMetadataTo(root, c++); } addSummaryMetadata(findFile(ERSConstants.SUMMARY_FILE_NAME), "Summary Information", root); addAbstractedMetadataHeader(product, product.getMetadataRoot()); }
private void copySlaveMetadata(final Product slaveProduct) { final MetadataElement targetSlaveMetadataRoot = AbstractMetadata.getSlaveMetadata( targetProduct.getMetadataRoot()); final MetadataElement slvAbsMetadata = AbstractMetadata.getAbstractedMetadata(slaveProduct); if (slvAbsMetadata != null) { final String timeStamp = StackUtils.createBandTimeStamp(slaveProduct); final MetadataElement targetSlaveMetadata = new MetadataElement(slaveProduct.getName() + timeStamp); targetSlaveMetadataRoot.addElement(targetSlaveMetadata); ProductUtils.copyMetadata(slvAbsMetadata, targetSlaveMetadata); } }
private void copySlaveMetadata() { final MetadataElement targetSlaveMetadataRoot = AbstractMetadata.getSlaveMetadata(targetProduct.getMetadataRoot()); for (Product prod : sourceProduct) { if (prod != masterProduct) { final MetadataElement slvAbsMetadata = AbstractMetadata.getAbstractedMetadata(prod); if (slvAbsMetadata != null) { final String timeStamp = StackUtils.createBandTimeStamp(prod); final MetadataElement targetSlaveMetadata = new MetadataElement(prod.getName() + timeStamp); targetSlaveMetadataRoot.addElement(targetSlaveMetadata); ProductUtils.copyMetadata(slvAbsMetadata, targetSlaveMetadata); } } } }
protected static void addDopplerCentroidCoefficients(final MetadataElement absRoot, final BinaryRecord sceneRec) { if (sceneRec == null) return; final MetadataElement dopCoefficientsElem = absRoot.getElement(AbstractMetadata.dop_coefficients); final MetadataElement dopListElem = new MetadataElement(AbstractMetadata.dop_coef_list); dopCoefficientsElem.addElement(dopListElem); final ProductData.UTC utcTime = absRoot.getAttributeUTC(AbstractMetadata.first_line_time, AbstractMetadata.NO_METADATA_UTC); dopListElem.setAttributeUTC(AbstractMetadata.dop_coef_time, utcTime); AbstractMetadata.addAbstractedAttribute(dopListElem, AbstractMetadata.slant_range_time, ProductData.TYPE_FLOAT64, "ns", "Slant Range Time"); AbstractMetadata.setAttribute(dopListElem, AbstractMetadata.slant_range_time, 0.0); addDopCoef(dopListElem, sceneRec, "Cross track Doppler frequency centroid constant term", 1); addDopCoef(dopListElem, sceneRec, "Cross track Doppler frequency centroid linear term", 2); addDopCoef(dopListElem, sceneRec, "Cross track Doppler frequency centroid quadratic term", 3); }
@Override protected MetadataElement addMetaData() throws IOException { final MetadataElement root = new MetadataElement(Product.METADATA_ROOT_NAME); final MetadataElement origProdRoot = AbstractMetadata.addOriginalProductMetadata(root); final Element rootElement = xmlDoc.getRootElement(); AbstractMetadataIO.AddXMLMetadata(rootElement, origProdRoot); addMetadataFiles(getRootFolder() + "metadata", origProdRoot); final MetadataElement calibrationElem = new MetadataElement("calibration"); origProdRoot.addElement(calibrationElem); addMetadataFiles(getRootFolder() + "metadata/calibration", calibrationElem); addAbstractedMetadataHeader(root); return root; }
protected static void updateProduct(final Product product, final MetadataElement newRoot) { final MetadataElement root = product.getMetadataRoot(); for(MetadataElement elem : newRoot.getElements()) { root.addElement(elem); } final MetadataElement absRoot = AbstractMetadata.getAbstractedMetadata(product); product.setStartTime(absRoot.getAttributeUTC(AbstractMetadata.first_line_time)); product.setEndTime(absRoot.getAttributeUTC(AbstractMetadata.last_line_time)); product.setProductType(absRoot.getAttributeString(AbstractMetadata.PRODUCT_TYPE)); product.setDescription(absRoot.getAttributeString(AbstractMetadata.SPH_DESCRIPTOR)); }