Snappy can't load *.SAFE | error: Is a directory

Hi all,

I guess our problem is a very specific one.
I hope someone can help us.

We are using a national cloud provider (Code-DE) to process Sentinel data.
One could say, that Code-DE is a german sub-branch of europeans CreoDIAS-Service.
We are using a virtual machine with an JupyterHub installed on it, for multiple users.

On this virtual machine I installed snap on command line and followed the workflow for snappy installation in one of our python environments in the JupyterHub.

The strange thing is, that snappy works fine for two of our 6 users.
For the rest and new users, however, we are facing the following problem:

  1. import snappy works
  2. but if we try to read a product we are getting the following error:
import snappy
RuntimeError                              Traceback (most recent call last)
<ipython-input-3-9fda1b8c6d51> in <module>()
----> 1 snappy.ProductIO.readProduct('/codede/Sentinel-1/SAR/SLC/2021/03/07/S1A_IW_SLC__1SDV_20210307T053347_20210307T053414_036888_0456B1_0A02.SAFE')

RuntimeError: /codede/Sentinel-1/SAR/SLC/2021/03/07/dblbnd.adf (Is a directory)

escpecially this part is strange:

*dblbnd.adf (Is a directory)

(I already installed Java…)

Yes, this is indeed strange but explainable. However. it is a bug.
This is caused by the way how SNAP searches for the best reader for the given product.
All known reader are tested and in one (for the Arc/INFO Grid) an error occurs. The order in which the reader are tested is not deterministic. That’s probably the reason why some experience this issue and others not.

In the code your users can work around this problem by specifying the format as second parameter of the readProduct method

ProductIO.readProduct('/codede/Sentinel-1/SAR/SLC/2021/03/07/S1A_IW_SLC__1SDV_20210307T053347_20210307T053414_036888_0456B1_0A02.SAFE', 'SENTINEL-1')

Then this reader for the specified format is used.

If created an issue for this problem.
[SNAP-1472] DecodeQualification method of arcbingrid-reader can cause exception - JIRA (

1 Like

First of all, thanks for the quick answer.

I get, however, an new error:

snappy.ProductIO.readProduct(’/codede/Sentinel-1/SAR/SLC/2020/08/09/S1B_IW_SLC__1SDV_20200809T053250_20200809T053317_022842_02B5BB_6C81.SAFE’, ‘SENTINEL-1’)

RuntimeError Traceback (most recent call last)
in ()
----> 1 snappy.ProductIO.readProduct(’/codede/Sentinel-1/SAR/SLC/2020/08/09/S1B_IW_SLC__1SDV_20200809T053250_20200809T053317_022842_02B5BB_6C81.SAFE’, ‘SENTINEL-1’)

RuntimeError: no matching Java method overloads found

Ah yes. snappy/jpy does not support Java varargs yet. I forgot.

So the workaround would be a bit longer.

reader = ProductIO.getProductReader('SENTINEL-1')
product = reader.readProductNodes('/codede/Sentinel-1/SAR/SLC/2020/08/09/S1B_IW_SLC__1SDV_20200809T053250_20200809T053317_022842_02B5BB_6C81.SAFE', None)

I also found another thing which maybe solve the problem.
We still have to test it with all users, but it worked for one test user.

I copied the entire /home/userX/.snap folder from one of the users, where snappy works, to the home-dir of the test user and it finally worked…

I also searched for the differences between the correct .snap-folder and incorrect .snap-folder. This is the result:

snappy works on user juypter-florian
snappy doesn’t work onuser jupyter-nsch)

root@jupyterhub:/home/jupyter-nschoen# diff -q /home/jupyter-florian/.snap/ /home/jupyter-nsch/.snap/
Common subdirectories: /home/jupyter-florian/.snap/auxdata and /home/jupyter-nschoen/.snap/auxdata
Only in /home/jupyter-florian/.snap/: epsg-database
Common subdirectories: /home/jupyter-florian/.snap/etc and /home/jupyter-nschoen/.snap/etc
Only in /home/jupyter-florian/.snap/: graphs
Common subdirectories: /home/jupyter-florian/.snap/product-library and /home/jupyter-nschoen/.snap/product-library
Only in /home/jupyter-florian/.snap/: system
Only in /home/jupyter-florian/.snap/: var

I don’t know why its working, maybe you could exlain it? @marpet