Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
user_area:generating_lookup_tables [2013/10/22 13:52]
josef
user_area:generating_lookup_tables [2013/10/28 13:39]
josef
Line 1: Line 1:
 ====== Generate lookup tables ​ ====== ====== Generate 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 ''​uvspec'',​ so that ''​uvspec''​ can not create lookup tables on its own. However, several scripting languages are available that can used to build looping-capable scripts around ''​uvspec''​. These scripts repeatedly call ''​uvspec''​ with varying input parameters and use the ''​uvspec''​ results to build up a lookup table.+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 ''​uvspec'',​ so that ''​uvspec''​ can not create lookup tables on its own. However, several scripting languages are available that can be used to build looping-capable scripts around ''​uvspec''​. These scripts repeatedly call ''​uvspec''​ with varying input parameters and use the ''​uvspec''​ results to build up a lookup table.
  
 In the following we show and explain example scripts coded in [[http://​en.wikipedia.org/​wiki/​Bash_%28Unix_shell%29|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. In the following we show and explain example scripts coded in [[http://​en.wikipedia.org/​wiki/​Bash_%28Unix_shell%29|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.
Line 15: Line 15:
  
 ==== Step 1: Create a input template ==== ==== Step 1: Create a input template ====
-You can create a template for the ''​uvspec''​ input file like you would do for any other ''​uvspec''​ input file, e.g. starting from an example in the ''​examples''​ folder or from the GUI. The main difference is that you have to replace the parameter you want to vary by a placeholder. In the provided example, we vary the aerosol optical thickness, thus the template file ''​uvspec.inp.template_1para''​ contains the following line +You can create a template for the ''​uvspec''​ input file like you would do for any other ''​uvspec''​ input file, e.g. starting from an example in the ''​examples''​ folder or from the GUI. The only difference is that you have to replace the parameter you want to vary by a placeholder. In the provided example, we vary the aerosol optical thickness, thus the template file ''​uvspec.inp.template_1para''​ contains the following line 
   aerosol_modify tau set <AOT>   aerosol_modify tau set <AOT>
 with the placeholder ''<​AOT>''​ for the variable aerosol optical thickness. In principle, a placeholder could be any unambiguous string, but for clarity we prefer using placeholders starting with "<"​ and ending with ">"​. Note, that all other options are fixed in ''​uvspec.inp.template_1para'',​ with the consequence that the lookup table is created for this specific setup. with the placeholder ''<​AOT>''​ for the variable aerosol optical thickness. In principle, a placeholder could be any unambiguous string, but for clarity we prefer using placeholders starting with "<"​ and ending with ">"​. Note, that all other options are fixed in ''​uvspec.inp.template_1para'',​ with the consequence that the lookup table is created for this specific setup.
  
-For easier processing of the radiance ​output it is advisable to use the input option ​+For easier processing of the ''​uvspec'' ​output it is advisable to use the input option ​''​output_user'',​ in our case
   output_user uu   output_user uu
-With this option, ''​uvspec''​ outputs only the radiances at the viewing anglesthat are specified by the ''​umu''​ and ''​phi''​ input options.+With this option, ''​uvspec''​ outputs only the radiances at the viewing angles that are specified by the ''​umu''​ and ''​phi''​ input options.
  
 ==== Step 2: Create a script ==== ==== Step 2: Create a script ====
Line 44: Line 44:
   echo ${parameter} `${uvspec_command} < ${uvspec_input_file}` >> ${output_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.  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 ''​sed''​ tool. The ''​sed''​ syntax for the replacement of ''​search_string''​ in a file by a ''​replacement''​ is "''​sed -i s/search_string/replacement/g filename''"​. As the "<"​ and ">"​ characters have a special meaning in Bash, they require a preceding "​\"​ here.+The second command replaces the placeholder by the actual input parameter value using the external ''​sed''​ tool. The ''​sed''​ syntax for the replacement of ''​searchstring''​ in a file by a ''​replacementstring''​ is "''​sed -i s/searchstring/replacementstring/g filename''"​. As the "<"​ and ">"​ characters have a special meaning in Bash, they require a preceding "​\"​ here.
 In the third line the ''​uvspec''​ tool is executed as an external command and its output is directed, together with the parameter value, to the lookup table file. In the third line the ''​uvspec''​ tool is executed as an external command and its output is directed, together with the parameter value, to the lookup table file.
  
Line 58: Line 58:
   * enter the correct ''​data_files_path''​ in ''​uvspec.inp.template_1para''​   * enter the correct ''​data_files_path''​ in ''​uvspec.inp.template_1para''​
  
-If your script ran without ​complains ​check out the contents of the lookup table. It is named ''​lookup_table_1para.txt''​ in our example.+If your script ran without ​complaints ​check out the contents of the lookup table. It is named ''​lookup_table_1para.txt''​ in our example.
 The provided bash script has added a header line containing the viewing directions for each column. ​ The provided bash script has added a header line containing the viewing directions for each column. ​
 The lookup table should look like this:  The lookup table should look like this: 
 
 
user_area/generating_lookup_tables.txt ยท Last modified: 2013/10/28 13:39 by josef
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Drupal Garland Theme for Dokuwiki