This tutorial will give you a basic overview of using the SNAP software to work with Sentinel-3 data from the OLCI and SLSTR instruments (we will cover altimetry data and SRAL using Python, but you can also look in to the BRAT software should you wish). This is by no means an exhaustive tutorial. We encourage you to explore the software during the online phase of the course, and there will be further time to discuss SNAP in more detail during the classroom phase. You can ask questions/share useful tools you are working with in the discussion forum attached to this part of the course. We would also recommend signing up to the STEP user forum, where you can find much more information about SNAP and ask questions to both other users and the developers of the software. Further tutorials on some SNAP functionalities are available here http://step.esa.int/main/doc/tutorials/snap-tutorials/
Locate SNAP where you have installed it and double click on the icon to open the software. If you have installed from the command line, you should be able to open from the terminal window.
The main window of the SNAP graphical user interface (GUI) should look something like the image below (you may get some differences between operating systems, and it is possible to customize the GUI to suit your own preferences i.e. you can drag and drop the subwindows/expand them, display different toolbars. You can select tool bars are window options under the ‘view’ menu in the top menu bar.
How to open files:
To open OLCI/SLSTR data, first click the ‘File’ option in the top menu bar. Then click ‘Open product’. Another window will open, allowing you to navigate through your file system to wherever you have stored your downloaded data. Once you have navigated to the folder containing the data you are interested in (if you haven’t unzipped the folder you will need to). Within the folder, select and open the xfdumanifest.xml file. This will import all the data associated with the file you downloaded.
You can also open data associated with individual products (e.g. the individual reflectance bands, or a chlorophyll product) as generic netcdf files (in fact SNAP can be used to read most netcdf files). This may be useful if you have limited computing power, or if you just want to work with a single variable/product. However you will not have access to all the appropriate metadata associated with the scene if you just open one of the individual netcdf files.
Once opened, the name of the data folder will appear on the right hand side of SNAP in the product explorer window. Clicking the small arrow to the left of the file name will expand the structure associated with your imported data. For OLCI and SLSTR data and at Level 1 and Level 2 this will look similar.
Right clicking on the data folder name will give you access to some general options for working with it e.g. perform basic mathematical operations using the ‘band maths’ tool, closing individual products or the whole product folder, saving products (any new products you create based on the data will appear in the product explorer window). In the case of OLCI you will also be able to quickly create an “RGB” image from these options, as well as an HSV – see below for further discussion of these tools. The properties option will give you some basic information about the data, particularly the time during which the data was sensed by the instrument.
Making a colour composite image using the RGB tool
One of the first things you may want to do if you are working with OLCI data is to make an RGB (red/green/blue) or “true colour” image, to see what the data looks like – in approximation to what it would look like to the human eye. This can be very useful for an initial assessment of whether the data is suitable for your application, and you may use it to answer some of the following questions:
- Does the data cover my area of interest?
- Is my area of interest obscured by cloud?
- Can I see a feature of interest that I am looking for? (This may not always be the case, and doesn’t necessarily mean you can’t use the data, but if a feature is obvious in the RGB, that’s a positive sign that the data will be useful).
- Can I see any obvious problems with the data? I.e. patterns that seem inconsistent with what I would expect.
You can access the RGB making tool in several ways in SNAP. As mentioned above, you can right click on the data folder name in the product explorer and select the “Open RGB image window” option. Within this window you can customize how the RGB image is created, by selecting different band combinations from the red, green, and blue areas of the spectrum, and scaling them. There are several default options for this, and they will usually suffice for a quick look image. However you may wish to stretch different parts to emphasise features, if you wish to save the images for explanatory purposes.
For level 1 OLCI data you can use the default tristimulus set of bands and scaling factors to generate an image like the one below.
You also have the option in the RGB window to save the individual RGB bands as ‘virtual bands’ that will then appear in the product explorer window, and can be looked at individually.
If you are interested in parameters such as chlorophyll and SST, it is likely that you will mostly be working with the level 2 data. It is however useful to be familiar with the level 1 data as well, should you need to troubleshoot the sources of errors/uncertainties in the imagery, or if you wish to develop new, perhaps regional methods for working with the data such as atmospheric correction techniques, new geophysical algorithms. There are examples of algorithms for estimating chlorophyll and other parameters directly from the level 1 data.
Generating an RGB from the level 2 OLCI data works identically to that described above, however you will note differences in the resulting images. Below is an example of the level 2 RGB equivalent of the image generated from the level 1 data shown above.
Land and cloud is clearly flagged in this image (in white). You can also manipulate the colour scaling on the RGB images using the colour manipulation tool window (described below) and this can enhance the features observable in the level 2 RGB (see image below).
Opening and viewing specific products
Regardless of which data you are working with (OLCI/SLSTR at L1 or L2), most of the geospatial data you are interested in will be held under the bands folder seen in the product explorer window. Clicking on any of the products listed under the bands folder will open an image display of the data selected. The section of the GUI below the product explorer contains a number of windows that can assist with navigating and displaying these images. You can also right click on the product names in the product explorer window to perform some operations on the data, and view its properties.
Firstly the navigation window allows you to move around the image, and synchronise views across multiple images if you have them open.
To the right of the navigation window in the sub menu, you can select the colour manipulation window. Here you can apply different colour palettes by selecting the icon. The colour palette you select will depend on the variable you are visualising. You can select types of scale (e.g. log10 which is commonly used for chlorophyll). You can adjust the colour scale manually using the slider arrows, and save any palette you create by using the icon. Below is an example for the CHL_OC4ME chlorophyll a product from OLCI, with the meris_algal.cpd applied.
This is displayed in the next window along, where available (not all products have associated uncertainty estimates). You can scale a coloured overlay to show this data.
the world view window shows you where the data is located on a world map.
This can be used to edit layers when you have multiple layers loaded.
One of the most important things to consider when working with any satellite data, is the information that can be gained on the quality of the data from masks/flags. OLCI and SLSTR data come with an extensive list of quality flags which can be used to assess quality and mask data. These are easily visualised in SNAP.
To look at flag layers you need to access the mask manager. This may already be on display in your GUI using this icon . Or you can access by selecting View>Tool Windows>Mask manager in the top menu bar.
You can apply the masks over the data by clicking the tick box. An example below shows some commonly used flags overlain on an OLCI chlorophyll product.
You can also change the colour of the flags, to highlight particular issues of interest. In the example below, the OC4ME fail flag has been changed to red to show where data from this algorithm may be erroneous.
The pixel information window can be selected from the submenu bar next to the product explorer. This window will display information associated with a pixel selected by the cursor. It is useful for getting a quick idea of the range of a variable, or the location of a feature.
The pin tool is very useful for selecting data at a number of different points in an image. You can place a pin using this icon . If this icon is not displayed, you can display it by selecting View>Toolbars>Tools under the main menu. Once selected, you can place pins which will appear on the image. You can select ‘Snap to selected pin in the pixel information window to view information associated with the currently selected pin, or you can use the pin manager (icon ) to look at the information associated with all the pins. By clicking the icon in the pin manager, you can filter which data you would like to see associated with the pins. You can also add new pins from the pin manager, this is particularly useful if you already have coordinates of interest to work with. You can then export this information to a text file output using the icon.
The example below shows 3 pins set in different parts of an image. You can see a comparison of chlorophyll concentration varying over the image, and replaced by a NaN where the data is flagged.
You can also select regions in a variety of ways using the tools symbolized by these icons:
The data files from Sentinel 3 can be quite large, and if you are working with lots of daily, higher resolution data, these can soon add up. You may then wish to subset the data, to store/work with smaller files. You can do this subsetting in SNAP as part of the export function.
To do this, make sure the product file name is highlighted in the product explorer, then selected File>Export>*your desired export format* from the menu. This will open the window below.
Be sure to name your file something distinct to prevent writing over any of the original files you downloaded.
You can then click subset and select the region (under spatial subset, by pixel or geo coordinate, or by dragging and the box on the thumbnail image) and products (under band subset) that you wish to save.
This is a particularly useful tool for applying simple algorithms or generating your own masks for data.
Select Raster>Band Maths from the top menu bar and the window below will open. Here you can create your own new product, give it associated metadata, and save it (by deselecting Virtual, it will appear as a product and can be exported).
Clicking edit expression will allow you to input your mathematical expression, and there are various mathematical functions available to facilitate this.
Under the Optical tab in the top menu bar, you will find a spectrum viewer (the icon in the menu bar looks like this ). This is very useful when working with OLCI data as it allows you to see the ocean colour spectrum across all of OLCIs radiance bands. You can hold down shift to scale the graph as you browse across an image, and the spectrum under the current cursor position will show. You can also show the spectrum associated with any placed pins, and extract the spectra to a text file using the icon .
SNAP also offers the facility to apply certain processors including different algorithms, cloud edge detection, and level 3 binning of multiple products. These can be accessed under the Raster and Optical tabs in the top menu bar.
Batch processing and graph processor
The SNAP GUI is very useful for working with single data files and understanding the details in individual images. However you can see that if you needed to repeat analysis on lots of images, that using a GUI would be very slow. For this reason you can integrate SNAP with programming languages and run operations repeatedly from the command line. To facilitate this approach, the SNAP GUI has a graph builder tool, and batch processing functionality. These can be found under the Tools tab in the top menu bar.