Table of ContentsGenerate lookup tables
It is sometimes required to generate lookup tables which, for example, contain radiances as function of one or more variable atmospheric parameters. Besides the wavelength loop, there is no looping over input parameters implemented in In the following we show and explain example scripts coded in Bash. The scripts generate lookup tables with simulated radiances for a satellite channel in the solar spectral range as function of one and two variable atmospheric parameters. The lookup tables are in ASCII format. The provided scripts can be adapted, e.g. for other setups or other sets of variable parameters etc. Script for one variable parameterFirst we describe an approach for looping over one variable input parameter. An example script with some required additional files is available here. (This example is for libRadtran version > 1.7)
Basically, there are three steps required for creating lookup tables using
Step 1: Create a input template
You can create a template for the aerosol_modify tau set <AOT>
with the placeholder
For easier processing of the output_user uu
With this option, Step 2: Create a script
After the input template has been created, a looping script needs to be created. In our example, the script file
The list of the variable input parameter values needs to be created. This list is stored in the variable parameter_list=`cat list_aot`
The parameter_list="0.0 0.1 0.2 0.5 1.0"
Or an equidistant grid can be created using the external command “ parameter_list=`seq 0.0 0.001 1.0`
The variable The for-loop for parameter in ${parameter_list} goes through the specified list of parameter values. For each parameter cp ${uvspec_input_template} ${uvspec_input_file} sed -i s/\<${parameter_name}\>/${parameter}/g ${uvspec_input_file} echo ${parameter} `${uvspec_command} < ${uvspec_input_file}` >> ${output_file}
is executed. The first command copies the template input file to the actual temporary input file.
The second command replaces the placeholder by the actual input parameter value using the external Step 3: Testing and runningThe script can be started now. The script in our example is executed on the command line with ./batch_uvspec_1para Depending on your setup, it may be required to
If your script ran without complaints check out the contents of the lookup table. It is named # AOT, umu 0.2 phi 0, umu 0.2 phi 60, umu 0.2 phi 180, umu 0.5 phi 0, umu 0.5 phi 60, umu 0.5 phi 180 0.000 4.355755615e+01 3.711856461e+01 4.831068802e+01 2.976097298e+01 2.829813576e+01 3.437047577e+01 0.001 4.413818741e+01 3.729845810e+01 4.845688248e+01 2.987973022e+01 2.834116173e+01 3.450103378e+01 0.002 4.474126053e+01 3.749518204e+01 4.862616730e+01 3.000129890e+01 2.839014435e+01 3.465411758e+01 ... There is a plotting script (requiring Python Matplotlib) provided in the example and called at the end of the Bash script. It plots the radiances as function of the variable parameter for the viewing directions specified in the template file. The AOT-dependence for the provided example is shown here:
This plot is for a satellite channel around 680nm (~10nm width), Script for two variable parameterThe script described above can be modified for processing more variable input parameters. In the following we briefly show how to extend it by a second variable parameter; the modified files are available here. We select the sun zenith angle as the second variable input parameter. So we have to replace the fixed sun zenith angle in the template by a placeholder: sza <SZA>
In the Bash script a further list of parameters is added. The two variables with the list of parameter values are now named # AOT, SZA, umu 0.2 phi 0, umu 0.2 phi 60, umu 0.2 phi 180, umu 0.5 phi 0, umu 0.5 phi 60, umu 0.5 phi 180 0.00 0 5.674485779e+01 5.674485779e+01 5.674485779e+01 5.222948837e+01 5.222948837e+01 5.222948837e+01 0.00 2 5.653916168e+01 5.662508774e+01 5.693395615e+01 5.201465607e+01 5.210604095e+01 5.239772034e+01 0.00 4 5.631779480e+01 5.646367645e+01 5.710541916e+01 5.175418854e+01 5.192774200e+01 5.251840973e+01 ... There is also a plotting script provided to illustrate the radiances in the lookup table for two variable parameters. In the provided example the result looks like this (note the different color scales): Additional variable parameters could be added analogously by modifying the template and script. (Plotting for more than two variable parameters however may not be as straightforward ) |