public MetadataElement getAsMetadata() { final MetadataElement root = new MetadataElement(META_ELEMENT_NAME); addPCDData(root); return root; }
/** * Initialize the tests */ @Override protected void setUp() { _testGroup = new MetadataElement("test"); }
public static MetadataElement readVariableDescriptions(final List<Variable> variableList, String elementName, int maxNumValuesRead) { MetadataElement metadataElement = new MetadataElement(elementName); for (Variable variable : variableList) { metadataElement.addElement(createMetadataElement(variable, maxNumValuesRead)); } return metadataElement; }
public void addGlobalMetadata(Product product) { final MetadataElement globalElement = new MetadataElement("Global_Attributes"); addAttributesToElement(globalAttributes, globalElement); final MetadataElement metadataRoot = product.getMetadataRoot(); metadataRoot.addElement(globalElement); }
static MetadataElement createSourceMetaElement(String productName, int index) { final MetadataElement productElement = new MetadataElement("source." + Integer.toString(index)); final MetadataAttribute nameAttribute = new MetadataAttribute("name", new ProductData.ASCII(productName), true); productElement.addAttribute(nameAttribute); return productElement; }
private void initGraphMetadata() { final MetadataElement metadataRoot = targetProduct.getMetadataRoot(); MetadataElement targetGraphME = metadataRoot.getElement(PROCESSING_GRAPH_ELEMENT_NAME); if (targetGraphME == null) { targetGraphME = new MetadataElement(PROCESSING_GRAPH_ELEMENT_NAME); metadataRoot.addElement(targetGraphME); } convertOperatorContextToMetadata(this, targetGraphME); }
private static void addIDNode(final MetadataElement absRoot, final MetadataElement identNode, final String title, final String tag) { final MetadataAttribute attrib = absRoot.getAttribute(tag); if (attrib == null) return; final String value = title + ": " + attrib.getData().getElemString(); final MetadataElement newAttrib = new MetadataElement(value); identNode.addElement(newAttrib); }
private MetadataElement getMetadataElementSave(Product product, String name) { final MetadataElement metadataElement = product.getMetadataRoot().getElement(name); final MetadataElement namedElem; if (metadataElement == null) { namedElem = new MetadataElement(name); product.getMetadataRoot().addElement(namedElem); } else { namedElem = metadataElement; } return namedElem; }
private void prepareProduct() { final MetadataElement tsRoot = new MetadataElement(AbstractTimeSeries.TIME_SERIES_ROOT_NAME); testProduct.getMetadataRoot().addElement(tsRoot); final MetadataElement productLocations = new MetadataElement(AbstractTimeSeries.PRODUCT_LOCATIONS); tsRoot.addElement(productLocations); final MetadataElement sourcePaths = new MetadataElement(AbstractTimeSeries.SOURCE_PRODUCT_PATHS); tsRoot.addElement(sourcePaths); addProductLocationElements(productLocations); addSourceProductPathsElemets(sourcePaths); }
private void addMetaData(final Product product) throws IOException, IllegalCeosFormatException { final MetadataElement metadata = new MetadataElement("SPH"); metadata.addElement(leaderFile.getMapProjectionMetadata()); metadata.addElement(leaderFile.getRadiometricMetadata()); metadata.addElement(leaderFile.getPlatformMetadata()); addSummaryMetadata(metadata); product.getMetadataRoot().addElement(metadata); final MetadataElement volumeDescriptor = new MetadataElement("VOLUME_DESCRIPTOR"); volumeDirectoryFile.assignMetadataTo(volumeDescriptor); product.getMetadataRoot().addElement(volumeDescriptor); }
private void addInputProductPathsToMetadata(Product product) { final MetadataElement productsElement = new MetadataElement("Input products"); final String[] absoluteInputProductPaths = getAbsoluteInputProductPaths(); for (int i = 0; i < absoluteInputProductPaths.length; i++) { String inputProductAbsPath = absoluteInputProductPaths[i]; final ProductData pathData = ProductData.createInstance(inputProductAbsPath); final MetadataAttribute pathAttribute = new MetadataAttribute("product_" + i, pathData, true); productsElement.addAttribute(pathAttribute); } product.getMetadataRoot().addElement(productsElement); }
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; }
private void addSynthesisMetadataElement(List<Attribute> rootMetadata, final Product product, String metadataElementName) { final MetadataElement metadataElement = new MetadataElement(metadataElementName); for (Attribute attribute : rootMetadata) { metadataElement.addAttribute(new MetadataAttribute(attribute.getName(), ProductData.createInstance(ProbaVUtils.getAttributeValue(attribute)), true)); } product.getMetadataRoot().addElement(metadataElement); }
/** * Tests the functionality of getNamedNode. */ public void testGetNamedNode() { ProductNodeEvent event; MetadataElement testNode; testNode = new MetadataElement("test_me"); event = new ProductNodeEvent(testNode, 0); assertSame(testNode, event.getSourceNode()); } }
private void addSynthesisMetadataElement(List<Attribute> rootMetadata, final Product product, String metadataElementName) { final MetadataElement metadataElement = new MetadataElement(metadataElementName); for (Attribute attribute : rootMetadata) { metadataElement.addAttribute(new MetadataAttribute(attribute.getName(), ProductData.createInstance(ProbaVUtils.getAttributeValue(attribute)), true)); } product.getMetadataRoot().addElement(metadataElement); }
private void assignSPH(MetadataElement metadataRoot) throws IOException, IllegalCeosFormatException { final MetadataElement sphElement = new MetadataElement("SPH"); metadataRoot.addElement(sphElement); sphElement.addElement(getMapProjectionMetadata()); sphElement.addElement(getRadiometricMetadata()); sphElement.addElement(getPlatformMetadata()); }
private void addMetadata(Product sp) { final MetadataElement meta1 = new MetadataElement("meta1"); meta1.addAttribute(new MetadataAttribute("attrib1", ProductData.createInstance("value"), true)); final MetadataElement meta2 = new MetadataElement("meta2"); final MetadataElement meta2_1 = new MetadataElement("meta2_1"); meta2_1.addAttribute(new MetadataAttribute("attrib2_1", ProductData.createInstance("meta2_1_value"), true)); meta2.addElement(meta2_1); final MetadataElement metadataRoot = sp.getMetadataRoot(); metadataRoot.addAttribute(new MetadataAttribute("attribRoot", ProductData.createInstance("rootValue"), true)); metadataRoot.addElement(meta1); metadataRoot.addElement(meta2); }
public void testAssignMetadataTo() throws IOException, IllegalCeosFormatException { final BaseRecord record = new BaseRecord(_reader, _prefix.length()); final MetadataElement elem = new MetadataElement("elem"); record.assignMetadataTo(elem, null); assertMetadata(elem); assertEquals(0, elem.getNumElements()); assertEquals(6, elem.getNumAttributes()); }
public void testAssignMetadata() throws IOException, IllegalCeosFormatException { final VolumeDescriptorRecord record = new VolumeDescriptorRecord(_reader, _prefix.length()); final MetadataElement volumeMetadata = new MetadataElement("VOLUME_DESCRIPTOR"); record.assignMetadataTo(volumeMetadata, "suffix"); assertEquals(23, volumeMetadata.getNumAttributes()); assertEquals(0, volumeMetadata.getNumElements()); assertMetadata(volumeMetadata); }
private void addProductLocationElements(MetadataElement productLocations) { final MetadataElement location0 = new MetadataElement(AbstractTimeSeries.PRODUCT_LOCATIONS + "." + 0); final MetadataElement location1 = new MetadataElement(AbstractTimeSeries.PRODUCT_LOCATIONS + "." + 1); productLocations.addElement(location0); productLocations.addElement(location1); location0.addAttribute(new MetadataAttribute(AbstractTimeSeries.PL_PATH, ProductData.createInstance(absoluteProductPath1), true)); location0.addAttribute(new MetadataAttribute(AbstractTimeSeries.PL_TYPE, ProductData.createInstance("FILE"), true)); location1.addAttribute(new MetadataAttribute(AbstractTimeSeries.PL_PATH, ProductData.createInstance(absoluteProductPath2), true)); location1.addAttribute(new MetadataAttribute(AbstractTimeSeries.PL_TYPE, ProductData.createInstance("FILE"), true)); }