# COADD_GET -- Read parameters for the task coadd. # # Description: # ------------ # Read CL parameters and do necessary checking and conversions. # # Input CL parameters: # ----------------- # # "infile" Input science data file template name # "phasefile" Input phase data file template name # "inmask" Input science mask file template name (optional) # "outfile" Output science data file template name # "errorfile" Output data error file template name # "outmask" Output science mask file template name # "nbins" Number of bins in the output file(s) # "fillval" Fill value in the output files for invalid pixel # # Date Author Description # ---- ------ ----------- # 20-Feb-1990 J.-C. Hsu rewrite in SPP #------------------------------------------------------------------------------ procedure coadd_get (fin, fphase, finmask, fout, ferror, foutmask, nfin, nfout, nbins, maskflag, fillval) pointer fin, fphase, finmask, fout, ferror, foutmask # output: file template pointers int nfin, nfout # output: number of input and output files int nbins # output: number of bins in the output files bool maskflag # output: is there input mask file? real fillval # output: fill value for the invalid pixels in # the output files int nfinmask # number of input mask files pointer imtopenp() int imtlen(), clgeti() real clgetr() #============================================================================== begin # open file templates and find out how many files are in the templates fin = imtopenp ("infile") fphase = imtopenp ("phasefile") finmask = imtopenp ("inmask") fout = imtopenp ("outfile") ferror = imtopenp ("errorfile") foutmask = imtopenp ("outmask") 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 (nfout < 1) call error (1, "blank output file template") # if input mask template is not specified, set mask flag to false maskflag = (nfinmask >= 1) # check the numbers of files in each template are consistent/reasonable # the number of output files should be either ONE or the same as input if (nfin != nfout && nfout != 1) call error (1, "mismatch no. of files: input and output") if (imtlen(fphase) != nfin) call error (1, "mismatch no. of files: input data and phase file") if (imtlen(ferror) != nfout) call error (1, "mismatch no. of files: output data and error file") if (imtlen(foutmask) != nfout) call error (1, "mismatch no. of files: output and output mask") if (maskflag) { if (nfinmask != nfin) call error (1, "mismatch no. of files: input and input mask") } # read other CL parameters nbins = clgeti ("nbins") fillval = clgetr ("fillval") # number of bins must be positive if (nbins < 1) call error (1, "zero or negative number of bins") end