Home On-line Data Access FAQ Software Download
Documentation EPIC Contacts What's New Site Map
 
EPIC Programs Database Management EPIC I/O Library Matlab MexEPS
Web Utilities X-Motif Interface PPLUS Graphic Package Java

EPIC Web Utilities -- COVER
"How-to" description

We will use "CTD data display using COVER utility" page as example to show you how to use 'cover' utility for executing a script or any executable image from html, on the fly.

 

1) Create an HTML document like 

this example page, using:

<FORM METHOD="POST" ACTION="/epic-bin/cover">

2) The script to be executed must be:

  - listed by name in epic-bin/cover.scripts, 
    e.g.,  If the script is epic-bin/cover-demo/plot-4.csh
           Then put this line into epic-bin/cover.scripts:

                 /bin/csh cover-demo/plot-4.csh 

  - named in the HTML document as a forms INPUT, 
    e.g., If the script is epic-bin/cover-demo/plot-4.csh 
          Then use HTML such as:

           <INPUT TYPE="radio" NAME="script" CHECKED 
                  VALUE="cover-demo/plot-4.csh" >

3) Parameters can be passed to the script by collecting their 
   values from FORMS input.  Default for the first parameter 
   is 'P1', second one is 'P2', etc.  Example HTML:

   <SELECT NAME="P1">
   <OPTION VALUE=ep489c002_ctd > 140.1117 W  _   2.0133 S
   <OPTION> ........................
   </SELECT>

   followed by:

   <INPUT TYPE="hidden" VALUE=ep489c002_ctd NAME="@140.1117 W  _   2.0133 S" >

   Notes:  The '.....' stuff is necessary because PC Browsers
   don't display properly without it.

4) The script itself can do anything with the parameters 
   the user has input on the FORMS.  Examples are ASCII 
   listings or PLOTS.  Images can easily be created on-the-fly, 
   and plots can be cached.  This is all easy to do in the 
   script.  

5) ASCII listings on-the-fly:  An example script is 
   epic-bin/cover-demo/ctdlst-run.csh which has only a single 
   paramter as input, namely, the file name without the extension 
   '.nc'.  The script contains 

   - environment variables to set paths so the EPIC listing 
     program will run properly  

   - the path specification for the directory containing the 
     data files (in netCDF format in this case) 

   - the path for the temp directory in which junk files are made

   - the shell commands to run the EPIC listing program with 
     an appropriate input file, which is created by the shell 
     as a temp file.  

   - the listing is created as a disk file 
     and cat is used to put it on the screen for the user.  

   - the listing files could easily be cached (they aren't now)

   - the script ends by doing a cleanup of the temp files.

6) PLOTS can be made on-the-fly:  An example script is 
   epic-bin/cover-demo/plot-ts.csh which has only a single 
   paramter as input, namely, the file name without the 
   extension '.nc'.  The script contains 

   - environment variables to set paths so PPLUS will run properly  

   - the path specification for the directory containing the 
     data files (in netCDF format in this case) 

   - the path for the temp directory in which junk files are made
     the path for the cache directory in which graphics files 
     are cached.

   - the shell commands to run a PPLUS script (.ppc file) with 
     the data file name as an input parameter.  

   - the plot is created by PPLUS as a metacode file, which 
     is converted by m2gif to a GIF file.  

   - the shell script uses 'echo' to write HTML to standard 
     unix output (stdout), including <IMG SRC="the-gif-file"> 
     to put the PLOT on the screen as a clickable in-line image 
     for the user.  

   - the GIF files are cached (trivial with the script) in 
     a non-colliding fashion (this means that multiple users 
     can try to make the same plot at the same time and 
     the procedure will not fail.

   - the script ends by doing a cleanup of the temp files.

7) Download of netCDF files is accomplished a shell script 
   such as /epic-bin/cover-demo/cdf-url.csh, which uses 'echo' to 
   put the netCDF file out as a URL:

   echo "Location: http://www.pmel.noaa.gov/epic/demo-data/$1.nc"
   echo ""

If you have any questions about COVER utility please contact: epic@pmel.noaa.gov or Mark Renton (the author) renton@pmel.noaa.gov

 
NOAA PMEL EPIC EPIC