In this tutorial, we will learn the basic usage of the ALG software tool, i.e., how to generate a new atmospheric LUT. We will also show how to extract and analyse the LUT data produced by ALG with basic examples for plotting, constructing top-of-atmosphere (TOA) radiance and atmospheric correction.
This tutorial is aimed for basic users of ALG and for those users who want to review the steps of creating a new atmospheric LUT.
Note: On this page, we will use the MATLAB® notation (and commands) for the operations with the LUT data (e.g., reading files, plotting). However, similar commands can be found in other programing languages (e.g., Python, C/C++, Fortran).
On this page… |
---|
Creating a new LUT
In this first section, we will learn how to create a basic LUT based on the execution of the 6SV atmospheric RTM. For sake of simplicity, and in order to reduce the computation time, we will create a gridded LUT, varying two values for the following key input variables: water vapor content, aerosol model, aerosol optical thickness (AOT) and solar zenith angle. The LUT will therefore have a total of 16 nodes (i.e., combination of the input variables). The 6SV simulations will be carried out in a continuous spectral range between 400 nm and 2500 nm.
We start by pressing the New LUT configuration button at the
top-left of the menu bar on the ALG graphical user interface. This will open the LUT configuration panel at the
General Configuration step.
On this step, we first click on the … button at the right of the Saved LUT file(s) text box and select
the folder and file name where we will store our LUT files (e.g., C:\ALG\LUTs_folder\tutorial1). Secondly, we will choose
2 as the # of parallel runs and leave the user level as basic. We can then select six6V (as
for 6SV) in the RTM pop-up menu, and the Transfer Functions (only available option) as operation mode. Finally,
we choose the Manual (gridded) sampling as our LUT sampling strategy. For this sampling strategy, the evaluation
of the stop condition is automatically set to Input max. # of samples. We can click on the Next button at the
bottom-right of the screen to proceed with the next step.
We continue by defining the LUT key input variables and their values. We start by pressing on the Atmospheric group and selecting the H2O column concentration parameter. On the distribution sub-panel, we introduce the numbers 1 and 4 respectively for the minimum and maximum values. We will only include 2 samples in this range, therefore the values distribution is not relevant (select any e.g., linear). Click on the Add parameter button (or press ↵) to add these values on the table:
We now press on the Aerosols group and select the Aerosol model parameter. We select the Maritime and Urban options on the list by clicking on them with the Ctrl. key pressed. We can then press ↵ to add these values on the table:
We repeat these steps above in order to include the following variables and values, both with 2 samples each:
The variables table summarizes these input values:
We then move to the Sensor Spectral Configuration step, which will be the last in the LUT configuration since 6SV does not have advanced parameters. Here we will create a single continuous spectral band from 0.4 μm to 2.5 μm at 2.5 nm spectral resolution.
The introduced LUT configuration parameters are stored in a configuration file (tutorial1.xml) that will be used to run the selected RTM and create the LUT input and output files.
After pressing the Next button, ALG will create two sub-folders (due to the selected 2 parallel runs) with names tutorial1_1 and tutorial1_2 where the input and output RTM files (.in and .out respectively for 6SV) will be automatically saved. In the case of 6SV, these input/output files will have as name combN_bandL, where N is an index between 1 and 16 (one per LUT node combination) and L is a number defining each of the spectral bands defined in the configuration (L=1 in our case since only one continuous spectral range has been defined). A progress bar will show the writing of the 6SV input files and, after its completion, two parallel executions of 6SV will run the simulations for these RTM input files:
Once these simulations have finished, we can generate the atmospheric LUT from these RTM files.
On the menu bar, press the New LUT generation button and select the LUT
configuration .xml file. ALG will automatically load the LUT configuration, generating the LUT key input parameters into a header
file (tutorial1.hdr)* and
processing/storing the RTM output files into the LUT output file (tutorial1.h5).
*Note: From version v.1.2, ALG stores the LUT header information in the same .h5 file as the LUT data. All steps related with reading the LUT header are valid replacing the extension .hdr by .h5.
Extracting and reading LUT data
In this second section, we will give an overview of basic operations for reading the LUT input and output data files. Once generated the LUT input and output data, we can proceed to study the produced outputs. We start by reading the LUT key input variables stored in its header file (tutorial1.hdr). To read this information, ALG provides the readLUTheader function, which is used to read the content of the LUT header file and store the relevant information in a structure:
hdr = readLUThdr([filename,'.hdr']);
In the above command line, filename represents the path and file name of our LUT files (e.g, C:\ALG\LUTs_folder\tutorial1). The header is therefore stored in the variable hdr, which is a structure with the following fields:
hdr.sza = 30.000 30.000 30.000 30.000 30.000 30.000 30.000 30.000 60.000 60.000 60.000 60.000 60.000 60.000 60.000 60.000
hdr.LUTheader = 2.000 3.000 2.000 3.000 2.000 3.000 2.000 3.000 2.000 3.000 2.000 3.000 2.000 3.000 2.000 3.000 1.000 1.000 4.000 4.000 1.000 1.000 4.000 4.000 1.000 1.000 4.000 4.000 1.000 1.000 4.000 4.000 0.050 0.050 0.050 0.050 0.400 0.400 0.400 0.400 0.050 0.050 0.050 0.050 0.400 0.400 0.400 0.400 30.000 30.000 30.000 30.000 30.000 30.000 30.000 30.000 60.000 60.000 60.000 60.000 60.000 60.000 60.000 60.000
Notice that the key input variables are not ordered in the same order that were introduced in the table.
Y = h5read([filename,'.h5'],'/LUTdata');
The variable Y contains the LUT of Nt=5 atmospheric transfer functions in a matrix of size (Nt·k)×m. As it can be read in the LUT header file, for 6SV these atmospheric transfer functions consists of:
We can therefore separate the LUT output matrix Y into these atmospheric transfer functions taking into account that each of these functions have the same number of wavelengths:
L0 = Y(1:numel(hdr.wvl),:); Tgas = Y(numel(hdr.wvl)+1:2*numel(hdr.wvl),:); Etot = Y(2*numel(hdr.wvl)+1:3*numel(hdr.wvl),:); Ttot = Y(3*numel(hdr.wvl)+1:4*numel(hdr.wvl),:); S = Y(4*numel(hdr.wvl)+1:5*numel(hdr.wvl),:);
Among other possibilities, we can use these atmospheric transfer functions (1) to create TOA radiance spectra from a given surface reflectance, or (2) the inverse way i.e., to make an atmospheric correction of a TOA radiance
.Basic operations: TOC2TOA and Atmospheric Correction
We can propagate the top-of-canopy Lambertian reflectance ρ to construct TOA radiance (L) with the following equation (1):
$$L = L_0 + {T_{gas}·E_{tot}·T_{tot}·ρ}/{π(1-Sρ)}$$Let us consider the following surface reflectance, which has been previously resampled to the wavelengths in hdr.wvl:
For this surface reflectance, let us now construct the TOA radiance for all combinations in our LUT:
LTOA = L0 + (1/pi)*(bsxfun(@times,Tgas.*Etot.*Ttot,rho))./(1-bsxfun(@times,S,rho));
And now filter them to select those combinations with the maritime aerosol model (MAERO=2):
filter1 = hdr.LUTheader(1,:)==2; LTOA = LTOA(:,filter1);
The following figure shows the resulting TOA radiances:
In this plot, there are two pairs of visible lines each pair. The two solid lines correspond to the simulations with a solar zenith angle of 30 deg while the two dotted lines correspond the simulations with a solar zenith angle of 60 deg. The two colors represent simulations with an AOT of 0.05 (in green) and 0.4 (in cyan). These 4 curves are overlapping other 4 with the same combinations of solar zenith angle and AOT but with a different value of water vapor.
Lets now perform an atmospheric correction of these TOA radiances but using instead the urban aerosol model (MAERO=3). The correction is achieved by inverting the equation (1), which leads to the following equation (2):
$$ρ = {π(L - L_0)}/{T_{gas}·E_{tot}·T_{tot} + πS·(L - L_0)}$$In Matlab:
filter2 = hdr.LUTheader(1,:)==3; A = pi*(LTOA - L0(:,filter2)); B = Tgas.*Etot.*Ttot; B = B(:,filter2); rho_corr = A./(B+A.*S(:,filter2));
This atmospheric correction obtains the following 8 reflectance spectra (solid lines) after the atmospheric correction (notice the red-dashed line as the original surface reflectance):
The 4 visible surface reflectance correspond to a single value of water vapor while the other 4 (with a different water vapor) are overlapped. The top two curves (blue and cyan) correspond to an AOT of 0.4 and the two bottom curves (yellow and green) correspond to an AOT of 0.05. Indeed, the larger the AOT, the bigger will be the influence on the atmospheric correction of considering a different aerosol model.