Return to LAS FAQ


Scripts and templates


Question:

Can I modify the scripts Ferret uses to generate output?

Example:

Here an alternate visualization script was used that plots data sampling locations over a data product generated by objective analysis.

[Output Graphic]

Explanation:

LAS data providers can associate custom scripts with a dataset or variable by adding properties to the XML configuration file. Two script related properties include the init_script property and the script_prefix property.

Solution:

Script related properties are specified in the .xml files in the same manner as other properties:

   <properties>
    <ferret>
     <init_script>define_aco2</init_script>
     <script_prefix>co2_survey_</script_prefix>
    </ferret>
   </properties>

The initialization script, define_aco2.jnl in this case, should reside in the server/jnls directory and can be used to create virtual variables from other variables in the dataset.

The script prefix, "co2_survey_" above, is prepended to the "std_" template or journal files when LAS requests output. In our case, a request for a plot will use the template file co2_survey_std_gif.tmpl to generate a sequence of commands to Ferret. A request for data would call co2_survey_std_list.jnl.

The server code (server/Ferret.pl) uses the following algorithm to decide which script to use:

# 1) look for template file with script prefix
# 2) look for template file without script prefix
# 3) look for journal file with script prefix
# 4) look for journal file without script prefix

For plots not using templates, <view>ref is tacked on to maintain backwards compatibility.

So, if you request an XY plot of a variable with a script_prefix named "foo_", the server would look for:

  1. foo_std_gif.tmpl
  2. std_gif.tmpl
  3. foo_std_gif_xyref.jnl
  4. std_gif_xyref.jnl


Jonathan Callahan: Jonathan.S.Callahan@noaa.gov
Last modified: September 19, 2000