Exemplo n.º 1
0
  private void writeMetadataAttribute(int locationID, MetadataAttribute attribute)
      throws IOException {
    int productDataType = attribute.getDataType();
    if (attribute.getData() instanceof ProductData.ASCII
        || attribute.getData() instanceof ProductData.UTC) {
      createScalarAttribute(locationID, attribute.getName(), attribute.getData().getElemString());
    } else if (attribute.getData().isScalar()) {
      createScalarAttribute(
          locationID,
          attribute.getName(),
          getH5DataType(productDataType),
          attribute.getData().getElems());
    } else {
      createArrayAttribute(
          locationID,
          attribute.getName(),
          getH5DataType(productDataType),
          attribute.getData().getNumElems(),
          attribute.getData().getElems());
    }
    if (_metadataAnnotated) {
      if (attribute.getUnit() != null) {
        createScalarAttribute(locationID, attribute.getName() + ".unit", attribute.getUnit());
      }

      if (attribute.getDescription() != null) {
        createScalarAttribute(
            locationID, attribute.getName() + ".descr", attribute.getDescription());
      }
    }
  }