I am new to SAR processing using python. I am working with S1 images for interferogram generation. I formed it using SNAP software. I want to do it by python or command line now. Any suggestions/leads for packages would be helpful . Thanks
If you want to do it with python / command line, i would say first start exploring GPT, the commmand line interface of SNAP.
If you want to work directly with Python, use snappy although it is not recommended due to memory issues. Better, use snapista, a python wrapper for GPT.
You can find plenty of information about all these options in this forum!
Thanks for your response.
I tried with GPT in command line, but GPT is giving me output in Portuguese language. I tried running the command
“gpt myGraph.xml -e -p input_parameters.conf”
which gives me an output as " gpt: opção inválida: -e". This means “gpt: invalid option: -e” and while searching for this error, it gives me memory/disk issues. But my laptop has large space to process anything.
Then i tried one more command.
“gpt /home/ashish/Downloads/myGraph2.xml -Presolution=20 -Porigin=10 -Pfilter=‘None’ -Pdem=‘SRTM 3Sec’ -Pcrs=‘GEOGCS[“WGS84(DD)”, DATUM[“WGS84”, SPHEROID[“WGS84”, 6378137.0, 298.257223563]], PRIMEM[“Greenwich”, 0.0], UNIT[“degree”, 0.017453292519943295], AXIS[“Geodetic longitude”, EAST], AXIS[“Geodetic latitude”, NORTH]]’ -Pinput=/home/ashish/Desktop/vegetation_monitoring/data/sar/S1B_IW_SLC__1SDV_20190424T003920_20190424T003947_015941_01DF45_167D.SAFE -Poutput=/home/ashish/Desktop/vegetation_monitoring/data/sar/output.dim”
which gave me an output of error in .xml file. The xml file i generated in SNAP and edited as the document stated.
The language issue to be honest I dont know. Do you have your OS in that language?
Although you may have a lot of RAM in your disk that does not mean that GPT is using it. Check the gpt.vmoptions file in snap/bin and look for the Xmx variable. Set it to 79-80% of your RAM memory.
Also, which error are you having when running the second graph. Did you put vaiables in your xml after creating the graph with SNAP?
As @sentinal mentions, GPT is the preferred tool for anything using operators from the long list of supported operations. If you are more comfortable with Python than bash, then snapista may be helpful.
This may mean you have more than one program called
type gpt or
which gpt to get the location. Many programs support the
--help option, so
gpt --help may be informative.
On linux, gpt is a shell script. I find it helpful to edit the
gpt script to add
-showversion after the two occurances of
$app_java_home/bin/java. This will print information about the Java version when gpt runs.
Unlike Python, Java reserves memory at startup. The SNAP installer generally chooses appropriate values.
You need to provide more details. Please attach your .xml file and the text of the error message to a post. Note that one all too common source of difficult to identify errors is overly helpful editors that replace ASCII characters with look-alike unicode characters. Many editors (in particular, emacs and MS Code) are adding tools to highlight such characters.
No, my OS is in English.
I will try setting up 80% of the ram to Xmx variable.
Yes, i edited the xml file because I needed to change some of the options in the input like Polarisation and swath for splitting. The link to the file which i followed is command_line_inSAR_processing.pdf - Google Drive
the xml file which i used are:
Please find my .xml file attached in the above comment.
Hello, I tried installing snapista from “conda install -c terradue snapista”. It started downloading snap into the laptop with a size of 800 mb. I have attached the screenshot too. I have snap already in my laptop. So should i let it complete it or any other alternative.
I checked with type gpt and which gpt. i got the following result. I think there is only one program here called gpt.
SNAP does not normally install programs to
/usr/bin, which is reserved for programs installed using distribution packages. You need “root” privileges to install a 3rd party program there. Check the package manager for a gpt package – for Ubuntu you will see that gpt is a “Portuguese structured programming language”, which explains the Portuguese error message. For macOS,
gpt is a “GUID partition table maintenance utility”.
You will find many web sites that suggest manipulating the
PATH variable so that running
gpt will find your desired program. This approach is no longer recommended because there are more and more name clashes as time goes by, and because you can’t predict when distro packages will be broken by a user-installed program. In general, user-installed programs should be run using the full path, e.g.,
Yeah, Thanks for this. I need to know more about SNAPISTA. I am not able to install snapista and work with it. The snapista page is still showing me the 404 error. I tried the thread but didnt find anything. Please guide.
Moreover, I tried snappy. But there are already some other packages not related to SNAP which has same name as SNAPPY. can you guide me in that prospect too? i didnt find the suitable package for SAR processing in Linux either by command line or python.
In a terminal , try
<snap_install_dir>/bin/gpt -h? This should give a long help message with a list of the available operators. If that works, try your original gpt options using the full path (being careful to use ASCII single and double quotes are used – in your post they were shown with opening and closing versions which is not correct, probably due to not using the options to display code fragments):
<snap_install_dir>/bin/gpt /home/ashish/Downloads/myGraph2.xml -Presolution=20 -Porigin=10 -Pfilter=None -Pdem='SRTM 3Sec' -Pcrs='GEOGCS["WGS84(DD)", DATUM["WGS84", SPHEROID["WGS84", 6378137.0, 298.257223563]], PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH]]' -Pinput=/home/ashish/Desktop/vegetation_monitoring/data/sar/S1B_IW_SLC__1SDV_20190424T003920_20190424T003947_015941_01DF45_167D.SAFE -Poutput=/home/ashish/Desktop/vegetation_monitoring/data/sar/output.dim
You have to configure the ESA SNAP snappy package using the
<snap_install_dir>/bin/snappy_conf tool, as described in the wiki article This requires the pathname of a python interpreters and a jpy binary wheel that matches the python version. A Python 3.6 binary wheel is included in SNAP, for newer python versions use the link provided at the start of the article.
I would like to suggest the ASF HyP3 API and SDK as alternatives for programmatically processing Sentinel-1 InSAR. Information on these options can be found in the HyP3 User Guide.
If you’d prefer an easy to use interface for ordering InSAR processing, check out ASF Vertex On-Demand Processing.
Thanks @bill-h . I will try these methods and will update you if they worked.