include "delaytime.h" define SZ_DUNIT 6 # ODELAY_GET -- Read parameters for the task odelaytime. # # Description: # ------------ # Read CL parameters and do necessary checking and conversions. # # Input CL parameters: # ----------------- # "input" Input/output science data table # "distance" distance of the target # "dist_unit" unit used in the distance parameter # "earth_ephem" name of the table which contains earth's J2000 state # vectors # "obs_ephem" name of the table which contains observer's J2000 state # vectors # "in_col" input time column name # # Date Author Description # ---- ------ ----------- # 09-Nov-1984 C. B. Biemesderfer original # 11-Apr-1990 J.-C. Hsu rewrite in SPP # 19-Aug-1997 J.-C. Hsu modify for STIS data # 14-Aug-2000 Phil Hodge remove out_col parameter, and get # verbose parameter #------------------------------------------------------------------------------ procedure odelay_get (fin, nfin, parallax, tp_earth, tp_obs, in_col, verbose) pointer fin # o: file template pointer int nfin # o: number of input files double parallax # o: parallax of the target (in arc sec) pointer tp_earth, tp_obs # o: pointers of the ephemeris tables char in_col[ARB] # o: time column name bool verbose # o: print timing info? #-- char dist_unit[SZ_DUNIT] # unit of the distance char earth_ephem[SZ_FNAME] char obs_ephem[SZ_FNAME] pointer imtopenp() pointer tbtopn() int imtlen() double clgetd() bool clgetb() bool streq(), strne() #============================================================================== begin # open file templates and find out how many files are in the templates fin = imtopenp ("input") nfin = imtlen (fin) # check input parameters, the following files can not be empty if (nfin < 1) call error (1, "blank input file template") # read the names of the ephemeris and open them call clgstr ("earth_ephem", earth_ephem, SZ_FNAME) call clgstr ("obs_ephem", obs_ephem, SZ_FNAME) tp_earth = tbtopn (earth_ephem, READ_ONLY, 0) if (obs_ephem[1] == EOS) { tp_obs = NULL } else { tp_obs = tbtopn (obs_ephem, READ_ONLY, 0) } # read other CL parameters parallax = clgetd ("distance") call clgstr ("dist_unit", dist_unit, SZ_DUNIT) call clgstr ("in_col", in_col, SZ_LINE) verbose = clgetb ("verbose") # convert the distance to arcseconds if (strne (dist_unit, "arcsec")) { # convert to parsec first if (streq (dist_unit, "au")) parallax = parallax / AUPERPC else if (streq (dist_unit, "ly")) parallax = parallax / LYPERPC else if (streq (dist_unit, "km")) parallax = parallax / KMPERPC else if (streq (dist_unit, "pc")) ; else call error (1, "illegal distance unit") # make sure the distance is non-zero (pc) if (parallax <= 0.) call error (1, "non-positive distance") parallax = 1. / parallax } end