Hi Florian,
thanks for your reply. I also did a test batch run with a minimized command. I removed both the xml and the properties file and used only command line parameters. Surprisingly, it worked.
I did another quick test processing the same granule with the two different commands.
- Minimal call, without .xml and .properties:
~/snap/bin/gpt Resample -e -x -f NETCDF4-BEAM -PtargetResolution=10 -t S2A_MSIL1C_20220311T104841_N0400_R051_T31UDU_20220311T130621_resampled.nc -SsourceProduct=S2A_MSIL1C_20220311T104841_N0400_R051_T31UDU_20220311T130621.SAFE
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: GDAL 2.2.3 found on system. JNI driver will be used.
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Internal GDAL 3.0.0 set to be used by SNAP.
INFO: org.esa.snap.core.util.EngineVersionCheckActivator: Please check regularly for new updates for the best SNAP experience.
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Internal GDAL 3.0.0 set to be used by SNAP.
INFO: org.esa.s2tbx.dataio.s2.ortho.S2OrthoProductReaderPlugIn: Building product reader - EPSG:32631
WARNING: org.esa.snap.core.metadata.GenericXmlMetadata: Metadata: the path to element [metadata_level] does not exist
WARNING: org.esa.snap.core.metadata.GenericXmlMetadata: Metadata: the path to element [granuleidentifier] does not exist
WARNING: org.esa.snap.core.metadata.GenericXmlMetadata: Metadata: the path to element [bandid] does not exist
INFO: org.hsqldb.persist.Logger: dataFileCache open start
Executing operator...
20%....30%....40%....50%....60%....70%....80%....90%.... done.
INFO: org.esa.snap.core.gpf.common.WriteOp: Start writing product S2A_MSIL1C_20220311T104841_N0400_R051_T31UDU_20220311T130621_resampled to S2A_MSIL1C_20220311T104841_N0400_R051_T31UDU_20220311T130621_resampled.nc
Writing...
....10%....13651 [main] INFO serverStartup - Nc4Iosp: NetCDF-4 C library loaded (jna_path='/home/behrd/.snap/auxdata/netcdf_natives/8.0.9/amd64', libname='netcdf').
13656 [main] INFO serverStartup - NetcdfLoader: set log level: old=0 new=0
13656 [main] INFO serverStartup - Nc4Iosp: set log level: old=0 new=0
20%....30%....40%....50%....60%....70%....80%....90%.... done.
INFO: org.esa.snap.core.gpf.common.WriteOp: End writing product S2A_MSIL1C_20220311T104841_N0400_R051_T31UDU_20220311T130621_resampled to S2A_MSIL1C_20220311T104841_N0400_R051_T31UDU_20220311T130621_resampled.nc
INFO: org.esa.snap.core.gpf.common.WriteOp: Time: 827.771 s total, 75.389 ms per line, 0.006866 ms per pixel
So, this runs without problems.
- Original call with .xml and .properties files:
~/snap/bin/gpt resample_s2.xml -e -x -f NETCDF4-BEAM -p resample_10m.properties -t S2A_MSIL1C_20220311T104841_N0400_R051_T31UDU_20220311T130621_resampled.nc S2A_MSIL1C_20220311T104841_N0400_R051_T31UDU_20220311T130621.SAFE
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: GDAL 2.2.3 found on system. JNI driver will be used.
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Internal GDAL 3.0.0 set to be used by SNAP.
INFO: org.esa.snap.core.util.EngineVersionCheckActivator: Please check regularly for new updates for the best SNAP experience.
Executing processing graph
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Internal GDAL 3.0.0 set to be used by SNAP.
INFO: org.esa.s2tbx.dataio.s2.ortho.S2OrthoProductReaderPlugIn: Building product reader - EPSG:32631
WARNING: org.esa.snap.core.metadata.GenericXmlMetadata: Metadata: the path to element [metadata_level] does not exist
WARNING: org.esa.snap.core.metadata.GenericXmlMetadata: Metadata: the path to element [granuleidentifier] does not exist
WARNING: org.esa.snap.core.metadata.GenericXmlMetadata: Metadata: the path to element [bandid] does not exist
INFO: org.hsqldb.persist.Logger: dataFileCache open start
7425 [main] INFO serverStartup - Nc4Iosp: NetCDF-4 C library loaded (jna_path='/home/behrd/.snap/auxdata/netcdf_natives/8.0.9/amd64', libname='netcdf').
7429 [main] INFO serverStartup - NetcdfLoader: set log level: old=0 new=0
7429 [main] INFO serverStartup - Nc4Iosp: set log level: old=0 new=0
....10%.90% done.
org.esa.snap.core.gpf.OperatorException: Failed to read the data for level 0 and rectangle java.awt.Rectangle[x=0,y=0,width=256,height=256].
at org.esa.snap.core.gpf.graph.GraphProcessor$GPFImagingListener.errorOccurred(GraphProcessor.java:379)
at com.sun.media.jai.util.SunTileScheduler.sendExceptionToListener(Unknown Source)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(Unknown Source)
at javax.media.jai.OpImage.getTile(Unknown Source)
at com.sun.media.jai.opimage.TranslateIntOpImage.getTile(Unknown Source)
at javax.media.jai.PlanarImage.getData(Unknown Source)
at javax.media.jai.PlanarImage.getExtendedData(Unknown Source)
at com.sun.media.jai.opimage.MosaicOpImage.computeTile(Unknown Source)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(Unknown Source)
at javax.media.jai.OpImage.getTile(Unknown Source)
at javax.media.jai.PlanarImage.getData(Unknown Source)
at javax.media.jai.PlanarImage.getExtendedData(Unknown Source)
at javax.media.jai.ScaleOpImage.computeTile(Unknown Source)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(Unknown Source)
at javax.media.jai.OpImage.getTile(Unknown Source)
at com.sun.media.jai.opimage.CropOpImage.getTile(Unknown Source)
at javax.media.jai.PlanarImage.cobbleByte(Unknown Source)
at javax.media.jai.PlanarImage.getData(Unknown Source)
at javax.media.jai.RenderedOp.getData(Unknown Source)
at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64)
at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:449)
at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:435)
at org.esa.snap.core.gpf.internal.OperatorImage.computeRect(OperatorImage.java:75)
at javax.media.jai.SourcelessOpImage.computeTile(Unknown Source)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(Unknown Source)
at javax.media.jai.OpImage.getTile(Unknown Source)
at com.sun.media.jai.util.RequestJob.compute(Unknown Source)
at com.sun.media.jai.util.WorkerThread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Failed to read the data for level 0 and rectangle java.awt.Rectangle[x=0,y=0,width=256,height=256].
at org.esa.snap.jp2.reader.internal.JP2TileOpImage.computeRect(JP2TileOpImage.java:115)
at javax.media.jai.SourcelessOpImage.computeTile(Unknown Source)
... 26 more
Caused by: javax.imageio.IIOException: I/O error reading header!
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.readHeader(TIFFImageReader.java:567)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.locateImage(TIFFImageReader.java:705)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.seekToImage(TIFFImageReader.java:835)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.seekToImage(TIFFImageReader.java:822)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.getWidth(TIFFImageReader.java:1080)
at org.esa.snap.jp2.reader.internal.JP2TileOpImage$ImageReader.getImageWidth(JP2TileOpImage.java:303)
at org.esa.snap.jp2.reader.internal.JP2TileOpImage.computeRectIndirect(JP2TileOpImage.java:148)
at org.esa.snap.jp2.reader.internal.JP2TileOpImage.computeRect(JP2TileOpImage.java:113)
... 27 more
Caused by: java.io.EOFException
at it.geosolutions.imageio.stream.eraf.EnhancedRandomAccessFile.readUnsignedShort(EnhancedRandomAccessFile.java:978)
at it.geosolutions.imageio.stream.input.FileImageInputStreamExtImpl.readUnsignedShort(FileImageInputStreamExtImpl.java:130)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.readHeader(TIFFImageReader.java:513)
... 34 more
Error: Failed to read the data for level 0 and rectangle java.awt.Rectangle[x=0,y=0,width=256,height=256].
resample_s2.xml file:
<graph id="Resample_Sentinel-2">
<version>1.0</version>
<node id="resample-s2">
<operator>Resample</operator>
<sources>
<sourceProduct>${sourceProduct}</sourceProduct>
</sources>
<parameters>
<targetResolution>${resolution}</targetResolution>
<upsampling>${up}</upsampling>
<downsampling>${down}</downsampling>
<flagDownsampling>${flag}</flagDownsampling>
<resampleOnPyramidLevels>true</resampleOnPyramidLevels>
</parameters>
</node>
</graph>
resample_10m.properties file:
resolution=10
down=First
up=Nearest
flag=First
For my understanding the two commands should do just the same processing, but the command line output looks different.
I actually didnt notice that these values are all defaults except for the resolution and the parameters can also be put directly on the command line. It seems there is a problem when reading the combination of these files, maybe you can find out what happens. However, for my purpose its easier to provide the command line parameters. gpt processes just fine this way.
If I can help tracking down the error, let me know.
Best,
Daniel