esa-snap-notebook is a community maintained Jupyter Docker Stack image of the ESA SNAP toolbox (SNAP 8), installed with: apache-beam for parallel pre-procesing of remote sensing imagery; xarray; dask; scipy; matplotlib; seaborn; numpy; pandas; and ML frameworks, such as scikit-learn and tensorflow 2.X.
You can play around with the image by clicking on the binder badge below; however, remember to switch to the python38
kernel, otherwise you won't be able to used the installed packages.
The image is available on a Docker Hub repository. To download it, you can pull it with the following docker command (make sure you have docker installed):
$ docker pull jpvcosta/esa-snap-notebook
Then, you can run the image with a mounted volume like so:
$ docker run -p 8888:8888 -v /path/to/local/folder:/home/jovyan/work jpvcosta/esa-snap-notebook
If the previous command runs successfully, you should view the jupyterlab link on the terminal screen, which you can access by copying and pasting it on your browser.
The python wrapper of SNAP 8 is named snappy. However, there's also a package denominated snappy from google, which is used by xarray. Consequently, to avoid any conflicts, the SNAP package was renamed snappy_esa
, which you can import this package as follows:
import snappy_esa
# Read product from a given path
snappy_esa.ProductIO.readProduct("/path/to/product")
# Apply SNAP operations on product
# ...
This resource might be helpful if you want to learn how to use the SNAP API in Python. This tutorial and these example implementations might also be of use.
By default, the notebook memory limit of this image was set to 6GB, with a CPU limit of 6 cores. If you wish to alter these values, you'll have to build an image with this repository's Dockerfile, passing as --build-arg
the desired memory limit (in bytes) and CPU limit values with the mem_limit
and cpu_limit
arguments, respectively. For example, to build an image with a limit of 4GB (4294967296 bytes) and 4 cores, with the tag updated-esa-notebook
, you can use this command:
$ docker build -t updated-esa-notebook --build-arg mem_limit=4294967296 --build-arg cpu_limit=4 github.com/jpv-costa/ESA-SNAP-notebook.git#main
Upon successful completion of the build, you can run the updated image, as you did in this section, substituing jpvcosta/esa-snap-notebook
with your new image name: updated-esa-notebook
.