S2 images showing NaN in SNAP

Somehow all S2 images I open show NaN for all bands. The Lat/Lon info is shown and the bands open, however, pixel info gives NaN for all pixels.
This also happens to images that I opened before succesfully. It happes to images from the commissioning phase and also for more recent images. I have tried opening in native resolutions and with re-sampling. It opens other data (e.g. SPOT) correctly.

I think the issue started when I upgraded to SNAP2.0, however, if I now install S2 toolbox 1.01 the same imagey does not open because of a Java error. I have now re-installed SNAP with toolboxes with the latest versions but the issue remains. I work on Windows 64 bit.

Any idea if I am doing something wrong? Thanks in advance!

What’s your version of Windows?

It might be related to openjpeg binaries not working on your system for some reason. These binaries are located in on you home directory, under .snap\auxdata\openjpeg\openjpeg-2.1.0-win32-x64_dyn\bin

To check this you could try:

  • to open a jp2 file via SNAP, you can find them under the GRANULE[granule name]\IMG_DATA folder.
  • if you can’t see the granule, launch opj_decompress.exe and opj_dump.exe on one of these granule file.

By example on the from a command prompt in the IMG_DATA folder
[openjpeg_path]\opj_dump.exe -i [file name].jp2
[openjpeg_path]\opj_decompress.exe -i [file name].jp2 -o Output.png

What is happening with these commands?

Dear Nicolas,

Thanks for helping me along! This machine has Windows 10, and I must admit that I don’t remember any more if it stopped opening S2 images after we have updated it from Windows 7 to Windows 10. Could very well be that that was also the moment it could not open the images any more.

I tried opening a jp2 file via SNAP, that gave this error message:

So I also tried both prompts you suggested. I changed directory to the IMG_DATA folder and used \opj_dump.exe -i [file name].jp2 and \opj_decompress.exe -i [file name].jp2 -o Output.png, both with the file name filled out. Result: ‘opj_dump.exe’ is not recongnized as an internal or external command, operable program or batch file. Same for the other prompt. (I was not sure if I should use ‘\opj_dump.exe’ or: ‘opj_dump.exe’ so I did both, but the result was the same. )

This probably means that Windows 10 is the issue? I will test it at another machine soon (need to arrange another machine to do that).

Thanks so far!
Annelies

Dear Nicolas,

Meanwhile I tried on a Linux 64 bits and the same image shows the pixel data now :smile:
So indeed the Windows 10 seems to be the issue, it worked on the same Windows machine before, but that was probably before the update to Windows 10.

Thanks for your help!
Annelies

Dear Annelies,

It’s nice you found a solution.

On my previous message when I wrote

I meant by [openjpeg_path] the full path to openjpeg, something like
C:\Users\annelies.snap\auxdata\openjpeg\openjpeg-2.1.0-win32-x64_dyn\bin, depending of you home directory (which might not be C:\Users\annelies)

So for opj_decompress.exe it would give C:\Users\annelies.snap\auxdata\openjpeg\openjpeg-2.1.0-win32-x64_dyn\bin\opj_decompress.exe

Nicolas.

Dear Nicolas,

I just wrote a post here and deleted, because

[openjpeg_path]\opj_dump.exe -i [file name].jp2
[openjpeg_path]\opj_decompress.exe -i [file name].jp2 -o Output.png

worked! I needed to use openjpeg-2.1.0-win64\bin instead of the other folder.

So, this generated an output file, which I can open with SNAP. It contains a band which is called gray and it contains data per pixel.
Do you have an idea what is going on, that this works while directly opening the image in SNAP does not work?

Would still be nice to get SNAP working on my computer.

Best regards,
Annelies

Addition:

  • I have installed SNAP 3 now. Opening an image from the S2 folder directly still shows NaN
  • I have snap not installed on my documents directory. Is that required?

Just found out that I can open single bands/JP2 files from the GRANULE folders since the update to SNAP3.

What it the path to your products? Sometimes too long paths can give NaN for all pixels.

I had the same problem Annelies encountered (S2 image with all NaN bands) but after a lot of trial-and-error I discovered that the problem was a space in the file path of the S2 image. After fixing that everything worked fine.

Yeeeeej! It was the path, thanks a lot Nicolas and Fpriem for helping me out!
I was opening the product from a storage server, apparently that path was too long/not expected (it was not very long).

When trying to extract an image on this machine itself, winzip gave an error of too long path at pretty much each location. Now it is directly on the c drive and it opens correctly!

Best regards,
Annelies