Wrong result when run `StatisticsOp` repeatly in xml

When running StatisticsOp (write as xml and then run using gpt) for one band with two different masks, the two resultant statistic files are identical. the result for the first call of StatisticsOp is correct, while the 2nd is not. Any one could help?

Note: this is a recently found issue, seems after my upgrade of SNAP in the last few months.

For example , the graph below will give two same resultant file “outfile1.txt” and “outfile2.txt”; “outfile1.txt” is correct, while outfile2.txt is not.

<graph id="StatisticGraph">
<version>1.0</version>
    <node id="Read">
		<operator>Read</operator>
		<sources/>
		<parameters>
		  <file>path-to-dim-file</file>
		</parameters>
    </node>

     <node id="StatsNode1">
          <operator>StatisticsOp</operator>
          <sources>
            <sourceProducts>Read</sourceProducts>
          </sources>
          <parameters>
			<bandConfigurations>
			 <bandConfiguration>
				<sourceBandName>band1</sourceBandName>  
				<validPixelExpression>Mask_band1</validPixelExpression>
			 </bandConfiguration>
			</bandConfigurations>
			<outputAsciiFile>outfile1.txt</outputAsciiFile>
			<accuracy>5</accuracy>
          </parameters>
    </node>

     <node id="StatsNode2">
          <operator>StatisticsOp</operator>
          <sources>
            <sourceProducts>Read</sourceProducts>
          </sources>
          <parameters>
			<bandConfigurations>
			<bandConfiguration>
				<sourceBandName>band1</sourceBandName>
				<validPixelExpression>Mask_band2</validPixelExpression>
			 </bandConfiguration>
			</bandConfigurations>
			<outputAsciiFile>outfile2.txt</outputAsciiFile>
			<accuracy>5</accuracy>
          </parameters>
    </node>

</graph>

Maybe this works: possibly, you will need to merge your results in one product (Merge). Another possibility would be to write your target bands all in the same node, and do not create two nodes with the same operator.

thank you for the reply.

  1. merge results into one product”: not sure what that means? as each node export stats as txt files. each node already working on one product, but different bands.
  2. " write your target bands all in the same node": lost order of output when multiple stats of one band but with different conditions.

still expect the problem be solved.