PROCEDURE help=*
! 
!  GALSOS2.PDF -  Procedure for correcting Galileo SSI images using the 
!                 program GALSOS, and not requiring the MIPS RADIOMETRIC
!                 catalog for locating calibration files.  The defaults
!                 locations for calibrations files are for the CD_ROM 
!                 locations and the pdf is written for VAX use in VICAR.
!
!  1-27-94  HBM  Initial Release.
! 10-01-02  AXC  Re-vamped the script to select calibration files 
!                by the classification of sclk ranges.
!****************************************************************************

PARM INP       TYPE=STRING  COUNT=0:1                          DEFAULT=--
PARM OUT       TYPE=STRING  COUNT=0:1                          DEFAULT=--
PARM DIR       TYPE=STRING  COUNT=0:1                          DEFAULT=--
PARM DIRCAL    TYPE=STRING  COUNT=0:1                          DEFAULT=--
PARM DIRDC     TYPE=STRING  COUNT=0:1                          DEFAULT=--
PARM DIRBLM    TYPE=STRING  COUNT=0:1                          DEFAULT=--
PARM DIROFF    TYPE=STRING  COUNT=0:1                          DEFAULT=--
PARM CAL       TYPE=STRING  COUNT=0:1                          DEFAULT=--
PARM DC        TYPE=STRING  COUNT=0:1                          DEFAULT=--
PARM BLEM      TYPE=STRING  COUNT=0:1                          DEFAULT=--
PARM OFFSETS   TYPE=STRING  COUNT=0:1                          DEFAULT=--
PARM SCALETYP  TYPE=KEYWORD COUNT=0:1   VALID=(IOF,CONV)       DEFAULT=IOF
PARM SCALEVAL  TYPE=REAL    COUNT=0:1                          DEFAULT=1.0
PARM SOLRANGE  TYPE=REAL    COUNT=0:1			       DEFAULT=-- 
PARM BITWT     TYPE=KEYWORD COUNT=0:1   VALID=(NOUBWC,UBWC)    DEFAULT=NOUBWC
PARM PENTROPY  TYPE=KEYWORD COUNT=1   VALID=(PRINT,NOPRINT)    DEFAULT=NOPRINT
PARM NOCHECK   TYPE=KEYWORD COUNT=0:1 VALID=NOCHECK	       DEFAULT=--
PARM TARGET    TYPE=(STRING,12)  COUNT=0:1                     DEFAULT=--
PARM SPICEMODE  TYPE=KEYWORD     COUNT=0:1 VALID=(LOCAL,REMOTE) DEFAULT=--
PARM CKNAME     TYPE=(STRING,4)  COUNT=1                        DEFAULT=DAVI
PARM CKID       TYPE=(STRING,4)  COUNT=1                        DEFAULT=NONE
PARM DEBUG      TYPE=KEYWORD COUNT=0:1 VALID=DEBUG		DEFAULT=--
Refgbl ($ECHO,$BECHO)
Refgbl $SYSCHAR

!*****
BODY 
!*****

write "***************************************"
WRITE "  Procedure GALSOS2 Version 10.1.02"
write "***************************************"

DATETIME

Let _ONFAIL = "RETURN"
!Let $ECHO="YES"
!Let $BECHO=("YES","YES","YES","NO")


! VARIABLES FOR THE PROGRAM, GLLCAMPAR:     

Local SCLK  INTEGER     ! SCLK
Local FLT           STRING      ! FILTER
Local GS            INTEGER     ! GAIN STATE
Local mode          STRING      ! SUMMATION/FULL FRAME
local rate          integer     ! FRAME RATE
local ext           string      ! Extended exposure
local rmode         string      ! Readout Mode

local tfmt          string      ! TELEMETRY FORMAT
local mofibe        string      ! FIBE/MOFIBE values for Phase I & II
local clock_val     integer     ! Inverted clock state integer value
local ival          string init=""    ! Inverted clock state string value
local calib         string init="NO" ! CALIBRATION directory specified flag
local (dc_prefix,,dc_radkey)     string      ! dark current filename search key
local (cal_prefix,cal_radkey)    string      ! slope filename search key
local blem_radkey   string      ! blemish filename search key
local shutter_radkey string     ! shutter offset filename, only one for entire GLL mission

local mofib           integer
local extexp        integer

!! ____________________________________________________________________________
!!  Determine calibration file locations and then call GALSOS
!! ____________________________________________________________________________


 GLLCAMPAR &INP FILT=FLT GAIN=GS SCLK=SCLK rate=rate ext=ext
 GETLAB &inp TLMFMT tfmt STRING 'EARLIEST

 if (sclk <= 346405900)
   GETLAB &inp FIBE mofibe STRING 'EARLIEST
 else
   GETLAB &inp MOFIBE mofibe string 'EARLIEST
   GETLAB &inp READOUTMODE rmode STRING 'EARLIEST
 end-if

! ****************************************************************
! ***** Extract the extended exposure flag from Phase I FIBE *****
! ***** and Phase II MOFIBE value, E=1 for extended exposure *****
! ****************************************************************

   let mofib = &mofibe / 10
   let extexp = &mofibe - (mofib * 10)
   if (extexp = 1) let ext = "x"

! ***************************************************************
! ***** Change filter name from upper case to lower case to *****
! *****      prevent case sensitivity in OS platform        *****
! ***************************************************************

 if (FLT = "CLR")
   let FLT = "clr"
 else-if (FLT = "GRN")
   let FLT = "grn"
 else-if (FLT = "RED")
   let FLT = "red"
 else-if (FLT = "VLT")
   let FLT = "vlt"
 end-if

! *******************************************************************
! ***** Convert frame rate from Vicar label to the corresponded *****
! *****                camera frame duration                    *****
! *******************************************************************

 if (rate = 1)
   let rate = 2
 else-if (rate = 2)
   let rate = 8
 else-if (rate = 3)
   let rate = 30
 else-if (rate = 4)
   let rate = 60
 else-if (rate = 5)
   let rate = 15
 end-if

! Determine image frame mode, summation or full frames, from frame rate

 if (rate = 2 or rate = 15)
   let mode = "s"
 else
   let mode = "f"
 end-if

! construct a filename search string to locate the correct calibration
! files to use with galsos

! *****************************************************************
! ***** Determine readout mode, either Contiguous or Sample   *****
! ***** or Null from Vicar label, only applicable in Phase II ***** 
! *****************************************************************

 if (sclk >= 346000000)
   if (rmode = "CONTIGUOUS")
     let rmode = "c"
   else-if (rmode = "SAMPLE")
     let rmode = "r"
   else-if (rmode = "NOT APPLICABLE")
     let rmode = ""
   end-if
   let dc_prefix = "&gs"//mode//"&rate"//ext//rmode//"_dc"
 else
   let dc_prefix = "&gs"//mode//"&rate"//ext//"_dc"
 end-if

 let cal_prefix     = flt//mode//"_cal"
 let blem_radkey    = flt//"&gs"//mode//"_blm02.img"
 let shutter_radkey = "calibration_so02.img"

 WRITE "FILENAME to be processed : &INP,  with  SCLK=&SCLK ."

!!****************************************************************************
!!  First determine default directories for the calibration files
!!****************************************************************************

   if ($count(DIR) = 1)                    ! User specified calib locations
     let calib = "YES"
      let DIR="&DIR"                   
       
   else-if ($count(DIRCAL) = 0 or $count(DIRDC) = 0 or $count(DIROFF) = 0 or $count(DIRBLM) = 0 )
          write " "
          write "Please specify cal file location, eg. /project/temp1/ssi/rad/"
          write "dark current file directory:"
          getpar DIRDC
          write "cal file directory:"
          getpar DIRCAL
          write "shutter offset file directory:"
          getpar DIROFF
          write "blemish file directory:"
          getpar DIRBLM
          write ""

          let DIRCAL = "&DIRCAL"
          let DIRDC = "&DIRDC"
          let DIROFF = "&DIROFF"
          let DIRBLM = "&DIRBLM"

    else-if ($SYSCHAR(1)="VAX_VMS")
           let DIRCAL = "gll:[calib.slope]"
           let DIRDC = "gll:[calib.dark]"
           let DIROFF = "gll:[calib.shutter]"
           let DIRBLM = "gll:[calib.blemish]"
     
    end-if
    
!!***** determine the correct slope file to use     *****
!!***** by frame mode (full or summation) and sclk  *****

     if (mode = "f")
       if (sclk < 99757699)
         let cal_radkey = "&cal_prefix"//"01.dat"
       else-if (sclk >=  99757700 and sclk <= 346405899)
         let cal_radkey = "&cal_prefix"//"03.dat"
       else-if (sclk >= 346405900 and sclk <= 552443499)
           let cal_radkey = "&cal_prefix"//"04.dat"
       else-if (sclk >= 552443500)
         if (FLT = "889" or FLT = "968")
           let cal_radkey = "&cal_prefix"//"04.dat"
         else                 
           let cal_radkey = "&cal_prefix"//"05.dat"
         end-if
       end-if
     else  
       if (sclk >=  99757700 and sclk <= 346405899)
         if (FLT = "GRN")
           let cal_radkey = "&cal_prefix"//"03.dat"
         else
           let cal_radkey = "&cal_prefix"//"02.dat"
         end-if       
       else-if (sclk >= 346405900 and sclk <= 552443499)
         if (FLT = "GRN")
           let cal_radkey = "&cal_prefix"//"04.dat"
         else                 
           let cal_radkey = "&cal_prefix"//"03.dat"
         end-if
       else-if (sclk >= 552443500)
         if (FLT = "GRN")
           let cal_radkey = "&cal_prefix"//"05.dat"
         else-if (FLT = "889" or FLT = "968")
           let cal_radkey = "&cal_prefix"//"03.dat"
         else                 
           let cal_radkey = "&cal_prefix"//"04.dat"
         end-if
       end-if 
     end-if
  let CAL = "&cal_radkey"
  

!! Determine the correct dark current file to use 
  
   if (mode = "f")
     if (sclk <= 99757700)
       if (dc_prefix = "3f30_dc" or dc_prefix = "4f30_dc" or dc_prefix = "4f30x_dc")
         let dc_radkey = "&dc_prefix"//"03.dat"
       else
         let dc_radkey = "&dc_prefix"//"01.dat"
       end-if
     else-if (sclk >= 99757701 and sclk <= 159999999)
       if (tfmt = "IM4" and (gs = 3 or gs = 4))
         let dc_radkey = "&dc_prefix"//"02.dat"
       else-if (dc_prefix = "3f30_dc" or dc_prefix = "4f30_dc" or dc_prefix = "4f30x_dc")
         let dc_radkey = "&dc_prefix"//"03.dat"
       else
         let dc_radkey = "&dc_prefix"//"01.dat"
       end-if
     else-if (sclk >= 160000000 and sclk <= 345999999)
       if (dc_prefix = "4f8x")
         let dc_radkey = "&dc_prefix"//"01.dat"
       else
         let dc_radkey = "&dc_prefix"//"02.dat"
       end-if
     else-if (sclk >= 346000000 and sclk <= 346405899)
       if (dc_prefix = "3f30" or dc_prefix = "4f30" or dc_prefix = "4f30x")
         let dc_radkey = "&dc_prefix"//"04.dat"
       else-if (dc_prefix = "4f8x")
         let dc_radkey = "&dc_prefix"//"02.dat"
       else-if (rmode = "r")
         let dc_radkey = "&dc_prefix"//"02.dat"
       else
         let dc_radkey = "&dc_prefix"//"03.dat"
       end-if       
     else-if (sclk >= 346405900 and sclk <= 584054599)
       if (dc_prefix = "3f8x" or dc_prefix = "3f8xc" or dc_prefix = "3f8xr")
         let dc_radkey = "&dc_prefix"//"02.dat"
       else-if (dc_prefix = "4f8xr")  
         let dc_radkey = "&dc_prefix"//"03.dat"
       else
         let dc_radkey = "&dc_prefix"//"04.dat"
       end-if
     else-if (sclk >= 584054600)
       if (dc_prefix = "3f8x" or dc_prefix = "3f8xc")
         let dc_radkey = "&dc_prefix"//"03.dat"
       else-if (dc_prefix = "4f8x" or dc_prefix = "4f8xc" or dc_prefix = "4f8xr")
         let dc_radkey = "&dc_prefix"//"04.dat"
       else
         let dc_radkey = "&dc_prefix"//"05.dat"
       end-if
     end-if

!! Dark current file selection for summation frame modes, AI8 and HIS. 
!! Dark current files was generated for both frame modes even though HIS
!! was implemented after JOI in phaes II.  The following algorithm reflects the
!! consistency and completion of dark current file applicability via SCLK
!! range classifications.  

    else
      if (sclk >= 99757701 and sclk <= 159999999)
        if (tfmt = "AI8" and (gs = 1 or gs = 2))
          let dc_radkey = "&dc_prefix"//"02.dat" 
        end-if
      else-if (sclk <= 345999999)
        if (tfmt = "AI8" or rate = 2)
          let dc_radkey = "&dc_prefix"//"02.dat"
        else
          let dc_radkey = "&dc_prefix"//"01.dat" 
        end-if
      else-if (sclk >= 346000000 and sclk <= 346405899)
        if (rate = 15)
          if (ext = "x")
            let dc_radkey = "&dc_prefix"//"02.dat"
          else-if (dc_prefix = "3s15")
            let dc_radkey = "&dc_prefix"//"03.dat"
          else
            let dc_radkey = "&dc_prefix"//"04.dat"
          end-if
        else
          let dc_radkey = "&dc_prefix"//"03.dat"
        end-if  
      else-if (sclk >= 346405900)
        if (rate = 15) 
          if (dc_prefix = "3s15x")
            let dc_radkey = "&dc_prefix"//"04.dat"
          else-if (ext = "x")
            let dc_radkey = "&dc_prefix"//"03.dat"
          else
            let dc_radkey = "&dc_prefix"//"05.dat"
          end-if
        else
          let dc_radkey = "&dc_prefix"//"04.dat"
        end-if 
      end-if
    end-if
    let DC = "&dc_radkey"

     if ($count(BLEM) = 0)
       let BLEM = "&blem_radkey"
     end-if

     if ($count(OFFSETS) = 0)
       let OFFSETS = "&shutter_radkey"
     end-if

     if (tfmt = "XCM")
       XCMFIX &INP XA
       let inp = "XA"
     end-if

     if ($count(SOLRANGE)=1)                 ! Users specify   
       if (SCALETYP = "IOF")
         GALSOS &INP &OUT +
         dir=@DIR dircal=@DIRCAL cal=@CAL dirdc=@DIRDC dc=@DC +
         dirblm=@DIRBLM blem=@BLEM diroff=@DIROFF offset=@OFFSETS +
         iof=&SCALEVAL solrange=@SOLRANGE target=@target +
         bitwt=@BITWT pentropy=@PENTROPY nocheck=@NOCHECK +
         spicemode=@SPICEMODE ckname=@CKNAME ckid=@CKID debug=@DEBUG
         goto proc_end
       else
         GALSOS &INP &OUT +
         dir=@DIR dircal=@DIRCAL cal=@CAL dirdc=@DIRDC dc=@DC +
         dirblm=@DIRBLM blem=@BLEM diroff=@DIROFF offset=@OFFSETS +
         conv=&SCALEVAL solrange=@SOLRANGE target=@target +
         bitwt=@BITWT pentropy=@PENTROPY nocheck=@NOCHECK +
         spicemode=@SPICEMODE ckname=@CKNAME ckid=@CKID debug=@DEBUG          
        goto proc_end
       end-if
     end-if

     if (SCALETYP = "IOF")   
       GALSOS &INP &OUT +    
       dir=@DIR dircal=@DIRCAL cal=@CAL dirdc=@DIRDC dc=@DC +
       dirblm=@DIRBLM blem=@BLEM diroff=@DIROFF offset=@OFFSETS +
       iof=&SCALEVAL target=@target bitwt=@BITWT pentropy=@PENTROPY +
       nocheck=@NOCHECK spicemode=@SPICEMODE ckname=@CKNAME +
       ckid=@CKID debug=@DEBUG
     else  
       GALSOS &INP &OUT +  
       dir=@DIR dircal=@DIRCAL cal=@CAL dirdc=@DIRDC dc=@DC +
       dirblm=@DIRBLM blem=@BLEM diroff=@DIROFF offset=@OFFSETS +
       conv=&SCALEVAL target=@target bitwt=@BITWT pentropy=@PENTROPY +
       nocheck=@NOCHECK spicemode=@SPICEMODE ckname=@CKNAME +
       ckid=@CKID debug=@DEBUG
     end-if   

proc_end>
WRITE "GALSOS2 Successfully Completed."

!Let $ECHO="NO"
!Let $BECHO=("NO","NO","NO")

end-proc
.TITLE
GALSOS2 - Procedure to radiometrically correct Galileo SSI flight images 
          by calling the program GALSOS and write them out to disk.  It is 
          designed to use the calibration files on the Galileo CD-ROM GO-0001.

.HELP
PURPOSE:

GALSOS2 is a procedure to radiometrically correct Galileo SSI images using 
the program GALSOS and write them out to disk.  The user should read the 
help for the program GALSOS.
.PAGE
EXECUTION:

  GALSOS2 INP=string OUT=string [DIR=string] [DIRCAL=string] +
         [DIRDC=string] [DIRBLM=string] [DIROFF=string] +
         [CAL=string] [DC=string] [BLEM=string] [OFFSETS=string] +
         [SCALETYP=keyword] [SCALEVAL=real] [SOLRANGE=real] +
         [BITWT=keyword] [PENTROPY=keyword] [NOCHECK=keyword] +
         [TARGET=string] [SPICEMODE=keyword] [CKNAME=string] +
         [DEBUG=keyword] 

Where

  All the parameters in brackets are optional.  User-parameters are 
  discussed under their respective section in TUTOR.


.PAGE
REFERENCES:

1)  Yagi, Gary.  "MIPL Software Structural Design (SSD) for the Instrument
    Calibration of GLL SSI Science Processing," JPL Document #D-4264,
    Version 1:  June 11, 1987.

2)  VICAR help for the program GALSOS.

.PAGE
OPERATION:

GALSOS2 is a procedure to be used with the SSI REDR images located on CD-ROM
or SSI UDR and REDR images that are on disk and the calibration files located
on the SSI CD-ROM GO_0001.  The procedure will radiometrically decalibrate the
input image (INP parameter) using the program GALSOS and place the results in 
the filename specified by the parameter OUT. 

GALSOS2 will figure out the location and file names of the necessary
calibration files located on the Galileo CD-ROM GO_0001 to use by the program
GALSOS automatically.  If the user has copied the calibration files to other
locations on disk the user should use the parameters DIR, DIRCAL, CAL, DIRDC,
DC, DIRBLM, BLEM, DIROFF, and OFFSETS to tell the procedure GALSOS2 where to
locate the calibration files. 

GALSOS2 will also make a correction for all XCM files that were received
before the IDA encounter.   All XCM data starts one line off.  Line 1 should
really be line 2.  GALSOS2 runs the program XCMFIX before applying the
radiometric correction with GALSOS. 

GALSOS2 will modify the label of the final GALSOS'ed image with keywords
identifying the calibration files used. 

.PAGE
EXAMPLES:

GALSOS2 INP=s001641100.REDR OUT=1641100.EDR SCALETYP=IOF SCALEVAL=0.05 +
        TARG=VENUS

In this example, run GALSOS (with automatic calibration-filename creation) on
the image with the IOF value of 0.05 being applied to the image (IOF is the
default SCALETYP for determining how to scale the output radiometric units). 

A couple of GALSOS defaults are in effect here:  
-  PENTROPY: By defaulting this to NOPRINT, GALSOS WILL NOT print out the 
entropy values it calculated for every 50th line.
-  BITWT:    By defaulting this to NOUBWC, GALSOS WILL NOT apply the 
uneven-bit-weighting-correction to the image.

The following GALSOS parameters used for ground calibration data do not get
incorporated in GALSOS2:

             FILTER
             GAIN
	     EXPOSURE
             CFILTER
             CGAIN
             DCGAIN
 
Since GALSOS2 can automatically select the location and filenames of 
the calibration files to be used by GALSOS, the following GALSOS 
parameters are also not incorporated:

             CATSRV
             CATDB
             CATUSR
             CATPW
             CATALOG
             UPDATE


.PAGE
PROGRAM HISTORY:
  Original Programmer:    Helen Mortensen,  3-14-94
  Cognizant Programmer:   Helen Mortensen
  Revisions:
    3-14-94 ... H. Mortensen ... Original Version
   12-05-02 ... A. Chen      ... Added codes to automatically select 
                                 calibration files by the sclk ranges.     
                                 
.PAGE            
.LEVEL1
.vari INP
Filename of image to be
radiometrically corrected
by the program GALSOS.
.vari OUT
Output filename of the 
radiometrically corrected image.
.vari SCALETYP
KEYWORD - Determines which
type of radiometric unit
scaling factor to use for 
output:  IOF or CONV.
.vari SCALEVAL
REAL - The value to be 
applied with the specified
SCALETYP in scaling the
output radiometric units.
.vari BITWT
KEYWORD - Determines whether
to request GALSOS to apply
uneven-bit-weighting 
correction.
.vari PENTROPY
KEYWORD - Determines whether 
to request GALSOS to print out
entropy values for every 
50th line.
.vari TARGET
STRING - Overrides the target 
in the VICAR label.
.vari DIR
STRING - Directory where all
the calibration files are
located, for GALSOS.
.vari DIRCAL
STRING - Overrides the default
slope file directory location
.vari CAL
STRING - Override slope file 
name.
.vari DIRBLM
STRING - Overrides the default
blemish file directory location
.vari BLEM
STRING - Overried blemish file 
name.
.vari DIRDC
STRING - Overrides the default
dark current file directory 
location.
.vari DC
STRING - Dark current 
file name.
.vari DIROFF
STRING - Overrides the default
shutter offset file directory 
location.
.vari OFFSETS
STRING - Shutter Offset
file name.
.VARIABLE SOLRANGE
KEYWORD--OPTIONAL
Solar range (km)
.VARIABLE NOCHECK
KEYWORD--OPTIONAL
Suppresses checking for
parameter mismatches.
.VARI SPICEMODE
KEYWORD--OPTIONAL
Location of SPICE kernels
(LOCAL or REMOTE)
.VARI CKNAME
STRING--OPTIONAL
4-char string C-kernel 
name
.VARI CKID
STRING-OPTIONAL
4-char string C-kernel ID
.var DEBUG
KEYWORD--OPTIONAL
Print diagnostic messages
.LEVEL2
.vari INP
Filename of image to be radiometrically corrected by the program GALSOS.
.vari OUT
Output filename of the radiometrically corrected image.
.vari SCALETYP
KEYWORD - Defines which type of scaling factor to use (IOF or CONV) for
scaling the output radiometric units for each image.  The user should be
knowledgeable about how SCALETYP and SCALEVAL work together: See Reference 1)
above. 

Default=IOF.   (Same default as in GALSOS).
.vari SCALEVAL
REAL - The value to use along with the specified SCALETYP in scaling the
output radiometric units for each image.  The user should be knowledgeable
about how SCALETYP and SCALEVAL work together:  See Reference 1) in the help
for GALSOS. 

Default=1.0, which goes with the IOF SCALETYP.  (Same default as in GALSOS).
.vari BITWT
KEYWORD - Determines whether to request GALSOS to apply uneven-bit-weighting
correction to each image.  See GALSOS HELP for an explanation of UBWC. 

Default="NOUBWC" for this procedure, meaning no correction will be performed.
(Same default as in GALSOS). 
.vari TARGET
KEYWORD - Target object of each image.  
Ex: TARGET=GANYMEDE specifies that GANYMEDE is the target in the input image.

The TARGET may be a planet, satellite, or asteroid.  If defaulted, the target
name is extracted from the VICAR label or determined by other TBD means.

A complete list of valid target names is located in the ASCII file assigned
the logical name (or environmental variable) BODY_IDS.

Default=-- (NULL) which means take it from the VICAR label.
.vari DIR
STRING - Directory where the calibration files are located, for GALSOS.

Default="--"  (NULL) which means to automatically determine where to
obtain the calibration files from CD-ROM GO_0001.
.vari DIRCAL
STRING - Overrides the default directory location for the slope file.
.vari CAL
STRING - Name of the Slope File to override the default slope file.
Input Radiometric File, as generated by program GALGEN.  The Radiometric
File's filter position must match the filter position of the input image.
The filename should NOT include the directory of the file; refer to the 
DIR and DIRCAL parameters for specifying the directory.

The default="--" (NULL) which is to have the program determine the file
name.
.vari DIRBLM
STRING - Overrides the default directory location for the blemish file.
.vari BLEM
STRING - Name of the Blemish File to be used.
Input Blemish File, as generated by program BLEMGEN.  The filename should NOT
include the directory of the file; refer to the DIR and DIRBLM parameters for 
specifying the directory.

The default="--" (NULL) which is to have the program determine the file
name.
.vari DIRDC
STRING - Overrides the default directory location for the dark current file.
.vari DC
STRING - Name of Dark Current File to be used.
Input dark current file, in byte or halfword format.  Dark current files
may be (1) zero exposure frames, (2) a sum of zero exposure frames (see
PICSUM), or (3) as computed by program GALGEN.

The dark current file must match the input image in gain state and frame rate.
Also, extended-exposure mode frames require extended-exposure dark currents.
The filename should NOT include the directory of the file; refer to the DIR
and DIRDC parameters for specifying the directory.

The default="--" (NULL) which is to have the program determine the file
name.
.vari DIROFF
STRING - Overrides the default directory location for the shutter offset file.
.vari OFFSETS
STRING - The name of the Shutter Offset File to be used
Input Shutter-Offset File, as generated by program CCDRECIP.  The
Shutter-Offset File is independent of all camera modes, and a single file
may be used (for a fixed temperature).  The filename should NOT include the
directory of the file; refer to the DIR and DIROFF parameters for specifying
the directory.

The default="--" (NULL) which is to have the program determine the file
name.

.VARI SOLRANGE
	SOLRANGE=r
where r specifies the solar range (distance for target to sun) in km.

If not specified the following actions are taken:
  (1) If the input image is in Phase1 format, the following constants are
      used: Venus=0.723331 AU, Earth=1.0 AU, Gaspra=2.2016 AU, Ida=2.9485 AU,
      Jupiter=5.2 AU.
  (2) For Phase 2, SOLRANGE is extracted from the VICAR label.
  (3) For ground calibration images, SOLRANGE=5.2 AU.

.VARIABLE NOCHECK
Keyword 'NOCHECK specifies that processing should continue even though the
specified calibration files do not match the input files parameters: gain,
frame-rate, filter & FIBE (where applicable).  Warning messages identifying
the suspected files are displayed along with a continuation with error
message.  The default is to terminate processing if mismatches are detected.

.VARIABLE PENTROPY
Keyword 'PRINT causes printing of the results of the entropy calculations for
the entire image and for every 50th line (default is 'NOPRINT).  Note that
this keyword can be used to force the entropy to be calculated, even if it
has been previously calculated by BADLABELS.

.VARI SPICEMODE
SPICEMODE=LOCAL specifies that SPICE data is to be retrieved from local
SPICE kernels.  SPICEMODE=REMOTE specifies that SPICE data is to be retrieved
via the SPICE server.  If SPICEMODE is defaulted, the logical name (or
environmental variable) DEFAULTSPICE is used to determine whether LOCAL or
REMOTE is used.  Note that if SPICE data is not found in LOCAL or REMOTE mode,
the other mode is attempted.

.VARI CKNAME
CKNAME is a four character string specifying the C-kernel to be used:

  CKNAME	C KERNEL
  --------      -------------
  DAVI		MIPS_DAVI.CK
  NAV		MIPS_NAV.CK
  FARE		MIPS_FARENC.CK
  NAV2		MIPS_NAV2.CK
  NEAR		MIPS_NEAR.CK
  AMOS		MIPS_AMOS.CK
  NAIF		the best NAIF kernel is used

If defaulted, the kernels are searched in the above order.

.VARI CKID
CKID is an alternative way to specify the prefered C-kernel (see CKNAME
parameter):

  CKID	  CKNAME	C KERNEL
  ----	  --------      -------------
  M906	  DAVI		MIPS_DAVI.CK
  M905	  NAV		MIPS_NAV.CK
  M904	  FARE		MIPS_FARENC.CK
  M903	  NAV2		MIPS_NAV2.CK
  M902	  NEAR		MIPS_NEAR.CK
  M901	  AMOS		MIPS_AMOS.CK
  varies  NAIF		there are a large number of these files

Ex:  CKID=M901 specifies the four character ID which uniquely identifies the
     C-kernel MIPS_AMOS.CK.

A complete list of the C-kernel IDs is located in the ASCII file assigned the
logical name (or environmental variable) KERNELDB.

If specified, CKID overrides the CKNAME parameter.

.var DEBUG
'DEBUG causes diagnostic messages to be printed (for debugging the program).
.END
