NAME:
  sc_nearest

 PURPOSE:
  Find the nearest N stars from a point in a star catalog.

 DESCRIPTION:
 CATEGORY:
  Database
 CALLING SEQUENCE:
  sc_nearest, db, ra, dec, radius, id, ra, dec, dra, ddec, mag

 INPUTS:
  db     - handle to an open mysql ddatabase
  ra     - ra of serach location (radians)
  dec    - dec of serach location (radians)
  radius - maximum disance from ra/dec to look (radians)

 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  MAG_MIN - lower bound of star magnatude to return (eg. 7.5)
  MAG_MAX - upper bound of star magnatude to return (eg. 8.0)
  SCLASS - Spectral classification, as a regexp
             example: {AB}0 for B0 and B0 class
                      {GK}.* for any G or K class star
  MAX_COUNT - Maximum number of stars to return, defaults to 10
  TBLNAME - Name of table to query in the DB

 OUTPUTS: Returns a series of arrays with up to n stars
  id   - name of star
  ra   - ra
  dec  - dec
  dra  - delta ra
  ddec - delta dec
  mag  - magnatude of stars
  sc   - Spectral type of star

 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  02/02/19, Writen by David Tucker
  2004/03/30, Marc W. Buie, Lowell Observatory, added spectral class return