#!/bin/csh

#set subset = `cat ../common/regional_czcs.lis | cut -c"1-6"`
set subset = `cat ../common/regional.lis | cut -c"1-6"`
set param  = "ang aot chl eps nlw senz solz sst"

foreach p ($param)

set ofile="comp_regional_${p}_mission.tpl"

if ($p == "chl" ) set name = "Chlorophyll"
if ($p == "ang" ) set name = "Angstrom"
if ($p == "aot" ) set name = "AOT"
if ($p == "eps" ) set name = "Epsilon"
if ($p == "nlw" ) set name = "nLw"
if ($p == "sst" ) set name = "SST"
if ($p == "solz") set name = "Solar Zenith"
if ($p == "senz") set name = "Sensor Zenith"

echo "<html>" > $ofile
echo  "<head>" >> $ofile
echo  "    <title>SENNAM $name Trends</title>" >> $ofile
echo  "  </head>" >> $ofile
echo  " " >> $ofile
echo  "<CENTER>" >> $ofile
echo  " " >> $ofile
echo  "  <body>" >> $ofile
echo  "    <h1>SENNAM $name Trends (TESTID)</h1>" >> $ofile
echo  "    <h2>Regional Subsets</h2>" >> $ofile
echo  "    Derived from Binned Level-3<br>" >> $ofile
echo  "<p>" >> $ofile
echo  "<TABLE width="100%">" >> $ofile
echo  "  <TBODY>" >> $ofile

foreach s ($subset)

echo  "    <TR>" >> $ofile
echo  "      <TD align="CENTER"><B>$name, $s Subset</B></TD>" >> $ofile
echo  "      <TD align="CENTER"><B>$name Ratios,  $s Subset</B></TD>" >> $ofile
echo  "    </TR>" >> $ofile
echo  "    <TR>" >> $ofile
echo  "      <TD align=CENTER><a href=plots/TESTID_${s}_${p}_comp.gif><IMG src=plots/TESTID_${s}_${p}_comp.small.gif></a></TD>" >> $ofile
echo  "      <TD align=CENTER><a href=plots/TESTID_${s}_${p}_ratio.gif><IMG src=plots/TESTID_${s}_${p}_ratio.small.gif></a></TD>" >> $ofile
echo  "    </TR>" >> $ofile

end

echo  "  </TBODY>" >> $ofile
echo  "</TABLE>" >> $ofile
echo  " " >> $ofile
echo  "    <hr>" >> $ofile
echo  " " >> $ofile
echo  "</CENTER>" >> $ofile
echo  "    <address><a href="mailto:franz@seawifs.gsfc.nasa.gov">Bryan A. Franz</a></address>" >> $ofile
echo  "  </body>" >> $ofile
echo  "</html>" >> $ofile

end
