-
SNAP
SNAP
SNAP (Sentinel Application Platform) is a remote sensing toolbox architecture developed by the European Space Agency. It includes tools for ESA satellite data.
Available
SNAP is available with following versions:
- SNAP
13.0+ Python 3.12.3 including esa_snappy and pyroSAR + JupyterLab in Roihu - SNAP
13.0+ Python 3.12.3 including esa_snappy and pyroSAR + JupyterLab in Puhti - SNAP
jupyter(9.0) + Python 3.6.9 including snappy and snapista + JupyterLab in Puhti - SNAP
9.0+ Python 3.6.9 including snappy and snapista in Puhti - SNAP
8.0+ Python 3.6.9 including snappy in Puhti
The versions including JupyterLab can be used in the Jupyter application in the Puhti webinterface via the custom module option.
Usage
SNAP is included in the snap module and can be loaded with:
module load snap
This loads the newest available version. You can load an older version with:
module load snap/<VERSION>
Using SNAP with Graphical User Interface (GUI) in the Puhti/Roihu web interface
The easiest option for using SNAP is to open it in the Puhti/Roihu web interface.
- Log in to web interface: Puhti or Roihu
- Open Desktop app.
- After launching the Desktop, double-click SNAP icon OR open
Terminal Emulator(Desktop icon) and start SNAP:
SNAP userdir and Java temp dir configuration
SNAP uses significant amount of storage space for cache and temporary files. By default these are written to your HOME directory and may easily fill your HOME. For avoiding that configure your snap user directory and Java temporary folder. You should run this script every time you start using SNAP in Puhti or want to change the used folders.
After loading the snap module run
source snap_add_userdir <YOUR-PROJECTS-SCRATCH-FOLDER>
In Puhti, you could also request a fast nvme disk in a batch job and run the command first in the batch job so that all the temp/cache files are written to a fast disk rather than the scratch. It might provide speed improvement in demanding calculations.
source snap_add_userdir $LOCAL_SCRATCH with batch jobs
source snap_add_userdir $TMPDIR with interactive jobs
This scripts sets also Java temporary folder, it is set to be snap/temp subfolder in the folder you defined. If you want to set Java temporary folder to be somewhere else use:
export _JAVA_OPTIONS="$_JAVA_OPTIONS -Djava.io.tmpdir=<SOME-FOLDER>" after setting the user directory.
Note
The graphical user interface does not follow snap.userdir setting, but it notices the Java setting. Using SNAP GUI will create a __.snap__ folder inside your HOME directory and fill it. Empty it if you run out of space in your HOME directory.
Java memory settings
By default SNAP/8.0 uses only up to 2 Gb memory for Java. To increase this, add -J-xmx10G or similar setting to snap or gpt command. -J-Xmx10G extends the Java maximum memory to 10Gb. Adjust this according to your needs and job memory reservation. Compared to your job memory reservation use for Java a few Gb less.
Using SNAP with Graph Processing Tool (gpt) command
The Graph Processing Tool gpt is a command line tool used for bulk processing. Using GPT more computing power can be used than with SNAP graphical interface, because it can be used in scripts and therefore included in jobs that can be submitted to any partition.
GPT command looks often something like this:
Some relevant gpt options include:
- -J-xmx10G maximum memory used by Java.
- -q Number of threads the gpt instance will use. Set it to the number of CPU cores requested or more
- -c Cache size in bytes. Change this if storage space becomes an issue
- -x Clear internal tile cache after writing a complete row of tiles to output file. Add this if memory becomes an issue
See the links under references at the end of this page for additional info about GPT.
Also the following command is very useful in creating the graphs for different operators. It can be executed in an interactive session
gpt --diag -J-Xmx60G -c 40G can be used to see which memory and cache settings are used by gpt.
GPT examples for Puhti
- Full examples how to run GPT in Puhti in GitHub. The examples include both a simple job with one GPT graph and an array job where the same graph is computed for several input images.
Using SNAP with the Python interfaces
It is also possible to access SNAP functionalities from Python.
SNAP 9.0 and 13.0
Running Python scripts with batch jobs:
See available packages:
Installing new packages to your $HOME directory:
It is also possible to install packages to directories other than $HOME.
Please see our
Python usage guide
for instructions.
SNAP 8.0
Running snappy scripts with batch jobs:
See available packages:
Installing new packages to your $HOME directory:
It is also possible to install packages to directories other than $HOME.
Please see our
Python usage guide
for instructions.
Using the Python package with JupyterLab
- Log in to web interface: Puhti or Roihu
- Open Jupyter app.
- Select custom module and write
snapas module.
In Jupyter remember to set the temporary direcotries. Follow the SNAP set up Notebook to get started.
Updating SNAP
SNAP minor and module updates are stored in the $HOME/.snap directory. This means that all minor updates need to be installed by the user. You can do this in SNAP Desktop by following the instructions in the pop-up at start up.
License
All SNAP software is published under the GPL-3 license.
Citation
SNAP - ESA Sentinel Application Platform v{VERSION}, http://step.esa.int
Acknowledgement
Please acknowledge CSC and Geoportti in your publications, it is important for project continuation and funding reports. As an example, you can write "The authors wish to thank CSC - IT Center for Science, Finland (urn:nbn:fi:research-infras-2016072531) and the Open Geospatial Information Infrastructure for Research (Geoportti, urn:nbn:fi:research-infras-2016072513) for computational resources and support".
Installation
SNAP 13.0 was installed with Singularity using installer provided by ESA, with pip was added Jupyter, esa_snappy and pyroSAR. The container was finally wrapped with Tykky's wrap-container functionality.
SNAP 9.0 was installed to Puhti with Singularity using the SNAP Docker image provided by mundialis on Dockerhub with some small additions to provide snappy and snapista Python interfaces. The container was finally wrapped with Tykky's wrap-container functionality.
wrap-container -w /usr/local/snap/bin,/usr/bin snap9_py.sif --prefix install_dir
CSC SNAP Singularity definition files.