Beispiel #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());
      }
    }
  }
 private void addMask(
     MetadataAttribute metadataSample, String expression, Color color, Product product) {
   final ProductNodeGroup<Mask> maskGroup = product.getMaskGroup();
   final int width = product.getSceneRasterWidth();
   final int height = product.getSceneRasterHeight();
   Mask mask =
       Mask.BandMathsType.create(
           metadataSample.getName().toLowerCase(),
           metadataSample.getDescription(),
           width,
           height,
           expression,
           color,
           0.5);
   maskGroup.add(mask);
 }