How to generate missing Abstracted Metadata (java)

Hello all,

I have a funny problem with some missing abstracted metadata. I read a bunch of TIFF TerraSAR-X products and wrote them to BEAM-DIMAP. Some of these files don’t have Abstracted_Metadata in their Metadata Elements. This is a problem when trying to create a stack of the products with the InSAR CreateStackOp.

However, when I open one of these problematic .dim files in the SNAP GUI, something odd happens. In the list of Metadata Elements, at first I see no Abstracted_Metadata (as expected). However, if I open the TIFF Metadata element and then collapse the Metadata folder, the missing Abstracted_Metadata element appears spontaneously when I re-expand the Metadata folder. Is it being created somehow by the SNAP GUI, and if so how can I reproduce this in a java code ?

Thank you for your help,

SDB

I’ve written this code to add a metadata element, although it didn’t solve my CreateStack problem because I’m missing all mission parameters and orbit details. Posting it here for completeness :

MetadataElement abstractedMetadataElement = new MetadataElement("Abstracted_Metadata");    
/* Create MetadataAttribute for first_line_time and  last_line_time */
MetadataAttribute firstLineTimeAttribute = new MetadataAttribute("first_line_time", 22, 3);
MetadataAttribute lastLineTimeAttribute = new MetadataAttribute("last_line_time", 22, 3);
ProductData.UTC lineTimeData = ProductData.UTC.parse("01-JAN-2000 00:00:00.000000");
System.out.println("Adding attribute first_line_time and "
        + "last_line_time to new Abstracted_Metadata : " 
        + lineTimeData.getElemString());
firstLineTimeAttribute.setData(lineTimeData);
lastLineTimeAttribute.setData(lineTimeData);

abstractedMetadataElement.addAttribute(firstLineTimeAttribute);
abstractedMetadataElement.addAttribute(lastLineTimeAttribute);
subProduct.getMetadataRoot().addElement(abstractedMetadataElement);