#!/bin/csh # unalias cp source /usr/users/figaro/figarodef_unix.com if ($?DATADIR == 0) then echo 'directory to write FITS files to:' set temp = $< setenv DATADIR $temp cd $DATADIR goto start endif if ($DATADIR == "") then echo 'directory to write FITS files to:' set temp = $< setenv DATADIR $temp cd $DATADIR else cd $DATADIR endif start: if ($?VAXDATADIR == 0) then echo 'Directory where .sdf files are located: ' set data_root = $< setenv VAXDATADIR $data_root endif if ($VAXDATADIR == "") then echo 'Directory where .sdf files are located: ' set data_root = $< setenv VAXDATADIR $data_root else set data_root = $VAXDATADIR endif echo 'root file name (e.g. 28aug): ' set spec_root = $< set prefix = "" echo 'first file no: ' set start_x = $< echo 'last file no: ' set end_x = $< query_ech: set range = 0 set div = 0 set one = 1 set div2 = 0 @ range = ($end_x - $start_x) @ range = $range + 1 @ div = $range @ div2 = $range set i = 0 set j = 0 set xc = 0 @ xc = ${start_x} - 1 loop: @ j = ${j} + 1 @ xc = ${xc} + 1 if (${xc} > ${end_x}) goto loop2 if (${xc} < 10) then set prefix = "000" else if (${xc} < 100) then set prefix = "00" else if (${xc} < 1000) then set prefix = "0" else set prefix = "" endif echo 'Writing ' ${data_root}/${spec_root}${prefix}${xc} ' as FITS' wdfits image=${data_root}/${spec_root}${prefix}${xc} file=${spec_root}${prefix}${xc}.fits goto loop loop2: echo 'total number of files is ' ${range}