#!/bin/csh -f
echo "Content-type: text/html"
echo ""

setenv HD /data/globec

set tmp=$PATH_INFO
setenv OBJ $tmp:r
setenv FULLOBJ $OBJ
setenv QS ""
unsetenv PATH_INFO

if ( "$QUERY_STRING" != "" ) then
  setenv QS "`$HD/htmlbin/bin/htmlesc '$QUERY_STRING'`"
  setenv FULLOBJ "$OBJ($QS)"
endif

cat << XXSTUFFXX
<h1>$OBJ -- Transformations</h1>

<h2>Mathematical transformation</h2>

Enter a formula below, using the variables listed and either altering
one variable or creating a new one; e.g.,<p>
<tt>rho=28.5-0.2*temp+0.7*(sal-35)</tt><p>

Available operators are <tt>sin, cos, exp, ln, log10, int, +, -, *, /,
^</tt> and, of course, <tt>=</tt>. You can enter multiple formulae,
separated by commas. Do not include any blank spaces. Hit return when
finished.


<form action="/jg/mathopt${tmp}?${QS}" method="POST">
<input name="formula" type="text" size="80"></form><p>

Available variables are:<p>
XXSTUFFXX
$HD/bin/listvar ${OBJ}

cat << XXSTUFFXX
<h2>Dynamic Height Calculations</h2>

If <tt>press, temp, sal</tt> are included in the variables in the data
set (see list above), you can add columns for <tt>theta, sigth, svan,
dynhgt</tt> -- the potential temperature, potential density, specific
volume anomaly, and dynamic height. At the moment, all calculated
variables are referenced to the surface. Pressures must be increasing
in the data set. These things can be fixed.
<form action="/jg/dynopt${tmp}?${QS}" method="POST">
Press
<input type="submit" value="Here">
to add these columns.
</form><p>

<h2>Join with key file (e.g. log)</h2>

This allows you to join the data set with another containing
additional variables related to the ones in the current data set. For
example, you may wish to join the data with a log file which connects
even numbers to more detailed information. The join will be
accomplished by matching values of variables with the same names in the
two data sets. The second data set is buffered into memory and (at the
moment) is restricted to 2500 values. Enter the name of the second
data set and hit return.<p>
<form action="/jg/joinuopt${tmp}?${QS}" method="POST">
<input name="secondobj" type="text" size="80"></form><p>

XXSTUFFXX
