
Delivered-To: rgroman@globec.whoi.edu
Date: Mon, 14 Jun 1999 16:03:55 -0400
From: JGOFS Data System <jgofs@chips1.gso.uri.edu>

#!/bin/csh -f
#
# modhtml3.bisagni script
#
# Modified 1/24/1996 rcg Add access to rmp and *.nav and *.nav.Z
# 	files the subdirectory.  
# 7/26/95 RCG
# From G. Flierl, 2/16/95
# Used with defexec method for serving satellite images.  Script
# generates the list of available satellite images, according to
# their dates (after preselecting by type based on passed parameter
# $1) and year ($2).  The user will see each line as a hypertext link.
# When clicked, the cgi that is called will convert the specified image
# to gif format and pass it to caller.
#

set version="#modhtml3.bisagni V3.00"
set image_type=$1
set year=$2

#	set image_type="k"
#	set year="1995"

#					 echo " "
#					echo "image_type = $image_type"
#					 echo "year = $year"
set initpath="/pathfdr1/xbrowse/avhrr"
set monthlistpath="/pathfdr1/jgofs/data"
if (! -e $initpath ) then
  echo " *Cannot continue with displaying satellite image view"
  echo "$initpath is not directory or does not exist"
  exit
endif

cd $initpath
#					 echo "Change directory to: `pwd`"
# Check for directory validity
if (-d $year) then
	set months=`ls -1p $year | grep "/" | sort -n | sed 's/\// /g'`

#					     echo "months = $months"

# Find months and list out
	set first=0
	if (${#months} > 0 ) then
		echo "$version"
		echo "month	year	>"
		echo "status[width=11]	yrday_gmt	time"

		foreach month ($months)
#       					echo "month = $month"
			set dirpath=$initpath/$year/$month/${image_type}
			set count=`ls -1 ${dirpath}*[.Z,.nav,.rmp]  |& fgrep -c "No match"` 
			if ($count == 0) then
				if ($first == 0 ) then
					set first=1
				endif
				cat <<XSTUFF
${month}	"$year"	(${monthlistpath}/monthlist3.bisagni ${month} $image_type $year $initpath)
XSTUFF
			endif

		end
	endif

endif
