NAME:
  contamchk
 PURPOSE:
  Check solar system object for contamination from field star.
 DESCRIPTION:
  Checks against the UNSO A2.0 catalog for appulse distances with field
    stars.  Motion of the object is assumed to be linear over the requested
    time range.  Usually, the time ranges are small (on the order of an hour
    or so).  If a star brighter than the threshold is present within the
    minimum separation distance during the time window, then the contamination
    flag is set.
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
  bad = contamchk(jd1,jd2,object,septhresh)
 INPUTS:
  jd1       - Julian date of starting time of window
  jd2       - Julian date of ending time of window
  object    - Ephem code for solar system object
  septhresh - Separation threshold (arcsec), closer than this is considered
                to be contamination if star is brighter than magthresh.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  OBSCODE   - Observatory code (default=500, geocentric)
  MAGTHRESH - Threshold magnitude (default=20), anything fainter is ignored.
  STARFILE  - If provided, the USNO sub-catalog file is created and then not
                 deleted at the end.  If the file already exists and the
                 name is provided, then the file is used without calling
                 refnet again.
 OUTPUTS:
  return value is a flag, if set means there is a star too close in the window.

 KEYWORD OUTPUT PARAMETERS:
  ERROR  - Set on return to indicate an error condition (usually this is
              cause by a bad object code).
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
  Note that if you use the starfile keyword to save the sub-catalog, it is
    up to you to get rid of the file when it is no longer relevant.  The saved
    file will usually be no good if the date changes much or if you need to
    change the magthresh to a fainter limit.  This option can, if used
    properly, help speed things up but the calling program must take on more
    responsibility to get the right answer.
 PROCEDURE:
 MODIFICATION HISTORY:
  Written by Marc W. Buie, Lowell Observatory, 2002/03/10
  2002/09/09, MWB, added support for string obscode values