private static boolean isNumericType(MetadataAttribute attribute) { return ProductData.isIntType(attribute.getDataType()) || ProductData.isFloatingPointType(attribute.getDataType()); }
private static int[] getIntArray(final MetadataElement elem, final String tag) { final MetadataAttribute attribute = elem.getAttribute(tag); if (attribute == null) { throw new OperatorException(tag + " attribute not found"); } int[] array = null; if (attribute.getDataType() == ProductData.TYPE_ASCII) { final String dataStr = attribute.getData().getElemString(); final String[] items = dataStr.split(" "); array = new int[items.length]; for (int i = 0; i < items.length; i++) { try { array[i] = Integer.parseInt(items[i]); } catch (NumberFormatException e) { throw new OperatorException("Failed in getting" + tag + " array"); } } } return array; }
private static int[] getIntArray(final MetadataElement elem, final String tag) { final MetadataAttribute attribute = elem.getAttribute(tag); if (attribute == null) { throw new OperatorException(tag + " attribute not found"); } int[] array = null; if (attribute.getDataType() == ProductData.TYPE_ASCII) { final String dataStr = attribute.getData().getElemString(); final String[] items = dataStr.split(" "); array = new int[items.length]; for (int i = 0; i < items.length; i++) { try { array[i] = Integer.parseInt(items[i]); } catch (NumberFormatException e) { throw new OperatorException("Failed in getting" + tag + " array"); } } } return array; }
public MetadataTableLeaf(MetadataAttribute attribute) { this(attribute.getName(), attribute.getDataType(), attribute.getData(), attribute.getUnit(), attribute.getDescription()); }
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 int dataType = attrib.getDataType(); if (dataType == ProductData.TYPE_FLOAT32 || dataType == ProductData.TYPE_FLOAT64) { newGroup.addAttribute(new Attribute(attrib.getName(), elem.getAttributeDouble(attrib.getName(), 0)));