Opening .img (Disk Image File) in Python

Seems like an error here,

As I said it’s a bit tricky that’s why I only succeeded to configure using py3.4 and SNAP 7, I’m working in windows os. I don’t know if there is any other way to get cofi-ed with anaconda in windows os, but please take a look at the thread I referred to it in my previous post.

Dear @marfersel would you please to give explanation details if that possible! to be followed as an instructions.

Hi again

@arnab could you please show us the log file?

@falahfakhri i didn’t try to use it with anaconda but i suppose it is not the problem. I followed the instructions here: https://senbox.atlassian.net/wiki/spaces/SNAP/pages/50855941/Configure+Python+to+use+the+SNAP-Python+snappy+interface

I needed to install some dependencies such as JDK, Maven and Microsoft Visual C++ Build Tools (it is important to follow the same architecture, x64 or x86, in all the dependencies) , but while installing you are required to do so. May be someone has anything else to say.

Regards.

1 Like

This is what I found inside the text file,

INFO: Installing from Java module ‘C:\Users\ma6\AppData\Roaming\SNAP\modules\org-esa-snap-snap-python.jar’
INFO: Installing jpy…
ERROR: Traceback (most recent call last):
File “.\snappyutil.py”, line 280, in _main
force=args.force)
File “.\snappyutil.py”, line 154, in _configure_snappy
" $ cd jpy"
AttributeError: ‘list’ object has no attribute ‘join’

ERROR: Configuration failed with exit code 40

I got something different while trying out another way I remember I installed snappy and this is what I get. Do I need to get admin restrictions removed from my system?

It is strange that even when I run the SNAP command line as an Administrator the Access Denied thing still persists :thinking:

You have to choices now the one I mentioned in my previous post, Source of the post

And the the second option of @marfersel

Thanks, @falahfakhri and @marfersel, I will try to troubleshoot the Snappy Issue over the weekend and may even write back in case I am stuck.

@ABraun
Can you clarify why, even when I run the SNAP 7.0 Command Line as an Administrator, I am getting the Access is Denied error.

It is quite clearly mentioned in here that only Python 2.7, 3.3, and 3.4 are supported with SNAP 7.0.
SNAP_Python_Interface
This is a bit confusing since @marfersel employs Snappy with Python 3.7 & SNAP 6 and @falahfakhri does it with Python 3.4 & SNAP 7.

it is important that you name the location including the python.exe file, e.g.
snappy-conf.bat C:\user\ma6\AppData\Local\Continuum\anaconda3\python.exe

What about the Python version, is it only compatible till 3.4 as highlighted above.

I’m not sure - shouldn’t be too much differences.
If you want to go sure: You can create an environment of python 2.7 or 3.4 with the Anaconda Navigator and refer to the python.exe created there. https://docs.anaconda.com/anaconda/navigator/getting-started/ (see Managing Environments).
The location will be C:\user\ma6\AppData\Local\Continuum\anaconda3\envs\name_you_give\python.exe

@ABraun
The Python configuration is still failing

In that case it might be that Python 3.7 is not supported as you suggested.

As I have mentioned in my aforementioned post, I experience the same troubles you have now of os win10, That’s why I suggest to you now to follow all the steps, were done.

Source of the post

@ABraun @falahfakhri

I could finally run from snappy import ProductIO

The following steps were followed in sequence,

  1. Install Anaconda 2.7 from https://www.anaconda.com/distribution/

  2. Install SNAP from here
    https://step.esa.int/main/download/snap-download/
    and create the SNAP-Python interface by assigning the python.exe path as C:\ProgramData\Anaconda2\python.exe in here
    SNAP_Python_Interface

  3. Open SNAP Command Line and type,
    snappy-conf C:\ProgramData\Anaconda2\python.exe

  4. From the following path,
    C:\Users\Your_User_Name\ .snap\snap-python
    copy two things,
    a. a folder by the name snappy
    b. a file by the name snappy.properties
    to C:\ProgramData\Anaconda2\Lib\site-packages

  5. Open Anaconda Prompt (Anaconda2) and type start spyder

  6. In the command window type from snappy import ProductIO

and you finally reach here :partying_face:

So far so good but I guess the next thing is setting up GDAL.

2 Likes

good job!

gdal for python also has some smaller things to know, but a nice tutorial is given in this book: https://www.oreilly.com/library/view/learning-geospatial-analysis/9781783281138/
You might find it somewhere else :wink:

1 Like

@ABraun
Oh yes, you mean in a flea market :wink:
By the way, I was wondering if there is a page where I can find all the commands and their syntax associated with Snappy.

Yes, it’s available, Preprocessing of Sentinel-1 SAR data via Snappy Python module

Take a look at this post for more details,

Source of the post

Thanks @falahfakhri
Will go through the code and write back if I don’t get a piece of code.