include "polarimetry.h" # POL_GET -- Read parameters for the task polarimetry. # # Description: # ------------ # Read CL parameters and do necessary checking and conversions. # # Input CL parameters: # ----------------- # # "infile" input data file template name # "inmask" input mask file template name (optional) # "outroot" Output file root(s) template name # "efficiency" table name of polarization efficiencies # "paoffset" table name of position angle offsets # "poleff0" polarization efficiency at 0 degree # "poleff45" polarization efficiency at 45 degree # "poleff90" polarization efficiency at 90 degree # "poleff135" polarization efficiency at 135 degree # "pa0" position angle offset # "datafill" Fill value in the output data file for invalid pixel # # Date Author Description # ---- ------ ----------- # 11-Jun-1990 J.-C. Hsu rewrite in SPP #------------------------------------------------------------------------------ procedure pol_get (fin, finmask, fout, nsets, mask, tp_poleff, tp_paoffset, peff, pa0, datafill) pointer fin, finmask, fout # output: file template pointers int nsets # output: number of input file sets bool mask # output: is there input mask files? pointer tp_poleff, tp_paoffset # output: pointers of calibration tables real datafill # output: fill value for the invalid pixels in # the output data file int nfin # number of input files int nfinmask # number of input mask files int nfout # number of output root names char efficiency[SZ_FNAME], paoffset[SZ_FNAME] # table names of polarization efficiency and # position angle offset real peff[NAPER], pa0 pointer imtopenp() pointer tbtopn() int imtlen(), strlen() real clgetr() #============================================================================== begin # open file templates and find out how many entries are in the templates fin = imtopenp ("infile") finmask = imtopenp ("inmask") fout = imtopenp ("outroot") nfin = imtlen (fin) nfout = imtlen (fout) nfinmask = imtlen (finmask) # check input parameters, the following files can not be empty if (nfin < 1) call error (1, "blank input file template") # if input mask template is not specified, set mask flag to false mask = (nfinmask > 0) # check the numbers of files in each template are consistent/reasonable # for each four input files there is one set of output files nsets = nfin / 4 if (nfin != nsets*4) call error (1, "number of input files is not a multiple of four") if (nsets != nfout) call error (1, "mismatch no. of files: input and output") if (mask) { if (nfinmask != nfin) call error (1, "mismatch no. of files: input and input mask") } # read table names of polarization efficiencies and position angle # offsets call clgstr ("efficiency", efficiency, SZ_FNAME) call clgstr ("paoffset", paoffset, SZ_FNAME) # open these tables if (strlen(efficiency) == 0) tp_poleff = NULL else tp_poleff = tbtopn (efficiency, READ_ONLY, 0) if (strlen(paoffset) == 0) tp_paoffset = NULL else tp_paoffset = tbtopn (paoffset, READ_ONLY, 0) # read other CL parameters peff[P0] = clgetr("poleff0") peff[P45] = clgetr("poleff45") peff[P90] = clgetr("poleff90") peff[P135] = clgetr("poleff135") pa0 = clgetr("pa0") datafill = clgetr ("datafill") end