GPT resample - Coordinate out of bounds!


#1

I use GPT for resample in the batch process. Most granules work properly. However, with a certain number of granules an error occurs:

INFO: org.esa.snap.core.gpf.common.WriteOp: Start writing product S2B_MSIL2A_20181204T095359_N0211_R079_T33TYJ_20181204T122818_resampled to /snap_resample/S2B_MSIL2A_20181204T095359_N0211_R079_T33TYJ_20181204T122818.dim
org.esa.snap.core.gpf.OperatorException: INFO: org.esa.snap.core.gpf.common.WriteOp: Start writing product S2B_MSIL2A_20181204T095359_N0211_R079_T33TYJ_20181204T122818_resampled to /snap_resample/S2B_MSIL2A_20181204T095359_N0211_R079_T33TYJ_20181204T122818.dim
org.esa.snap.core.gpf.OperatorException: Coordinate out of bounds!
at org.esa.snap.core.gpf.internal.OperatorExecutor$GPFImagingListener.errorOccurred(OperatorExecutor.java:376)
at com.sun.media.jai.util.SunTileScheduler.sendExceptionToListener(SunTileScheduler.java:1646)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:921)
at javax.media.jai.OpImage.getTile(OpImage.java:1129)
at com.sun.media.jai.opimage.TranslateIntOpImage.getTile(TranslateIntOpImage.java:132)
at javax.media.jai.PlanarImage.copyData(PlanarImage.java:2343)
at javax.media.jai.PlanarImage.copyExtendedData(PlanarImage.java:2398)
at javax.media.jai.PlanarImage.getExtendedData(PlanarImage.java:2459)
at com.sun.media.jai.opimage.MosaicOpImage.computeTile(MosaicOpImage.java:432)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
at javax.media.jai.OpImage.getTile(OpImage.java:1129)
at com.sun.media.jai.opimage.CropOpImage.getTile(CropOpImage.java:122)
at javax.media.jai.RenderedOp.getTile(RenderedOp.java:2257)
at javax.media.jai.PointOpImage.computeTile(PointOpImage.java:911)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
at javax.media.jai.OpImage.getTile(OpImage.java:1129)
at javax.media.jai.PlanarImage.getData(PlanarImage.java:2085)
at javax.media.jai.PlanarImage.getExtendedData(PlanarImage.java:2440)
at javax.media.jai.ScaleOpImage.computeTile(ScaleOpImage.java:1101)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
at javax.media.jai.OpImage.getTile(OpImage.java:1129)
at com.sun.media.jai.opimage.CropOpImage.getTile(CropOpImage.java:122)
at javax.media.jai.RenderedOp.getTile(RenderedOp.java:2257)
at javax.media.jai.PointOpImage.computeTile(PointOpImage.java:911)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
at javax.media.jai.OpImage.getTile(OpImage.java:1129)
at javax.media.jai.PlanarImage.getData(PlanarImage.java:2085)
at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64)
at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:407)
at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:393)
at org.esa.snap.core.gpf.internal.OperatorImage.computeRect(OperatorImage.java:73)
at javax.media.jai.SourcelessOpImage.computeTile(SourcelessOpImage.java:137)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
at javax.media.jai.OpImage.getTile(OpImage.java:1129)
at com.sun.media.jai.util.RequestJob.compute(SunTileScheduler.java:247)
at com.sun.media.jai.util.WorkerThread.run(SunTileScheduler.java:468)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
at java.awt.image.WritableRaster.setDataElements(WritableRaster.java:314)
at org.esa.s2tbx.dataio.jp2.internal.JP2TileOpImage.computeRectIndirect(JP2TileOpImage.java:182)
at org.esa.s2tbx.dataio.jp2.internal.JP2TileOpImage.computeRect(JP2TileOpImage.java:147)
at javax.media.jai.SourcelessOpImage.computeTile(SourcelessOpImage.java:137)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
... 33 more
Error: Coordinate out of bounds!

Does anyone know what the problem is?


#2

Can you tell the name of a granule where it is not working?

It seems that the error happens during the reading of the data. Do you experience other problems when you use the granules otherwise, e.g. opening in SNAP Desktop?.


#3

Error appears on the granules:
S2A_MSIL2A_20181206T094351_N0211_R036_T33TYJ_20181206T111741.SAFE
S2A_MSIL2A_20181206T094351_N0211_R036_T33TYL_20181206T111741.SAFE
S2A_MSIL2A_20181206T094351_N0211_R036_T34TCP_20181206T111741.SAFE

The following granules were done correctly:
S2A_MSIL2A_20181206T094351_N0211_R036_T33TXK_20181206T111741.SAFE
S2A_MSIL2A_20181206T094351_N0211_R036_T33TXJ_20181206T111741.SAFE
S2A_MSIL2A_20181206T094351_N0211_R036_T33TYK_20181206T111741.SAFE

I did not try to open the granule in SNAP Desktop. SNAP is installed on the server. I’ll try and I’ll answer it.


#4

SNAP Desktop properly loaded granules and do resample.

Yes, it is definitely a mistake in reading! Can you know the reason?

Also, I tried to use Python to process controversial granules. And there is an error here.

File "resample.py", line 48, in <module>
 ProductIO.writeProduct(result,input,'BEAM-DIMAP')
RuntimeError: java.lang.NullPointerException

So, granules with a mistake SNAP Desktop successfully processed, but GPT and snappy not.


#6

What are the GPT commands, graph or python script you are using? Could you share them to try to reproduce the error?


#7

The situation is the next:

  • The SNAP Desktop and SNAP command tool on the Windows platform process all the granules properly.
  • SNAP command tool on Linux (Debian9) platform some of the granules are not processed correctly ( Error: Coordinate out of bounds!). In the previous posts, the examples mentioned.
  • I tried Linux in three ways: Graph, Snappy and Direct Command. The result is always the same.

Graph (only read product):

Snappy:

lista_granula = glob.glob('/tmp/procesuirano_L2A/S2A_MSIL2A_20181206T094351_N0211_R036_T33TYJ_20181206T111741.SAFE')

for granule in lista_granula:
    granule_str = ''.join(granule)
    naziv_granule = os.path.basename(granule)
    naziv_granule_1 = os.path.splitext(naziv_granule)[0]
    
    izlaz = '/tmp/snap_resample/'+naziv_granule_1+'.dim'
  
    product=ProductIO.readProduct(granule_str)
    GPF.getDefaultInstance().getOperatorSpiRegistry().loadOperatorSpis()

    HashMap = jpy.get_type('java.util.HashMap')
    parameters = HashMap()
    parameters.put('targetResolution',10)
    parameters.put('upsampling','Nearest')
    parameters.put('downsampling','First')
    parameters.put('flagDownsampling','First')
    result = GPF.createProduct('Resample', parameters, product)

    ProductIO.writeProduct(result,izlaz,'BEAM-DIMAP')

Command:
/opt/snap/bin/gpt resample -PreferenceBand=B2 -t /tmp/snap_resample/tmp/procesuirano_L2A /S2A_MSIL2A_20181206T094351_N0211_R036_T33TYJ_20181206T111741.dim “/tmp/procesuirano_L2A /S2A_MSIL2A_20181206T094351_N0211_R036_T33TYJ_20181206T111741.SAFE”

The SNAP version was last available. I tried to uninstall and reinstall SNAP but the result is always the same. Always some of the granules are not processed properly. The problem arises when reading the granules. I’ve been trying to handle the granules one by one, but it’s the same mistake.

I do not understand why this is happening?