#!/bin/csh -f
#++++++++++++++++
#.IDENTIFICATION getgrid
#.LANGUAGE       C_shell
#.AUTHOR         Francois Ochsenbein <francois@astro.u-strasbg.fr>
#.ENVIRONMENT    CDS Catalogues Service
#.KEYWORDS       
#.VERSION  1.0   08-Jul-1998: Creation
#.VERSION  1.1   04-Jun-2004: Problem with compressed files ==> Use fcat
#.PURPOSE        Find out the grid of fluxes for a model
#.COMMENTS       The program accepts the following arguments:
#	Arg#1 (required): HR number
#	Arg#2 (optional): contents of column "table" for the HR number
#				from file "stars.dat"
#----------------

#### The arguments may be in theTab, as a comma-separated list
if ($?theTab) then
    set argv = `echo $theTab | tr , ' '`
endif

#### Check the number of arguments in the correct range.
if (($#argv != 2) && ($#argv != 4)) then
    echo "Usage: $0 file_name model_number [file_name model_number]"
    echo "       Print out the flux moments from 2 files (*.ori *.cor)"
    echo "       for a specified model number"
    exit 1
endif

set f1 = $1 ; shift
set m1 = $1 ; shift
if ($#argv > 0) then
    set f2 = $1; shift
    set m2 = $1; shift
else
    set m2 = 0 
endif


#### Look for existence of files

if ($m2 > 0) then
    fcat $f1 | gawk -v m1=$m1 -v m2=$m2 -v cat2="fcat $f2" -f get1.awk
else
    fcat $f1 | gawk -v m1=$m1 -f get1.awk
endif

#######################################################################
