#!/bin/csh 

set id1 = $1
set id2 = $2

#if ( "$#" > 2 ) then
    set dir = ${3}
#else
#    set dir = ${id2}_${id1}
#endif

set sen1 = "`scripts/get_sensor.csh $id1`"
set sen2 = "`scripts/get_sensor.csh $id2`"
set sennam = "${sen2}(${id2})-vs-${sen1}(${id1})"
set testid = $dir
set ofile = index.html

cd $dir

echo "<html>" > $ofile
echo "  <head>" >> $ofile
echo "    <title>Test Trends</title>" >> $ofile
echo "  </head>" >> $ofile
echo "<center>" >> $ofile
echo "  <body>" >> $ofile
echo "<br>" >> $ofile
echo "<h1>$sennam</h1>" >> $ofile
echo "<h1>Evaluation of Processing Changes</h1>" >> $ofile
echo "<table>" >> $ofile
echo "<tr>" >> $ofile
echo "<td>" >> $ofile

if (-e tables) then

../scripts/make_dir_html.csh stats
../scripts/make_cumstat_html.csh tables

echo "<hr>" >> $ofile
echo "<h1>Tables</h1>" >> $ofile
echo "<li><a href=tables>Cumulative Statistics</a></li>" >> $ofile
echo "<li><a href=stats>Trend Files</a></li>" >> $ofile
echo "<p>" >> $ofile
endif

if (-e hplots) then
  ../scripts/make_hist_html.csh $id1 $id2 hist_comp.html
echo "<hr>" >> $ofile
echo "<h1>Distributions</h1>" >> $ofile
echo "<li><a href=hist_comp.html>Regional Histogram Distributions</a></li>" >> $ofile
echo "<p>" >> $ofile
endif

if (-e vplots) then
echo "<hr>" >> $ofile
echo "<h1>Comparison of Level-2 with Level-3</h1>" >> $ofile
echo "<li><a href="residual_rvs.html">Residual Scan Dependence</a></li>" >> $ofile
echo "<li><a href="residual_det.html">Residual Detector Dependence</a></li>" >> $ofile
echo "<p>" >> $ofile
endif

if (-e lplots) then
echo "<hr>" >> $ofile
echo "<h1>Latitudinal Trend Comparisons</h1>" >> $ofile
echo "<li><a href="lat_trends_deep.html">Deep-Water nLw</a></li>" >> $ofile
echo "<li><a href="lat_trends_olig.html">Oligotrophic-Water nLw</a></li>" >> $ofile
echo "<p>" >> $ofile
endif

if (-e aplots) then
../scripts/make_anom_html.csh $id1 $id2 anomaly.html
echo "<hr>" >> $ofile
echo "<h1>Seasonal Anomaly Plots</h1>" >> $ofile
echo "<li><a href="anomaly.html">Temporal Anomalies</a></li>" >> $ofile
echo "<p>" >> $ofile
endif

#if (-e tplots) then
#../scripts/make_taylor_html.csh $id1 $id2 taylor.html
#echo "<hr>" >> $ofile
#echo "<h1>Correlation Statistics</h1>" >> $ofile
#echo "<li><a href="taylor.html">Taylor and Target Diagrams</a></li>" >> $ofile
#echo "<p>" >> $ofile
#endif

#if (-e plots) then 
#../scripts/make_repeat_html.csh $id1 $id2
#echo "<hr>" >> $ofile
#echo "<h1>Annual Cycle Comparisons</h1>" >> $ofile
#echo "<li><a href="comp_global_nlw_repeat.html">nLw, Global</a></li>" >> $ofile
#echo "<li><a href="comp_global_chl_repeat.html">Chlorophylls, Global</a></li>" >> $ofile
#echo "<p>" >> $ofile
#endif


if (-e plots) then 
../scripts/make_comp_html.csh $id1 $id2 $dir
echo "<hr>" >> $ofile
echo "<h1>Temporal Test Comparisons</h1>" >> $ofile

if (-e comp_global_rrs_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_rrs_mission.html">Rrs Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_rrs_mission.html">Rrs Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_rrs_mission.html">Rrs Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_rhos_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_rhos_mission.html">Rho_s Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_rhos_mission.html">Rho_s Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_rhos_mission.html">Rho_s Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_nlw_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_nlw_mission.html">nLw Mission Trends, Global</a></li>" >> $ofile
echo "<li><a href="comp_regional_nlw_mission.html">nLw Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_nlw_mission.html">nLw Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_chl_mission.html) then

echo "<br>" >> $ofile
echo "<li><a href="comp_global_chl_mission.html">Chl Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_chl_mission.html">Chl Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_chl_mission.html">Chl Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_kd_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_kd_mission.html">Kd Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_kd_mission.html">Kd Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_kd_mission.html">Kd Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_a_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_a_mission.html">a Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_a_mission.html">a Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_a_mission.html">a Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_aph_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_aph_mission.html">aph Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_aph_mission.html">aph Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_aph_mission.html">aph Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_adg_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_adg_mission.html">adg Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_adg_mission.html">adg Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_adg_mission.html">adg Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_bb_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_bb_mission.html">bb Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_bb_mission.html">bb Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_bb_mission.html">bb Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_bbp_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_bbp_mission.html">bbp Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_bbp_mission.html">bbp Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_bbp_mission.html">bbp Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_rrsdiff_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_rrsdiff_mission.html">IOP Rrs Diff Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_rrsdiff_mission.html">IOP Rrs Diff Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_rrsdiff_mission.html">IOP Rrs Diff Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_tau_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_tau_mission.html">AOT Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_tau_mission.html">AOT Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_tau_mission.html">AOT Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_aot_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_aot_mission.html">AOT Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_aot_mission.html">AOT Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_aot_mission.html">AOT Mission Trends, Zonal</a></li>" >> $ofile
endif


if (-e comp_global_eps_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_eps_mission.html">Epsilon Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_eps_mission.html">Epsilon Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_eps_mission.html">Epsilon Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_angst_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_angst_mission.html">Angstrom Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_angst_mission.html">Angstrom Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_angst_mission.html">Angstrom Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_solz_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_solz_mission.html">Solar Zenith Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_solz_mission.html">Solar Zenith Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_solz_mission.html">Solar Zenith Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_senz_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_senz_mission.html">Sensor Zenith Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_senz_mission.html">Sensor Zenith Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_senz_mission.html">Sensor Zenith Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_par_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_par_mission.html">PAR Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_par_mission.html">PAR Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_par_mission.html">PAR Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_npp_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_npp_mission.html">NPP Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_npp_mission.html">NPP Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_npp_mission.html">NPP Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_sst_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_sst_mission.html">SST Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_sst_mission.html">SST Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_sst_mission.html">SST Mission Trends, Zonal</a></li>" >> $ofile
endif

if (-e comp_global_ozone_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_ozone_mission.html">Ozone Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_ozone_mission.html">Ozone Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_ozone_mission.html">Ozone Mission Trends, Zonal</a></li>" >> $ofile
endif


if (-e comp_global_pressure_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_pressure_mission.html">Pressure Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_pressure_mission.html">Pressure Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_pressure_mission.html">Pressure Mission Trends, Zonal</a></li>" >> $ofile
endif


if (-e comp_global_windspeed_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_windspeed_mission.html">Windspeed Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_windspeed_mission.html">Windspeed Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_windspeed_mission.html">Windspeed Mission Trends, Zonal</a></li>" >> $ofile
endif


if (-e comp_global_ozone_mission.html) then
echo "<br>" >> $ofile
echo "<li><a href="comp_global_humidity_mission.html">Humidity Mission Trends, Global </a></li>" >> $ofile
echo "<li><a href="comp_regional_humidity_mission.html">Humidity Mission Trends, Regional</a></li>" >> $ofile
echo "<li><a href="comp_zonal_humidity_mission.html">Humidity Mission Trends, Zonal</a></li>" >> $ofile
endif

endif

if (-e images) then
#../scripts/make_image_html.csh $id1 $id2
echo "<p>" >> $ofile
echo "<hr>" >> $ofile
echo "<h1>Subset Chlorophyll Image Comparisons</h1>" >> $ofile
echo " <li><a href=deep_chlor_a_images.html>Deep Water Chlorophyll Images</a></li>" >> $ofile
echo " <li><a href=olig_chlor_a_images.html>Oligotrophic Chlorophyll Images</a></li>" >> $ofile
echo " <li><a href=meso_chlor_a_images.html>Mesotrophic Chlorophyll Images</a></li>" >> $ofile
echo " <li><a href=eutr_chlor_a_images.html>Eutrophic Chlorophyll Images</a></li>" >> $ofile
endif

#<p>
# <li><a href=Hawaii_chlor_a_images.html>Hawaii Chlorophyll Images</a></li>
# <li><a href=AtlNE_chlor_a_images.html>AtlNE Chlorophyll Images</a></li>
# <li><a href=Sarg_chlor_a_images.html>Sargasso Chlorophyll Images</a></li>
# <li><a href=CMed_chlor_a_images.html>Central Mediteranean Chlorophyll Images</a></li>
# <li><a href=EAtl_chlor_a_images.html>East Atlantic Chlorophyll Images</a></li>
# <li><a href=NPac_chlor_a_images.html>North Pacific Chlorophyll Images</a></li>
# <li><a href=EAust_chlor_a_images.html>East Australia Chlorophyll Images</a></li>
# <li><a href=WAust_chlor_a_images.html>West Australia Chlorophyll Images</a></li>
# <li><a href=Wmpl_chlor_a_images.html>Warm Pool Chlorophyll Images</a></li>
#<p>
# <li><a href=AtlN55_chlor_a_images.html>AtlN55 Chlorophyll Images</a></li>
# <li><a href=PacN45_chlor_a_images.html>PacN45 Chlorophyll Images</a></li>
# <li><a href=PacN35_chlor_a_images.html>PacN35 Chlorophyll Images</a></li>
# <li><a href=PacN25_chlor_a_images.html>PacN25 Chlorophyll Images</a></li>
# <li><a href=PacN15_chlor_a_images.html>PacN15 Chlorophyll Images</a></li>
# <li><a href=PacEqu_chlor_a_images.html>PacEqu Chlorophyll Images</a></li>
# <li><a href=PacS15_chlor_a_images.html>PacS15 Chlorophyll Images</a></li>
# <li><a href=PacS25_chlor_a_images.html>PacS25 Chlorophyll Images</a></li>
# <li><a href=PacS35_chlor_a_images.html>PacS35 Chlorophyll Images</a></li>
# <li><a href=PacS45_chlor_a_images.html>PacS45 Chlorophyll Images</a></li>
# <li><a href=AtlS55_chlor_a_images.html>AtlS55 Chlorophyll Images</a></li>

#../scripts/make_dir_html.csh tables

exit 0
