protected void validateMetadata(final Product trgProduct) throws Exception { final MetadataElement absRoot = AbstractMetadata.getAbstractedMetadata(trgProduct); final MetadataAttribute[] attribs = absRoot.getAttributes(); for(MetadataAttribute attrib : attribs) { System.out.println(attrib.getName() +"= "+ attrib.getData().toString()); } } }
private void writeAttributes(PrintWriter out, MetadataElement element) { final MetadataAttribute[] attributes = element.getAttributes(); for (MetadataAttribute attribute : attributes) { out.print(createAttributeName(attribute) + "\t"); out.print(attribute.getData().getElemString() + "\t"); out.print(attribute.getUnit() + "\t"); out.print(attribute.getDescription() + "\t\n"); } final MetadataElement[] subElements = element.getElements(); for (MetadataElement subElement : subElements) { writeAttributes(out, subElement); } }
private static void searchMetadata(final MetadataElement resultElem, final MetadataElement elem, final String tag) { final MetadataElement[] elemList = elem.getElements(); for (MetadataElement e : elemList) { searchMetadata(resultElem, e, tag); } final MetadataAttribute[] attribList = elem.getAttributes(); for (MetadataAttribute attrib : attribList) { if (attrib.getName().toUpperCase().contains(tag)) { final MetadataAttribute newAttrib = attrib.createDeepClone(); newAttrib.setDescription(getAttributePath(attrib)); resultElem.addAttribute(newAttrib); } } }
private static MetadataTableElement[] getChildrenElementsFromElement(MetadataElement metadataElement) { MetadataElement[] elements = metadataElement.getElements(); MetadataAttribute[] attributes = metadataElement.getAttributes(); List<MetadataTableElement> metadataTableElementList = new ArrayList<>(); for (MetadataElement element : elements) { metadataTableElementList.add(new MetadataTableInnerElement(element)); } for (MetadataAttribute attribute : attributes) { final long dataElemSize = attribute.getNumDataElems(); if (dataElemSize > 1) { final int dataType = attribute.getDataType(); ProductData data = attribute.getData(); if ((ProductData.isFloatingPointType(dataType) || ProductData.isIntType(dataType)) && !(data instanceof ProductData.UTC)) { addMetadataAttributes(attribute, data, metadataTableElementList); } else { metadataTableElementList.add(new MetadataTableLeaf(attribute)); } } else { metadataTableElementList.add(new MetadataTableLeaf(attribute)); } } return metadataTableElementList.toArray(new MetadataTableElement[metadataTableElementList.size()]); }
final MetadataElement summaryElem = origProductMetadata.getElement("Summary Information"); if (summaryElem != null) { for (MetadataAttribute sum : summaryElem.getAttributes()) { if (sum.getName().contains(tagInSummary)) { summaryTime = AbstractMetadata.parseUTC(
private static void searchMetadataValue(final MetadataElement resultElem, final MetadataElement elem, final String value) { final MetadataElement[] elemList = elem.getElements(); for (MetadataElement e : elemList) { searchMetadataValue(resultElem, e, value); } final MetadataAttribute[] attribList = elem.getAttributes(); for (MetadataAttribute attrib : attribList) { if (attrib.getData().getElemString().toUpperCase().contains(value)) { final MetadataAttribute newAttrib = attrib.createDeepClone(); newAttrib.setDescription(SearchMetadataAction.getAttributePath(attrib)); resultElem.addAttribute(newAttrib); } } } }
MetadataElement valuesAzimuthElement = azimuthElement.getElement("Values_List"); if(valuesAzimuthElement == null) continue; MetadataAttribute[] azAnglesAttributes = valuesAzimuthElement.getAttributes(); if(azAnglesAttributes == null) continue; MetadataElement valuesZenithElement = zenithElement.getElement("Values_List"); if(valuesZenithElement == null) continue; MetadataAttribute[] zenAnglesAttributes = valuesZenithElement.getAttributes(); if(zenAnglesAttributes == null) continue;
coefficients = new RationalCoefficients(); String data, attrName; for (MetadataAttribute attribute : currentElement.getAttributes()) { attrName = attribute.getName(); data = currentElement.getAttributeString(attrName, "");
final MetadataElement summaryElem = origProductMetadata.getElement("Summary Information"); if (summaryElem != null) { for (MetadataAttribute sum : summaryElem.getAttributes()) { if (sum.getName().contains(tagInSummary)) { summaryTime = AbstractMetadata.parseUTC( for (MetadataAttribute workRep : workReportElem.getAttributes()) { if (workRep.getName().contains("SceneCenterDateTime")) { final ProductData.UTC centreTime = AbstractMetadata.parseUTC(
MetadataElement valuesAzimuthElement = azimuthElement.getElement("Values_List"); if (valuesAzimuthElement == null) continue; MetadataAttribute[] azAnglesAttributes = valuesAzimuthElement.getAttributes(); if (azAnglesAttributes == null) continue; MetadataElement valuesZenithElement = zenithElement.getElement("Values_List"); if (valuesZenithElement == null) continue; MetadataAttribute[] zenAnglesAttributes = valuesZenithElement.getAttributes(); if (zenAnglesAttributes == null) continue;
/** * Helper method that copies the child nodes of a metadata element as child nodes * of another metadata element. * * @param source The metadata element holding the nodes to be copied * @param target The destination metadata element */ public static void CopyChildElements(MetadataElement source, MetadataElement target) { Assert.notNull(source); Assert.notNull(target); MetadataAttribute[] attributes = source.getAttributes(); if (attributes != null) { for (MetadataAttribute attribute : attributes) { if (!target.containsAttribute(attribute.getName()) && !attribute.getName().contains(":")) { target.addAttribute(attribute); } } } while (source.getNumElements() > 0) { MetadataElement currentElement = source.getElementAt(0); target.addElement(currentElement); source.removeElement(currentElement); } }
return null; MetadataAttribute[] azAnglesAttributes = valuesAzimuthElement.getAttributes(); if (azAnglesAttributes == null) { return null; return null; MetadataAttribute[] zenAnglesAttributes = valuesZenithElement.getAttributes(); if (zenAnglesAttributes == null) { return null;
private void updateMetadata() { final MetadataElement abstractedMetadata = AbstractMetadata.getAbstractedMetadata(targetProduct); if(abstractedMetadata != null) { abstractedMetadata.setAttributeInt("collocated_stack", 1); } final MetadataElement inputElem = ProductInformation.getInputProducts(targetProduct); getBaselines(sourceProduct, targetProduct); for (Product srcProduct : sourceProduct) { if (srcProduct == masterProduct) continue; final MetadataElement slvInputElem = ProductInformation.getInputProducts(srcProduct); final MetadataAttribute[] slvInputProductAttrbList = slvInputElem.getAttributes(); for (MetadataAttribute attrib : slvInputProductAttrbList) { final MetadataAttribute inputAttrb = AbstractMetadata.addAbstractedAttribute(inputElem, "InputProduct", ProductData.TYPE_ASCII, "", ""); inputAttrb.getData().setElems(attrib.getData().getElemString()); } } }
/** * Update target product metadata. */ private void updateTargetProductMetadata() { final MetadataElement abstractedMetadata = AbstractMetadata.getAbstractedMetadata(targetProduct); if(abstractedMetadata != null) { abstractedMetadata.setAttributeInt("collocated_stack", 1); } final MetadataElement absTgt = AbstractMetadata.getAbstractedMetadata(targetProduct); AbstractMetadata.setAttribute(absTgt, AbstractMetadata.coregistered_stack, 1); final MetadataElement inputElem = ProductInformation.getInputProducts(targetProduct); for(Product slaveProduct : slaveProducts) { final MetadataElement slvInputElem = ProductInformation.getInputProducts(slaveProduct); final MetadataAttribute[] slvInputProductAttrbList = slvInputElem.getAttributes(); for (MetadataAttribute attrib : slvInputProductAttrbList) { final MetadataAttribute inputAttrb = AbstractMetadata.addAbstractedAttribute( inputElem, "InputProduct", ProductData.TYPE_ASCII, "", ""); inputAttrb.getData().setElems(attrib.getData().getElemString()); } } CreateStackOp.getBaselines(sourceProduct, targetProduct); }
final MetadataAttribute[] inputProductAttrbList = inputElem.getAttributes(); boolean found = false; for (MetadataAttribute attrib : inputProductAttrbList) {
} else { final MetadataAttribute[] attribList = warpDataElem.getAttributes(); for (MetadataAttribute attrib : attribList) { warpDataElem.removeAttribute(attrib);
} else { final MetadataAttribute[] attribList = warpDataElem.getAttributes(); for (MetadataAttribute attrib : attribList) { warpDataElem.removeAttribute(attrib);
final MetadataAttribute[] polList = polarisationList.getAttributes(); for (int i = 0; i < polList.length; ++i) { AbstractMetadata.setAttribute(absRoot, AbstractMetadata.polarTags[i], polList[i].getData().getElemString());