Sen2cor manual ROI configuration "zero-size array to reduction operation maximum which has no identity" error

Hello everyone !

I have a little problem with the correction of S2 L1C images by sen2cor in the command line (Ubuntu). In my xml configuration file, I put the midpoint coordinates of my region of interest, and the width/height of my ROI. For some tiles everything works fine; for some tiles I have this “zero-size array to reduction operation maximum which has no identity” error pretty early in the processing, and it seems to come from and depend on the size of my ROI. Except that after my manual verification, I’m pretty sure that my ROI lies entirely in the image and there is no problem with the “no data” pixels. The exact example that I could give is the product S2A_MSIL1C_20190131T050031_N0207_R119_T47VLK_20190131T080010.SAFE, and my configuration in the xml file is : row0=8436, col0=9930, nrow_win=312, ncol_win=312.

Based on the UTM coordinates of my ROI I’ve checked its placement in the QGIS (image below), and it seems fine to me, so I don’t understand where the error is coming from… Tank you in advance fro your hints and help :slight_smile:


You better change the category of this thread to sen2cor. In the S2TBX category the sen2cor team might overlook your question.
I tag the @Sen2cor_dev_team here so they get notified.

Ahh yes sorry, I did not see the tags at the beginning, I added the sen2cor category. Thank you !!

Dear @DariaMalik,

Thank you for your message. The Region Of Interest (ROI) has never been intensively tested so your feedback is interesting for us and we were able to spot a small bug in the current implementation in case of rather small ROI (in this case about ~ 0.1 % of the full Sentinel-2 tile size).

We were able to reproduce your findings with other tiles. As an example we had a successful Sen2Cor 2.11 execution with : nrow_win=420, ncol_win=420. But those values are tile dependent. We established that the minimal value is nrow_win=1200, ncol_win=1200 in order to never encounter that bug. We will provide a fix in next version and update the Software User Manual indicating a minimal size for ROI.

For your information this ROI functionality was initially designed to support the first Atmospheric Correction Inter-Comparison Exercise (ACIX) , for Sen2Cor being able to work on 30 km x 30 km subsets (corresponding to nrow_win=3000, ncol_win=3000). It was established at that time that the atmospheric corrections results obtained with 30 km by 30 km subsets were reasonably equivalent to atmospheric corrections results obtained when using the full tile.Using smaller ROI has never been scientifically validated. The risk when working with small ROI is that you could encounter more cases when not enough dark dense vegetation pixels are found when performing the aerosol optical thickness retrieval and goes into fallback mode, using then either fixed AOT or CAMS AOT when processing recent products with PB >= 04.00.

Cheers,
@Sen2cor_dev_team

Dear developers team,

Thank you very much for your response. Indeed, the size is tile-dependent, because I’ve already managed to process other tiles with my desired ROI size before (312x312).

Thank you also for the enlightenment about the scientific “underlayement” of why the minimum advised size is 3kx3k, totally forget this part. I think I could work with the minimum size, since it will still help me to reduce the processing time, because this was my main argument (to process fast, as I have a lot of products to process and the final ROI is just 3x3 km²). I think the update in the User Manual would be nice, but the bug fix is totally up to you of course since there are scientific reasons to define a minimum ROI.

Thanks a lot,
Have a good day !
Daria

1 Like