Sen2Cor integer division or module by zero. Sen2Cor just hangs

For the scene S2B_MSIL2A_20180614T112109_N0206_R037_T30STH_20180614T164706
I get the following error and then Sen2Cor just hangs.

Process L2A_ProcessTile-1:
Traceback (most recent call last):
  File "/home/ubuntu/code/lib/sen2cor/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/home/ubuntu/code/lib/sen2cor/lib/python2.7/site-packages/sen2cor/L2A_ProcessTile.py", line 133, in run
    if not self.process_20():
  File "/home/ubuntu/code/lib/sen2cor/lib/python2.7/site-packages/sen2cor/L2A_ProcessTile.py", line 158, in process_20
    return self.process()
  File "/home/ubuntu/code/lib/sen2cor/lib/python2.7/site-packages/sen2cor/L2A_ProcessTile.py", line 223, in process
    if ac.process() == False:
  File "L2A_AtmCorr.py", line 2964, in L2A_AtmCorr.L2A_AtmCorr.process (L2A_AtmCorr.c:69685)
  File "L2A_AtmCorr.py", line 7045, in L2A_AtmCorr.L2A_AtmCorr.dtm_array (L2A_AtmCorr.c:185911)
ZeroDivisionError: integer division or modulo by zero

I’m running it with DEM and with the external CCI data.

The logfile is the following:

Sentinel-2 Level 2A Processor (Sen2Cor). Version: 2.5.5, created: 2018.03.19, supporting Level-1C product version <= 14.5 started ...
Product version: 14.5. Operation mode: PDGS. Processing baseline: 02.06.
 Selected resolution: 20 m.
Progress[%]: 0.04 : PID-111, L2A_ProcessTile: processing with resolution 20 m, elapsed time[s]: 0.422, total: 0:00:02.711838
Progress[%]: 0.04 : PID-111, L2A_ProcessTile: start of pre processing, elapsed time[s]: 0.000, total: 0:00:02.712161
Progress[%]: 0.05 : PID-111, L2A_Tables: start import, elapsed time[s]: 0.145, total: 0:00:02.856825
Progress[%]: 0.51 : PID-111, L2A_Tables: band B01 imported, elapsed time[s]: 5.553, total: 0:00:08.410323
Progress[%]: 1.11 : PID-111, L2A_Tables: band B02 imported, elapsed time[s]: 7.237, total: 0:00:15.646857
Progress[%]: 1.71 : PID-111, L2A_Tables: band B03 imported, elapsed time[s]: 7.220, total: 0:00:22.867213
Progress[%]: 2.31 : PID-111, L2A_Tables: band B04 imported, elapsed time[s]: 7.200, total: 0:00:30.067032
Progress[%]: 2.40 : PID-111, L2A_Tables: band B05 imported, elapsed time[s]: 1.072, total: 0:00:31.139114
Progress[%]: 2.49 : PID-111, L2A_Tables: band B06 imported, elapsed time[s]: 1.069, total: 0:00:32.207881
Progress[%]: 2.58 : PID-111, L2A_Tables: band B07 imported, elapsed time[s]: 1.066, total: 0:00:33.273435
Progress[%]: 2.67 : PID-111, L2A_Tables: band B8A imported, elapsed time[s]: 1.066, total: 0:00:34.339848
Progress[%]: 3.13 : PID-111, L2A_Tables: band B09 imported, elapsed time[s]: 5.514, total: 0:00:39.853733
Progress[%]: 3.59 : PID-111, L2A_Tables: band B10 imported, elapsed time[s]: 5.469, total: 0:00:45.322779
Progress[%]: 3.67 : PID-111, L2A_Tables: band B11 imported, elapsed time[s]: 1.056, total: 0:00:46.378444
Progress[%]: 3.76 : PID-111, L2A_Tables: band B12 imported, elapsed time[s]: 1.058, total: 0:00:47.436864
Progress[%]: 5.09 : PID-111, L2A_Tables: band DEM imported, elapsed time[s]: 15.979, total: 0:01:03.415578
Progress[%]: 5.99 : PID-111, L2A_Tables: band SDW imported, elapsed time[s]: 10.763, total: 0:01:14.178204
Progress[%]: 7.05 : PID-111, L2A_Tables: band SLP imported, elapsed time[s]: 12.735, total: 0:01:26.913294
Progress[%]: 8.16 : PID-111, L2A_Tables: band ASP imported, elapsed time[s]: 13.351, total: 0:01:40.264133
Progress[%]: 8.98 : PID-111, L2A_Tables: band WBI imported, elapsed time[s]: 9.825, total: 0:01:50.089337
Progress[%]: 9.54 : PID-111, L2A_Tables: band LCM imported, elapsed time[s]: 6.714, total: 0:01:56.803234
Progress[%]: 10.07 : PID-111, L2A_Tables: band SNC imported, elapsed time[s]: 6.271, total: 0:02:03.074681
Progress[%]: 10.07 : PID-111, L2A_Tables: stop import, elapsed time[s]: 0.010, total: 0:02:03.084841
Progress[%]: 10.07 : PID-111, L2A_ProcessTile: start of Scene Classification, elapsed time[s]: 0.003, total: 0:02:03.088253
Progress[%]: 10.14 : PID-111, Pre process   , elapsed time[s]: 0.903, total: 0:02:03.991537
Progress[%]: 10.54 : PID-111, L2A_SC init   , elapsed time[s]: 4.813, total: 0:02:08.804667
Progress[%]: 10.68 : PID-111, L2A_CSND_1_1  , elapsed time[s]: 1.662, total: 0:02:10.466570
Progress[%]: 10.84 : PID-111, L2A_CSND_1_2  , elapsed time[s]: 1.888, total: 0:02:12.354714
Progress[%]: 10.86 : PID-111, L2A_CSND_2_0  , elapsed time[s]: 0.200, total: 0:02:12.555202
Progress[%]: 11.02 : PID-111, L2A_CSND_2_1  , elapsed time[s]: 1.968, total: 0:02:14.522829
Progress[%]: 11.12 : PID-111, L2A_CSND_2_1_2, elapsed time[s]: 1.152, total: 0:02:15.675083
Progress[%]: 11.19 : PID-111, L2A_CSND_2_2  , elapsed time[s]: 0.838, total: 0:02:16.513407
Progress[%]: 11.25 : PID-111, L2A_CSND_2_3  , elapsed time[s]: 0.826, total: 0:02:17.339118
Progress[%]: 11.37 : PID-111, L2A_CSND_2_4  , elapsed time[s]: 1.427, total: 0:02:18.766565
Progress[%]: 11.57 : PID-111, L2A_CSND_2_5  , elapsed time[s]: 2.399, total: 0:02:21.165222
Progress[%]: 11.62 : PID-111, L2A_SnowPostProcessingCCI  , elapsed time[s]: 0.546, total: 0:02:21.711183
Progress[%]: 11.82 : PID-111, L2A_CSND_3    , elapsed time[s]: 2.460, total: 0:02:24.170873
Progress[%]: 12.04 : PID-111, L2A_CSND_5_1  , elapsed time[s]: 2.542, total: 0:02:26.713000
Progress[%]: 12.36 : PID-111, L2A_CSND_5_2  , elapsed time[s]: 3.871, total: 0:02:30.583503
Progress[%]: 12.60 : PID-111, L2A_CSND_6    , elapsed time[s]: 2.884, total: 0:02:33.467433
Progress[%]: 12.75 : PID-111, L2A_CSND_6_2  , elapsed time[s]: 1.801, total: 0:02:35.268596
Progress[%]: 12.93 : PID-111, L2A_CSND_7    , elapsed time[s]: 2.218, total: 0:02:37.486486
Progress[%]: 17.66 : PID-111, L2A_SHD       , elapsed time[s]: 56.747, total: 0:03:34.233048
Progress[%]: 17.85 : PID-111, DV recovery   , elapsed time[s]: 2.202, total: 0:03:36.435259
Progress[%]: 18.02 : PID-111, WP recovery   , elapsed time[s]: 2.045, total: 0:03:38.480254
Progress[%]: 18.07 : PID-111, WP recovery with CCI Water Bodies at 150m  , elapsed time[s]: 0.706, total: 0:03:39.186587
Progress[%]: 18.18 : PID-111, Water Pixels cleaning with DEM, elapsed time[s]: 1.230, total: 0:03:40.416470
Progress[%]: 18.22 : PID-111, Cloud Shadow Pixels cleaning with DEM, elapsed time[s]: 0.464, total: 0:03:40.880192
Progress[%]: 18.38 : PID-111, Topographic shadows classification over snow in mountainous area with DEM, elapsed time[s]: 1.958, total: 0:03:42.838200
Progress[%]: 18.60 : PID-111, Snow recovery , elapsed time[s]: 2.608, total: 0:03:45.446428
Progress[%]: 18.69 : PID-111, Soil recovery , elapsed time[s]: 1.070, total: 0:03:46.516578
Progress[%]: 18.80 : PID-111, Land recovery with B10, B09 and B8A , elapsed time[s]: 1.331, total: 0:03:47.847408
Progress[%]: 18.93 : PID-111, Cirrus recovery with B10 , elapsed time[s]: 1.585, total: 0:03:49.432084
Progress[%]: 19.69 : PID-111, Urban and Bare pixel recovery with CCI Land Cover Map at 300 m , elapsed time[s]: 9.179, total: 0:03:58.611390
Progress[%]: 19.92 : PID-111, Post process  , elapsed time[s]: 2.683, total: 0:04:01.293900
Progress[%]: 19.92 : PID-111, L2A_ProcessTile: start of Atmospheric Correction, elapsed time[s]: 0.001, total: 0:04:01.294807

ZeroDivisionError sounds like a variable was unexpectedly 0 and the process was aborted.

But its hard to guess why or at which step.

Yes, I would love to help debugging and fixing this. But it seems that the Sen2Cor developers are not active in this forum at all.

Hi,

I have just loaded the L1C product and all the bands are black images. Have you checked the L1C input product? Can you see anything?

It seems that this is a scene without any data in it.

The main problem is that Sen2Cor just hangs there. It does not finish with an error message or anything.
I only noticed this because of the few thousand granules I processed this one just did not finish.

In fact, I have just noticed that there are some valid pixels in the image:

I agree that it is not properly managed by Sen2Cor, I will notify this issue to the sen2cor development team.

Thank you for reporting!

Thank you.

If you have a contact at the Sen2Cor development team. Maybe you could also ask them about the following issues:

I’m pretty sure the first one is a bug that will not use a DEM at all in coastal regions.
The second one is just annoying that Sen2Cor fails a few times and then runs like nothing is wrong.