private static void addMetadataElements(final Element element, MetadataElement mdElem) { final List metadataElements = element.getChildren(DimapProductConstants.TAG_METADATA_ELEMENT); for (Object child : metadataElements) { final Element metadataElement = (Element) child; final String elemName = metadataElement.getAttributeValue(DimapProductConstants.ATTRIB_NAME); if (elemName == null || elemName.length() == 0) { continue; } final MetadataElement newMdElem = new MetadataElement(elemName); newMdElem.setDescription(metadataElement.getAttributeValue(DimapProductConstants.ATTRIB_DESCRIPTION)); addMetadataAttributes(metadataElement, newMdElem); addMetadataElements(metadataElement, newMdElem); mdElem.addElement(newMdElem); } }
private void addAnnotationDataset(Product product) { final MetadataElement mdElem = product.getMetadataRoot(); if (mdElem == null) { return; } final Element datasetSourcesElem = getRootElement().getChild(DimapProductConstants.TAG_DATASET_SOURCES); if (datasetSourcesElem == null) { return; } final Element element = datasetSourcesElem.getChild(DimapProductConstants.TAG_METADATA_ELEMENT); if (element == null) { return; } mdElem.setDescription(element.getAttributeValue(DimapProductConstants.ATTRIB_DESCRIPTION)); addMetadataAttributes(element, mdElem); addMetadataElements(element, mdElem); }
private MetadataElement createMetadataElement(String name, String description, Property[] properties) { MetadataElement element = new MetadataElement(name); element.setDescription(description); for (Property property : properties) { element.addAttribute(new MetadataAttribute(property.getName(), ProductData.createInstance(property.getValueAsText()), true)); } return element; }
protected void cloneMetadataElements(MetadataElement sourceRoot, MetadataElement destRoot, int level) { for (int i = 0; i < sourceRoot.getNumElements(); i++) { MetadataElement sourceElement = sourceRoot.getElementAt(i); if (level > 0 || isNodeAccepted(sourceElement.getName())) { MetadataElement element = new MetadataElement(sourceElement.getName()); element.setDescription(sourceElement.getDescription()); destRoot.addElement(element); cloneMetadataElementsAndAttributes(sourceElement, element, level + 1); } } }
public MetadataElement createDeepClone() { MetadataElement clone = new MetadataElement(getName()); clone.setDescription(getDescription()); MetadataAttribute[] attributes = getAttributes(); for (MetadataAttribute attribute : attributes) { clone.addAttribute(attribute.createDeepClone()); } MetadataElement[] elements = getElements(); for (MetadataElement element : elements) { clone.addElement(element.createDeepClone()); } return clone; }
geo.setDescription(METADATA_GEOMETRIC_NODE_DESCRIPTION); final GeometricData geoData = landsatHeader.getGeoData(); List<MetadataAttribute> attributContainer = new ArrayList<MetadataAttribute>(); geoPointElement.setDescription(geoPoint.toString()); List<MetadataAttribute> geoAttri = new ArrayList<MetadataAttribute>(); geoAttri.add(createAttribute(LandsatConstants.geoPointsAttributes.LONGITUDE.toString(),
adminEle.setDescription(METADATA_ADMINISTRATIV_NODE_DESCRIPTION);
private static void addAttribute(Variable variable, MetadataElement valuesElem, int maxNumValuesRead) { final DataType ncDataType = variable.getDataType(); final boolean unsigned = variable.isUnsigned(); final boolean rasterDataOnly = false; final int productDataType = DataTypeUtils.getEquivalentProductDataType(ncDataType, unsigned, rasterDataOnly); if (productDataType == -1) { return; } final Array values; try { long variableSize = variable.getSize(); if (variableSize >= maxNumValuesRead && maxNumValuesRead >= 0) { values = variable.read(new int[]{0}, new int[]{maxNumValuesRead}); valuesElem.setDescription("Showing " + maxNumValuesRead + " of " + variableSize + " values."); } else { values = variable.read(); } final ProductData pd = ReaderUtils.createProductData(productDataType, values); final MetadataAttribute attribute = new MetadataAttribute("data", pd, true); valuesElem.addAttribute(attribute); } catch (IOException | InvalidRangeException e) { Debug.trace(e); } } }
rad.setDescription(RADIANCE_DESCRIPTION); final double[] radData = new double[10]; // minRadiance, maxRadiance, Gain, Bias, nomMinRadiance, nomMaxRadiance
private void addMetadata(Product product) { final MetadataElement metadataRoot = product.getMetadataRoot(); metadataRoot.setDescription("metadata-desc"); final ProductData productData1 = ProductData.createInstance(ProductData.TYPE_INT16); productData1.setElemInt(123); final MetadataAttribute attribute1 = new MetadataAttribute("attrib1", productData1, false); metadataRoot.addAttribute(attribute1); final ProductData productData2 = ProductData.createInstance(new float[]{1, 2, 3, 4, 5, 6}); final MetadataAttribute attribute2 = new MetadataAttribute("attrib2", productData2, true); metadataRoot.addAttribute(attribute2); final ProductData productData3 = ProductData.createInstance(new double[]{7, 8, 9, 10, 11, 12}); final MetadataAttribute attribute3 = new MetadataAttribute("attrib3", productData3, false); metadataRoot.addAttribute(attribute3); final MetadataElement mdElem1 = new MetadataElement("mdElemName1"); mdElem1.setDescription("mdElem1-desc"); metadataRoot.addElement(mdElem1); final ProductData productData4 = ProductData.createInstance(new double[]{23.547, -8.0001, -59.989898}); final MetadataAttribute attribute4 = new MetadataAttribute("attrib4", productData4, true); mdElem1.addAttribute(attribute4); MetadataAttribute stringAttrib = new MetadataAttribute("StringAttrib", ProductData.createInstance("StringAttribValue"), true); mdElem1.addAttribute(stringAttrib); final ProductData productData5 = ProductData.createInstance(ProductData.TYPE_UTC); productData5.setElemIntAt(0, 123); productData5.setElemIntAt(1, 234); productData5.setElemIntAt(2, 345); final MetadataAttribute attribute5 = new MetadataAttribute("attrib5", productData5, false); metadataRoot.addAttribute(attribute5); }