Import ENVI (*.hdr,*.geotiff) data Issue

Hi Guys,

I am trying to import an ENVI image stack to SNAP. The data contains Sentinel1 images which got processed in ENVI. Once I load the data and try to save it in the *.dim format (save as) I get following Error:

if I go on “Show Details” I get following message:
java.lang.IndexOutOfBoundsException: pos < flushedPos!
at javax.imageio.stream.FileImageInputStream.seek(Unknown Source)
at org.esa.snap.dataio.envi.EnviProductReader.readBandRasterDataImpl(EnviProductReader.java:221)
at org.esa.snap.core.dataio.AbstractProductReader.readBandRasterData(AbstractProductReader.java:250)
at org.esa.snap.core.image.BandOpImage.computeProductData(BandOpImage.java:56)
at org.esa.snap.core.image.RasterDataNodeOpImage.computeRect(RasterDataNodeOpImage.java:127)
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 javax.media.jai.PlanarImage.getData(PlanarImage.java:2085)
at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64)
at org.esa.snap.core.datamodel.Band.writeRasterDataFully(Band.java:384)
at org.esa.snap.core.dataio.ProductIO.writeAllBands(ProductIO.java:444)
at org.esa.snap.core.dataio.ProductIO.writeProduct(ProductIO.java:398)
at org.esa.snap.rcp.actions.file.WriteProductOperation.writeProduct(WriteProductOperation.java:148)
at org.esa.snap.rcp.actions.file.WriteProductOperation.run(WriteProductOperation.java:115)
at org.netbeans.modules.progress.ui.RunOffEDTImpl$3.run(RunOffEDTImpl.java:275)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

My image stack contains 18 bands and has a size of 23.8 GB.

I also tried to import the same image stack in GeoTIFF format. There I get following exception:
java.lang.ArrayIndexOutOfBoundsException: 17
at it.geosolutions.imageio.plugins.tiff.TIFFField.getTypeName(TIFFField.java:694)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFFieldNode.initialize(TIFFFieldNode.java:207)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFFieldNode.getFirstChild(TIFFFieldNode.java:263)
at it.geosolutions.imageio.plugins.tiff.TIFFField.createFromMetadataNode(TIFFField.java:506)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageMetadata.parseIFD(TIFFImageMetadata.java:1597)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageMetadata.mergeNativeTree(TIFFImageMetadata.java:1621)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageMetadata.mergeTree(TIFFImageMetadata.java:1645)
at javax.imageio.metadata.IIOMetadata.setFromTree(Unknown Source)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.getImageMetadata(TIFFImageReader.java:1195)
at org.esa.snap.dataio.bigtiff.BigGeoTiffProductReader.readGeoTIFFProduct(BigGeoTiffProductReader.java:250)
at org.esa.snap.dataio.bigtiff.BigGeoTiffProductReader.readProductNodesImpl(BigGeoTiffProductReader.java:120)
at org.esa.snap.core.dataio.AbstractProductReader.readProductNodes(AbstractProductReader.java:169)
at org.esa.snap.core.dataio.ProductIO.readProduct(ProductIO.java:158)
at org.esa.snap.rcp.actions.file.ReadProductOperation.run(ReadProductOperation.java:37)
at org.netbeans.modules.progress.ui.RunOffEDTImpl$3.run(RunOffEDTImpl.java:275)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

In both cases I used the corresponding import function, i.e. : File -> Import -> Generic Formats -> GeoTIFF/BigTIFF or ENVI.

The reason I am doing this is that in the end I want to apply the multi-temporal speckle Filter in SNAP on my image stack.
Can you resolve this bug?

Best regards,
Marvin

Hi Marvin,

to give you at least some feedback I send you already some observations I made but unfortunately without solution.

Regarding the problem with GeoTIFF I found that there is a problem in one of the libraries we use.

Regarding the reading of Envi files I haven’t found the cause. Is your image stack just one envi file or do you have them separate? One file for each image.

Hi Marpet,

thanks for your help.

The ENVI file I use is one image, having multiple bands. So no seperate files. If you want you could provide me with a link to give you the data.

Best regards,
Marvin

Hi Marpet,

are there any news ?

Best regards,
Marvin

No, maybe I can look into this next week. But I can’t promise.

I was able to open the Envi file.
But it seems to be corrupted.
The first band looks good, the second has some artifacts and then there are some bands which can not be opened (message: pos < flushedPos!)
At the end there are some bands which can be opened but look scrambled. See the image.
So I’m wondering if the file was written correctly. If you read it back into Envi does it work?

Hi Marpet,

I opened the file and took a look at the same band as you did:

My result looks different than yours. Maybe there is an issue with the library you use for reading in the data ?
I could also manage to open all other bands without any problem.

Best regards,
Marvin

Yes indeed, it looks like there is a problem. For the ENVI files we don’t use a library it is our own implementation.
But I’m afraid I think we can’t fix this now. But I’ve added this as an issue to tracking system (SNAP-502) for the future development.
Would it be an option for you to export each band separately to one file and then merge (collocate) them in SNAP?

Hi marpet,

I guess I can do that in the mean time. Does it work yet to load a geotiff instead of the ENVI file ? - Otherwise I will just transform it into a geotiff and load it like that.

Best regards,
Marvin

No, unfortunately we also had no time to fix this GeoTiff issue. Sorry.

Hey Marpet, I wanted to ask if there are any news ?

No. No news yet. Except that it is now reported a second time.