Hello,
I am working on creating a single product from a Sentinel-2 Level 2 image using GPT. My goal is to perform resampling, band subsetting, and calculate various indices using the BandMaths operators, resulting in a single output file in .dim format. I have created graph as .xml file, but here I’m struggling with issue, how to have original bands and calculated indices in one single .dim file. I have tried to use Collocate operator, however, I’m receiving the error message Error: The Product ‘_collocated’ already contains a band with the name ‘collocationFlags_Subset_S2B_MSIL2A_20230814T092559_N0509_R136_T35VME_20230814T120221_resampled_BandMath’.
I would appreciate any guidance on how to resolve this issue. Is there a better or an alternative approach?
I’m attaching the script .xml. And I would be thankful for the support.
Diana
Sentinel2_L2_all_operations.xml (3.1 KB)
The error is an issue of the Collocation operator.
For both band maths inputs the same collocationFlags band is added.
This needs to be fixed in the collocation operator. I also think, it is not a good idea to use the full product name for this band name. It can be very long like in this example. The index of the source should be sufficient as suffix. The full name can be put into the description. Actually, it is already considered that multiple inputs have the same name, but obviously something goes wrong (@diana_harosa )
However, you can work around this problem. You can let one Band Maths operator compute both indices.
Like this
<node id="Dalu">
<operator>BandMaths</operator>
<sources>
<sourceProduct refid="L2_subset"/>
</sources>
<parameters>
<targetBands>
<targetBand>
<name>Dalu</name>
<type>float32</type>
<expression>(B2-B4)/B3</expression>
<noDataValue>NaN</noDataValue>
</targetBand>
<targetBand>
<name>Dalu1</name>
<type>float32</type>
<expression>(B1-B4)/B3</expression>
<noDataValue>NaN</noDataValue>
</targetBand>
</targetBands>
</parameters>
</node>
Jira ticket SNAP-3824 created
1 Like