#!/bin/csh -f ############################################################################# # # This script will create and maintain a database that will aid in # understanding the seeing at the Danish telescope. The script requires 4 # arguments, these being: # # (1) DFOSC Filter # (2) FASU A Filter # (3) FASU B Filter # (4) Vents -- were the vents on (y) or off (n) # (5) Fans -- were the mirror fans on (y) or off (n) # (6) FWHM_X -- the X fwhm measured on the DFOSC frame. # (7) FWHM_Y -- the Y fwhm measured on the DFOSC frame. # # The script gathers meteo and DIMM information via an FTP to the # meteomonitor workstation, gathers TCS information using the C-program # `rdval' to contact tcs1d5, and uses the C-program `focusValue' to read # the current telescope focus value. All of the data is then combined and # written to a database file using the C-program `w2see_db'. # # This script is called by the MIDAS batch ~meteomonitor/midas/seeing.prg, # and this batch provides the arguments. # # Author: James Brewer # Version: 1.0 Date: Oct.07, 1998 ############################################################################# # # Check script arguments... # if($#argv != 7 ) then echo "Usage: $0 DF_filt FA_filtA FA_filtB vents fans fwhm_x fwhm_y" exit(-1) endif # # Set up variables used by script... # set fans = -1 # Status of the mirror fans set ports = -1 # Status of the ports set path = ($path /home/meteolog/bin) # Add in local bin directory set tmp = /home/meteolog/public/see_tmp # Root for temporary file set db_file = /home/meteolog/public/see_db.dat # Database file set db_full = 500 # No of entries for a full db set mailto = "jbrewer@eso.org" # Recipients of filled db's # # Check the argument given for the fan status... # if ($4 == 'y' || $4 == 'Y') set fans = 1 # Fans on... if ($4 == 'n' || $4 == 'N') set fans = 0 # Fans off.. if ($5 == 'y' || $5 == 'Y') set ports = 1 # Ports open... if ($5 == 'n' || $5 == 'N') set ports = 0 # Ports closed... if ($fans == -1 || $ports == -1) then echo "Please specify y/n for fan/port status..." exit(-1) endif # # Use rdval command to read values from the TCS... # rdval dompos | tail -1 > $tmp.1 # Dome az. in arcsec rdval zendistan | tail -1 >> $tmp.1 # Z.D. in arcsec set n = 1 # Read the 16 environmental sensors... while($n <= 16) rdval sens$n | tail -1 | cut -c1-5 >> $tmp.1 @ n += 1 end # # Read the telescope focus value... # focusValue >> $tmp.1 # # Create ftp command file, ftp to meteo WS and get data # echo " user anonymous infodimm" > $tmp.ftp echo "cd /pub" >> $tmp.ftp echo "get meteo.last $tmp.2" >> $tmp.ftp echo "get dimm.last $tmp.3" >> $tmp.ftp echo "quit" >> $tmp.ftp ftp -n 134.171.80.7 < $tmp.ftp >>& $tmp.log # # Change format of Meteo (keep AVErage values) and DIMM data... # cat $tmp.2 | tail +4 | head -13 | cut -c19-25 > $tmp.4 cat $tmp.3 | tail -2 | head -1 | cut -c2-5 >> $tmp.4 # # Convert data files to single line format... # cat $tmp.1 | tr '\n' ' ' > $tmp.dat1 cat $tmp.4 | tr '\n' ' ' > $tmp.dat2 # # Write data to the seeing database file... # w2see_db $1 $2 $3 $4 $5 $6 $7 # # If more than $db_full entries in the database, archive and mail it... # set entries = `wc -l $db_file | cut -f1 -d' '` set entries = `expr $entries - 3` if($entries > $db_full) then set ext = ` date | cut -c5-10,24-28 | tr ' ' '_' ` mv $db_file $db_file.$ext echo "DK1p5 Seeing Archive" > $tmp.$ext echo "Mail from "$0" on "`hostname` >> $tmp.$ext cat $db_file.$ext >> $tmp.$ext mail $mailto < $tmp.$ext rm $tmp.$ext endif # # Clean up... # rm $tmp.1 $tmp.2 $tmp.3 $tmp.4 $tmp.dat1 $tmp.dat2 $tmp.ftp $tmp.log exit(1)