Extended IDL Help

This page was created by the IDL library routine mk_html_help. For more information on this routine, refer to the IDL Online Help Navigator or type:

     ? mk_html_help

at the IDL command line prompt.

Last modified: Tue Jul 11 20:42:24 2006.


List of Routines


Routine Descriptions

FRESNELDIFF_EDGE

[Next Routine] [List of Routines]
 NAME:
  fresneldiff_edge
 PURPOSE: (one line)
  Calculate Fresnel diffraction by an edge
 DESCRIPTION:
  Calculate Fresnel diffraction by an edge (opaque for x<0, clear for x>0)
 CATEGORY:
  Math
 CALLING SEQUENCE:
  intensity = fresneldiff_edge(x)
 INPUTS:
  x - scalar or array distance in units of Fresnel scale, sqrt( lam*dist/2) 
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
  none
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  intensity = intensity relative to unobstructed intensity
 COMMON BLOCKS:
  None
 SIDE EFFECTS:
 RESTRICTIONS:
  None
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 2006 Jan 10

(See oc/fresneldiff_edge.pro)


FRESNELDIFF_EDGE_FUNC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  fresneldiff_edge_func
 PURPOSE: (one line)
  Calculate Fresnel diffraction by an edge for curvefit
 DESCRIPTION:
  Calculate Fresnel diffraction by an edge (opaque for x<0, clear for x>0)
 CATEGORY:
  Math
 CALLING SEQUENCE:
  fresneldiff_edge,in,a,f,pder
 INPUTS:
  in - input structure
    in.tmid - midtimes (eg seconds)
    in.dt   - bin widths (seconds)
    in.tf   - Fresnel width, seconds = sqrt(lam*dist/2)/v_perp
             since v_perp = dr/dt, this is
             positive for emersion, negative for immersion
  a - parameters
    a[0]   - edge time
   OR   
    a[0]   - edge time
    a[1]   - scale = upper baseline - lower baseline 
    a[2]   - offset = lower baseline
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
  none
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  f - Fresnel diffraction pattern, integrated over the bins
  pder - derivative matrix
 COMMON BLOCKS:
  None
 SIDE EFFECTS:
 RESTRICTIONS:
  None
 PROCEDURE:
  See Goodman Introduction to Fourier Optics, chapter 4
 MODIFICATION HISTORY:
  Written 2006 Jan 10

(See oc/fresneldiff_edge_func.pro)


HD_MAG_TO_FLAG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  hd_mag_to_flag

 PURPOSE: (one line)
  Decode HD catalog's special magnitude labels into their meaning.

 DESCRIPTION:
  HD catalog encodes some non-magnitude information in the 
  magnitude field.

  Decode HD catalog's magnitude labels into their meaning.
  '20' becomes 'Nebula?'
  '30' becomes 'Variable?'
  '40' becomes 'Nova?'
  '50' becomes 'Cluster?'
  For any other values, '' is returned.
 
 These decodings are taken from the Vizier HD ReadMe file.

 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  Flag = hd_mag_to_flag(mag)

 INPUTS:
  Mag  -- Stellar magnitude as listed in HD catalog.  Scalar.

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  None

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  None
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  None

 EXAMPLE:
  print, hd_mag_to_flag(30d)
    [Prints 'Variable?']
 
 MODIFICATION HISTORY:
  Written  19-Oct-2005 by Henry Throop, SwRI
  Modified 28-Feb-2006 by HBT. Improved documentation and formatting.

(See oc/hd/hd_mag_to_flag.pro)


OC_CONVERTID_FLOAT_TYC2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_convertid_float_tyc2

 PURPOSE: (one line)
  Convert TY2 ID's from an internal floating-point format to standard format

 DESCRIPTION:
  Convert Tycho-2 ID's from an internal floating-point format to standard
  format to an internal floating-point format.  The floating-point format is
  used by the IDL occultation routines to refer uniquely to Tycho-2 stars
  more easily than handling strings.

  Tycho-2 ID's are in form "ZONE-SEQUENTIAL-NUM" (e.g., 2345-0312-1).
  The floating point values is (ZONE*10^5) + (SEQUENTIAL) (e.g. 234500312.0).
  We assume that the last component is always '1'.

  This function is the opposite of oc_convertid_tyc2_float.
  
 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  id_float = oc_convertid_float_tyc2( IDs [, CHAR=char], $
                                            [, /VERBOSE] [, /SHORT])

 INPUTS:
  IDs -- Tycho-2 ID(s).  Double, or array of doubles.

 OPTIONAL INPUT PARAMETERS:
  CHAR=char  -- If set, use a delimiter rather than '-' between the 
                Tycho-2 ID components.
  
 KEYWORD INPUT PARAMETERS:
  /VERBOSE -- If set, print diagnostics to screen.
  /SHORT   -- If set, omit the last TY2 component on output (usually "-1")

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  id_float -- Standard representation of Tycho-2 ID's, string format.
    Scalar or array, with same size as input IDs.
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  None

 EXAMPLE:
  print, oc_convertid_float_tyc2([000100017d, 234500312d])
    [Prints "0001-00017-1 2345-00312-1"]
 
 MODIFICATION HISTORY:
  Written   3-Nov-2005 by Henry Throop, SwRI
  Modified 27-Feb-2006 by HBT. Improved documentation and formatting.
  Modified 14-Apr-2006 by Leslie Young. Made loop index long.

(See oc/tyc2/oc_convertid_float_tyc2.pro)


OC_CONVERTID_TYC2_FLOAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_convertid_tyc2_float

 PURPOSE: (one line)
  Convert TY2 ID's from standard format to an internal floating-point format.

 DESCRIPTION:
  Convert Tycho-2 ID's from standard format to an internal floating-point
  format.  This floating-point format is used by the IDL occultation routines
  to refer uniquely to Tycho-2 stars more easily than handling strings.

  Tycho-2 ID's are in form "ZONE-SEQUENTIAL-NUM" (e.g., 2345-0312-1).
  We return the value (ZONE*10^5) + (SEQUENTIAL) (e.g., 234500312.0);
  we assume that the last component is always '1'.

  This function is the opposite of oc_convertid_float_tyc2 .
  
 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  id_float = oc_convertid_tyc2_float( IDs [, /VERBOSE])

 INPUTS:
  IDs -- Tycho-2 ID(s).  String, or array of strings.  

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  /VERBOSE -- If set, print diagnostics to screen.

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  id_float -- floating-point representation of Tycho-2 ID's.
    Scalar or array, with same size as input IDs.
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  None

 EXAMPLE:
  print, oc_convertid_tyc2_float(['0001-00017', '2345-312'])
    [Prints "100017.00   2.3450031e+08"]
 
 MODIFICATION HISTORY:
  Written   3-Nov-2005 by Henry Throop, SwRI
  Modified  7-Dec-2005 by HBT.  Improved error-handling.
  Modified 27-Feb-2006 by HBT. Improved documentation and formatting.
  Modified 14-Apr-2006 by Leslie Young. Made loop index long.

(See oc/tyc2/oc_convertid_tyc2_float.pro)


OC_CREATE_SUBCAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_create_subcat

 PURPOSE: (one line)
  Extract and create a subcatalog on disk of a full catalog.

 DESCRIPTION:
  Takes a bounding RA/DEC box and a catalog name, and uses WSCTools'
  SCAT to extract the stars within that box into their own text-format
  catalog on disk.  The output format is one which is compatible with
  WCSTools.  When searching through catalogs distributed in text format
  (e.g., HD), it can be more efficient to search through many small
  subcatalogs, vs. searching once through the full catalog.

  The files are placed in temporary directory $HDOCCUL_TMP .
  The idea is that they will be recreated if they are needed, but should not
  be regularly deleted.

  Currently this routine works only for the HD catalog.

  This routine is called by oc_subcat_create, which 

 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  oc_create_subcat, subcat_str, catalog [, /VERBOSE]

 INPUTS:
  subcat_str -- String specifying the catalog to create.  The string
    encodes the catalog name and the bounding box.
    Format is CAT_RA0_RA1_DE0_DE1, where CAT is the catalog
    name (e.g., 'hd'), and each of the four RA/DEC values is 
    an angle, in degrees.  Fractional angles are OK; RA must
    be in the range [0 .. 360), and DE must be in the range
    [-180 .. 180].

    Catalog name is converted to lower case if it is not already.

    This string name is also used verbatim for the output filename.

 OPTIONAL INPUT PARAMETERS:
  /VERBOSE -- Print diagnostic messages to screen.
  
 KEYWORD INPUT PARAMETERS:
  None

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  None
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  Creates file $HDOCCUL_TMP/subcat_str , or overwrites it if it already
  exists.

 RESTRICTIONS:
  Directory $HDOCCUL_TMP must exist.
  The specified catalog must exist and be accessible to WCSTools.

 EXAMPLE:
  
   oc_subcat_create, 'hd_262.4_262.5_-15.2_-15.1', /VERBOSE
 
 MODIFICATION HISTORY:
  Written  28-Jan-2005 by Henry Throop, SwRI
  Modified  9-Dec-2005 by HBT.  Renamed from create_subcat.pro, and minor
                                revisions.
  Modified 15-Dec-2006 by HBT.  Renamed again: oc_create_subcat ->
                                oc_subcat_create.
  Modified 23-Feb-2006 by HBT. Improved documentation and formatting.
                                Removed vestigial 'catalog' input param and
                                other minor changes.

(See oc/oc_subcat_create.pro)


OC_F2X_ROTMAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_f2x_rotmat
 PURPOSE: (one line)
  Return the matrix for rotating FGH to XYZ
 DESCRIPTION:
  Return the matrix for rotating FGH to XYZ
 CATEGORY:
  Occultations
 CALLING SEQUENCE:
  R = oc_f2x_rotmat(ra, dec)
 INPUTS:
  ra - right ascension of occultation star in radians
  dec - declination of occultation star in radians
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
  none
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  R - rotation matrix for rotating an FGH vector to XYZ
   FGH are defined as in Elliot et al. 1993. Astron. J. 106, 2544-2572
     H is toward the occultation star
     F is perpendicular to H and Z (Z x H)
     G completes the right hand system

    XYZ are defined in the usual manner
     X = cos(ra_s) cos(dec_s)
     Y = sin(ra_s) cos(dec_s)
     Z =     sin(dec_s)

 COMMON BLOCKS:
  None
 SIDE EFFECTS:
 RESTRICTIONS:
  None
 PROCEDURE:

  Since r is a rotation matrix, the inverse equals the transpose,
  and we simply call oc_x2f_rotmat
  
 USE:
  The matrix is defined so that
       xyz = R ## fgh     ; xyz, fgh column vectors
  where xyz and fgh are column vectors (Array[1,3]) and ## is the
  IDL operator for ordinary matrix multiplication (inner product).
  It is usually more convenient to use fgh and xyz as row vectors
  (Array[3]).  In this case we have
       xyz = transpose(R) # fgh     ; xyz, fgh row vectors

 MODIFICATION HISTORY:
  2005 Dec 29 Leslie A Young SwRI

(See oc/oc_f2x_rotmat.pro)


OC_GETLINE_HD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_getline_hd

 PURPOSE: (one line)
  Return the raw catalog line from HD catalog for a given ID or IDs.

 DESCRIPTION:
  Return the raw catalog line from HD catalog for a given ID or IDs.
  The catalog line is a single line of text which is human-readable,
  although it must be carefully interpreted.

 This routine searches through the catalog using grep.  For small catalogs
 like this, grep is fast enough.
 

 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  lines = oc_getline_hd( ids [, NSTARS=nstars] [, /VERBOSE])

 INPUTS:
  IDs -- A list of HD ID's.  Scalar or vector.
   IDs must be in HD format and are recommended to be strings, rather
   than numerical values, due to precision and wraparound.

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  /VERBOSE -- If set, print diagnostics to screen.

 KEYWORD OUTPUT PARAMETERS:
  NSTARS -- Returns the number of successfully-retrieved lines.

 OUTPUTS:
  If input is a scalar, then output is a single string.
  If input is a vector, then output is an array of strings.
  If a star is not found, returned value is ''.
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  HD catalog must be available at $WCS_CATDIR/hd/catalog.dat .

 EXAMPLE:
  print, oc_getline_hd(['430', '1000'])
 
 MODIFICATION HISTORY:
  Written   2-Nov-2005 by Henry Throop, SwRI
  Modified 27-Feb-2006 by HBT. Improved documentation and formatting.
  Modified 05-Mar-2006 by LAY. Change nstars to count (consistent
                               with oc_getline_ucac2)
  Modified 15-Mar-2006 by HBT. Undid LAY's nstars change (hah!), 
                               as it already was consistent w/ ucac2.
  Modifoed 23 Apr 2006 by LAY. Finished the undoing of nstars
                               (increment nstars, not count) and
                               chane spawn to call to nthline -
                               lookup table

(See oc/hd/oc_getline_hd.pro)


OC_GETLINE_SAO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_getline_sao

 PURPOSE: (one line)
  Return the raw catalog line from SAO catalog for a given ID or IDs.

 DESCRIPTION:
  Return the raw catalog line from SAO catalog for a given ID or IDs.
  The catalog line is a single line of text which is human-readable,
  although it must be carefully interpreted.

 This routine searches through the catalog using grep.  For small catalogs
 like this, grep is fast enough.
 

 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  lines = oc_getline_sao( ids [, NSTARS=nstars] [, /VERBOSE])

 INPUTS:
  IDs -- A list of SAO ID's.  Scalar or vector.
   IDs must be in SAO format and are recommended to be strings, rather
   than numerical values, due to precision and wraparound.

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  /VERBOSE -- If set, print diagnostics to screen.

 KEYWORD OUTPUT PARAMETERS:
  NSTARS -- Returns the number of successfully-retrieved lines.

 OUTPUTS:
  If input is a scalar, then output is a single string.
  If input is a vector, then output is an array of strings.
  If a star is not found, returned value is ''.
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  SAO catalog must be available at $WCS_CATDIR/sao/catalog.dat .

 EXAMPLE:
  print, oc_getline_sao(['430', '1000'])
 
 MODIFICATION HISTORY:
  Written   2-Nov-2005 by Henry Throop, SwRI
  Modified 27-Feb-2006 by HBT. Improved documentation and formatting.
  Modified 05-Mar-2006 by LAY. Change nstars to count (consistent
                               with oc_getline_ucac2)
  Modified 15-Mar-2006 by HBT. Undid LAY's nstars change (hah!), 
                               as it already was consistent w/ ucac2.

(See oc/sao/oc_getline_sao.pro)


OC_GETLINE_TYC2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_getline_tyc2

 PURPOSE: (one line)
  Return the raw catalog line from TYC2 catalog for a given ID or IDs.

 DESCRIPTION:
  Return the raw catalog line from TYC2 catalog for a given ID or IDs.
  The catalog line is a single line of text which is human-readable,
  although it must be carefully interpreted.

  Because the TYC2 catalog is quite long (2M entries, 200M bytes), it is
  inefficient to read the whole thing in, or grep through it.  Instead, we
  use associative arrays to read individual arbitrary lines.

 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  lines = oc_getline_tyc2( ids [, NSTARS=nstars] [, /VERBOSE])

 INPUTS:
  IDs -- A list of TYC2 ID's.  Scalar or vector.  String.
   IDs must be in standard TYC2 format.

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  None

 KEYWORD OUTPUT PARAMETERS:
  NSTARS -- Returns the number of successfully-retrieved lines.
  /VERBOSE -- If set, print diagnostics to screen.

 OUTPUTS:
  If input is a scalar, then output is a single string.
  If input is a vector, then output is an array of strings.
  If a star is not found, returned value is ''.
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  Tycho-2 catalog must be available at $WCS_CATDIR/tyc2/catalog.dat .

 EXAMPLE:
  lines = oc_getline_tyc2(['9537 03881', '000100017', '1-22'], nstars=nstars)
    [Reads in two valid stars and one invalid one, and sets NSTARS=2]

 MODIFICATION HISTORY:
  Written   1-Nov-2005 by Henry Throop, SwRI
  Modified 27-Feb-2006 by HBT. Improved documentation and formatting.
  Modified  7-Mar-2006 by LAY. Changed getenv to be consistent with scat

(See oc/tyc2/oc_getline_tyc2.pro)


OC_GETLINE_TYC2_HD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_getline_tyc2_hd

 PURPOSE: (one line)
  Return raw catalog line from TYC2<->HD conversion catalog. 

 DESCRIPTION:
  Return raw catalog line from TYC2<->HD conversion catalog, given 
  TYC2 or HD ID(s).

  This routine does not do the matching; it only retrieves 
  raw lines from the conversion catalog.  It is called by
  oc_getrec_tyc2_hd.pro, which is the end-user routine.
 
  The catalog is Vizier IV/25, Fabricius et al 2002.

 CATEGORY:
  Category
  
 CALLING SEQUENCE:
  lines = oc_getline_tyc2_hd( {HD=hd | TYC2=tyc2} [, NTH=nth], $
                               [, NSTARS=nstars]  [, /VERBOSE]

 INPUTS:
  HD   = hd    -- Either HD= *or* TYC2= must be passed.  Each is an ID 
  TYC2 = tyc2     or array of ID's, in the standard format for that catalog.

 OPTIONAL INPUT PARAMETERS:
  NTH -- Return the nth possible match for each star, if possible; if not,
         return a lower match.  E.g., there may be 2 TYC2 stars for 1 HD ID.
         Setting NTH=0 will return the first match for this star and
         NTH=1 with return the second match to the star.  For stars
         on which there is only one match, it will return the single
         match.
  
  /VERBOSE -- If set, print diagnostics to screen.

 KEYWORD INPUT PARAMETERS:
  None

 KEYWORD OUTPUT PARAMETERS:
  NSTARS -- Returns the number of successfully-retrieved lines.

 OUTPUTS:
  String or array of strings.  Same dimensions as input ID, regardless of
  multiple matches or non-matches.

  If HD=   is passed for input, returned values are for Tycho-2 stars.
  If TYC2= is passed for input, returned values are for HD stars.

  If a star has no match, an empty string is returned for that element.
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  Tycho2-HD catalog must exist at $WCS_CATDIR/tyc2_hd/tyc2_hd.dat .

 EXAMPLE:
  print, oc_getline_tyc2_hd(HD=[0,1,10,100,1000,10000d], nstars=nstars, /VER)
   [Returns 5 matches and one non-match, setting nstars=5]
 
 MODIFICATION HISTORY:
  Written   3-Nov-2005 by Henry Throop, SwRI.
  Modified  7-Dec-2005 by HBT.  Improved multiple- and non-match handling.
  Modified 27-Feb-2006 by HBT.  Improved documentation and formatting.
  Modified  7-Mar-2006 by LAY.  Fixed bug in indexing line for nth>lines-1
                                and changed documentation to reflect nth=0..lines-1
  Modified 14-Apr-2006 by Leslie Young. Made loop index long.

(See oc/tyc2_hd/oc_getline_tyc2_hd.pro)


OC_GETREC_TYC2_HD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_getrec_tyc2_hd

 PURPOSE: (one line)
  Return structure that correlates TYC2 and HD catalogs, given stellar ID(s).

 DESCRIPTION:
  Return a fully-populated tyc2_hd record, based on a supplied Tycho-2 or HD
  ID.  The structure is similar to a star structure, but with 
  different fields.   The record can be used to match star with its
  counterpart(s) in the HD or Tycho-2 catalog.
 
  The structure type implements the fields in the Vizier ReadMe file
  for the catalog.  The catalog is Vizier IV/25, Fabricius et al 2002.

  Statistics: 272152 stars in HD catalog
              385 stars in tyc2_hd where 2 HD stars match  1 TYC2 star
              16  stars in tyc2_hd where 1 HD star matches 2 TYC2 stars
              ~400 HD stars which match no TYC2 star

 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  lines = oc_getrec_tyc2_hd( {HD=hd | TYC2=tyc2} [, NTH=nth], $
                               [, NSTARS=nstars]  [, /VERBOSE]
 

 INPUTS:
  HD   = hd    -- Either HD= *or* TYC2= must be passed.  Each is an ID 
  TYC2 = tyc2     or array of ID's, in the standard format for that catalog.

 OPTIONAL INPUT PARAMETERS:
  NTH -- Return the nth possible match for each star, if possible; if not,
         return a lower match.  E.g., there may be 2 TYC2 stars for 1 HD ID.
         Setting NTH=0 will return the first match for this star and
         NTH=1 with return the second match to the star.  For stars
         on which there is only one match, it will return the single
         match.
  
  /VERBOSE -- If set, print diagnostics to screen.

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  None

 KEYWORD OUTPUT PARAMETERS:
  NSTARS -- Returns the number of successfully-retrieved records.

 OUTPUTS:
  Structure or array of structures. Same dimensions as input ID, regardless
  of multiple matches or non-matches.

  If HD=   is passed for input, returned values are for Tycho-2 stars.
  If TYC2= is passed for input, returned values are for HD stars.

  If a star has no match, an empty structure is returned for that element.

  None
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  Tycho2-HD catalog must exist at $WCS_CATDIR/tyc2_hd/tyc2_hd.dat .

 EXAMPLE:
  recs = oc_getrec_tyc2_hd(HD=[0,1,10,100,1000,10000d], nstars=nstars)
   [Returns 5 matches and one non-match, setting nstars=5]
 
 MODIFICATION HISTORY:
  Written   3-Nov-2005 by Henry Throop, SwRI
  Modified 30-Nov-2005 by HBT.  Fixed to read in n_hd, n_tyc properly.
                                Changed output format of .tyc2 field.
                                Improved handling of multiple- and 
                                non-matches.
  Modified  7-Dec-2005 by HBT.  Improved error handling.
  Modified 28-Feb-2006 by HBT.  Improved documentation and formatting.
  Modified  7-Mar-2006 by LAY.  Changed documentation to reflect nth=0..lines-1
  Modified 14-Apr-2006 by Leslie Young. Made loop index long.

(See oc/tyc2_hd/oc_getrec_tyc2_hd.pro)


OC_GETSTAR_HD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_getstar_hd

 PURPOSE: (one line)
  Returns HD star structures given their ID's.
  
 DESCRIPTION:
  Returns a fully-populated HD star structure for each ID supplied.
  The ID's must be in the HD format.  The star structure is returned in 
  the standard format, and includes the raw HD catalog line as well as 
  standard-format RA, DEC, magnitudes, etc.
 
 CATEGORY:
  Star catalogs
 
 CALLING SEQUENCE:
  oc_getstar_hd, ids [, NSTARS=nstars] [, /VERBOSE]

 INPUTS:
  ids -- HD id's in string format.  Can be either scalar or vector.
         Either SCAT-format SCAT-format ('221.00434') or standard UCAC2 
           format ('00534450'), but all ids must be in the same format.

 OPTIONAL INPUT PARAMETERS:
  None

 KEYWORD INPUT PARAMETERS:
  VERBOSE -- Print messages about incorrect/missing ID's to screen if set.

 KEYWORD OUTPUT PARAMETERS:
  NSTARS -- Returns the number of successfully-retrieved stars

 OUTPUTS:
  Structures of type 'star' with fields filled in.  
  Returns either a vector or a scalar depending on input value 'ids'.
  Length of returned value is the same as that of input 'ids.'

  The field star.hd.record is the HD text catalog entry.
  The fields in star.hd.* are exactly as described in the 
    HD Vizier ReadMe file.
  If a star is not found, that entry is blank.
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  HD catalog must be available at $WCS_CATDIR/hd/catalog.dat .

 EXAMPLE:
  print, (oc_getstar_hd(['0', '1000', '10000'])).id
    [Prints "none 1000 10000"]
 
 MODIFICATION HISTORY:
  Written  18-Oct-2005 by Henry Throop, SwRI
  Modified 30-Oct-2005 by HBT.  Fixed to read magnitudes properly.
  Modified  7-Dec-2005 by HBT.  Fixed to handle invalid ID's properly.
                                Changed SILENT->VERBOSE.
  Modified 27-Feb-2006 by HBT. Improved documentation and formatting.
  Modified 05-Mar-2006 by LAY. Change nstars to count (consistent
                               with oc_getline_ucac2)
  Modified 14-Mar-2006 by HBT.  Undid LAY's nstars change (hah!)
                               (It was already consistent.)
                                Fixed handling of undefined mag's
                                for HD=37020-37026.
  Modified 24-Mar-2006 by HBT.  Added fields for ETPM, RA_ETPM, etc.

(See oc/hd/oc_getstar_hd.pro)


OC_GETSTAR_HD_TEST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_getstar_hd_test

 PURPOSE: (one line)
  Tests the oc_getstar_hd routines and compares to Vizier results.

 DESCRIPTION:
  Gets the RA/DEC for a number of HD stars.  Precesses them and 
  prints their coordinates in J2000 and B1900, in d:m:s and d:m.m.
  These can be compared to the identical output from Vizier, to 
  verify that precession is done properly.

 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  oc_getstar_hd_test

 INPUTS:
  None

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  None

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  None
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  None

 EXAMPLE:
  oc_getstar_hd_test
 
 MODIFICATION HISTORY:
  Written  20-Oct-2005 by Henry Throop, SwRI
  Modified 23-Feb-2006 by HBT. Improved documentation and formatting.

(See oc/hd/oc_getstar_hd_test.pro)


OC_GETSTAR_SAO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_getstar_sao

 PURPOSE: (one line)
  Returns SAO star structures given their ID's.
  
 DESCRIPTION:
  Returns a fully-populated SAO star structure for each ID supplied.
  The ID's must be in the SAO format.  The star structure is returned in 
  the standard format, and includes the raw SAO catalog line as well as 
  standard-format RA, DEC, magnitudes, etc.
 
 CATEGORY:
  Star catalogs
 
 CALLING SEQUENCE:
  oc_getstar_sao, ids [, NSTARS=nstars] [, /VERBOSE]

 INPUTS:
  ids -- SAO id's in string format.  Can be either scalar or vector.
         Either SCAT-format SCAT-format ('221.00434') or standard UCAC2 
           format ('00534450'), but all ids must be in the same format.

 OPTIONAL INPUT PARAMETERS:
  None

 KEYWORD INPUT PARAMETERS:
  VERBOSE -- Print messages about incorrect/missing ID's to screen if set.

 KEYWORD OUTPUT PARAMETERS:
  NSTARS -- Returns the number of successfully-retrieved stars

 OUTPUTS:
  Structures of type 'star' with fields filled in.  
  Returns either a vector or a scalar depending on input value 'ids'.
  Length of returned value is the same as that of input 'ids.'

  The field star.sao.record is the SAO text catalog entry.
  The fields in star.sao.* are exactly as described in the 
    SAO Vizier ReadMe file.
  If a star is not found, that entry is blank.
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  SAO catalog must be available at $WCS_CATDIR/sao/catalog.dat .

 EXAMPLE:
  print, (oc_getstar_sao(['0', '1000', '10000'])).id
    [Prints "none 1000 10000"]
 
 MODIFICATION HISTORY:
  

(See oc/sao/oc_getstar_sao.pro)


OC_GETSTAR_TY2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_getstar_ty2

 PURPOSE: (one line)
   Returns Tycho-2 star structures given their ID's.

 DESCRIPTION:
  Returns a fully-populated Tycho-2 star structure for each ID supplied.
  The ID's must be in the Tycho-2 format.  The star structure is returned in 
  the standard format, and includes the raw Tycho-2 data as well as 
  standard-format RA, DEC, magnitudes, etc.

  The Tycho-2 Supplement is not searched.

 CATEGORY:
  Star catalogs.
  
 CALLING SEQUENCE:
  oc_getstar_tyc2, ids [, NSTARS=nstars] [, /VERBOSE]

 INPUTS:
  ids -- Tycho-2 id's in string format.  Can be either scalar or vector.

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  VERBOSE -- Print messages about incorrect/missing ID's to screen if set.

 KEYWORD OUTPUT PARAMETERS:
  NSTARS -- Returns the number of successfully-retrieved stars

 OUTPUTS:
  Structures of type 'star' with fields filled in.  
  Returns either a vector or a scalar depending on input value 'ids'.
  Length of returned value is the same as that of input 'ids.'
  The field star.tyc2.record is the Tycho-2 catalog entry line.
  The remaining fields in star.tyc2.* are exactly as described in the 
  Vizier Tycho-2 'ReadMe' file.

  If a star is not found, that entry is blank.
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  Tycho-2 catalog must be available at $WCS_CATDIR/tyc2/catalog.dat .

 EXAMPLE:
   print, oc_getstar_tyc2(['9537-003881', '9537-00309'], nst=nst, /VERB)
 
 MODIFICATION HISTORY:
  Written  18-Oct-2005 by Henry Throop, SwRI
  Modified 30-Nov-2005 by HBT.  Fixed to properly parse TYC/HIP/CCDM fields.
  Modified  7-Dec-2005 by HBT.  Fixed to handle unfound stars.
  Modified  8-Dec-2005 by HBT.  Fixed units for position error and pm.
  Modified 23-Feb-2006 by HBT.  Improved documentation and formatting.
  Modified 28-Feb-2006 by HBT.  Fixed to handle missing positions (pflag='X')
  Modified 24-Mar-2006 by HBT.  Added handling of proper motion with 
                        ETPM, ra_etpm, etc.
  Modified 14-Apr-2006 by Leslie Young. Made loop index long.

(See oc/tyc2/oc_getstar_tyc2.pro)


OC_GETSTAR_TYC2_TEST.PRO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_getstar_tyc2_test.pro

 PURPOSE: (one line)
  Validates the oc_getstar_tyc2 routine by searching for Tycho-2 stars.

 DESCRIPTION:
  Searches for a large number of stars, using made-up ID's.  
  Some of these will be valid; most will be invalid.  The 
  results are printed, along with 'benchmark' results 
  to compare to to validate proper functionality.

  Then, prints a series of diagnostics to verify that proper motion
  is applied properly.
 
 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  oc_getstar_tyc2_test

 INPUTS:
  None

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  None

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  None
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  Tycho-2 catalog must be available at $WCS_CATDIR/tyc2/catalog.dat .

 EXAMPLE:
  oc_getstar_tyc2_test
   [Makes a plot, and prints results along with benchmark results]
 
 MODIFICATION HISTORY:
  Written   2-Nov-2005 by Henry Throop, SwRI.
  Modified 28-Feb-2006 by HBT. Improved documentation and formatting.
  Modified 24-Feb-2006 by HBT. Added testing of proper motion fields.

(See oc/tyc2/oc_getstar_tyc2_test.pro)


OC_HD_TYC2_TEST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_hd_tyc2_test

 PURPOSE: (one line)
  Test to validate that HD -> TYC2 ID's can be properly matched.

 DESCRIPTION:
  Tests end-to-end HD search and matching to TYC2.  Makes a plot
  showing positions of HD and TYC2 stars.  This is a very
  extensive test, which validates many many routines.

  Program oc_test_tyc2_hd tests this in the opposite direction.

 CATEGORY:
  Star catalogs.
  
 CALLING SEQUENCE:
  oc_hd_tyc2_test

 INPUTS:
  None

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  None

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  None

 EXAMPLE:
  oc_hd_tyc2_test
 
 MODIFICATION HISTORY:
  Written   4-Nov-2005 by Henry Throop, SwRI
  Modified 15-Dec-2005 by HBT. Minor changes.
  Modified 23-Feb-2006 by HBT. Improved documentation and formatting.
  Modified 24-Mar-2006 by HBT. Renamed oc_test_hd_tyc2 -> oc_hd_tyc2_test

(See oc/tyc2_hd/oc_hd_tyc2_test.pro)


OC_LLA2XYZ

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_lla2xyz
 PURPOSE: (one line)
  Return the geocentric J2000 XYZ of a site on Earth at a given time
 DESCRIPTION:
  Return the geocentric J2000 state vector of a site on Earth at a given time
 CATEGORY:
  Occultations
 CALLING SEQUENCE:
  rec6 = oc_lla2xyz(lonlatalt, et)
 INPUTS:
  lonlatalt = lon,lat,alt vector
   lonlatalt[0] = East longitude in radian
   lonlatalt[1] = latitude in radian
   lonlatalt[2] = altitude in km
  et = TBD seconds after J2000 ('ephemeris time' in NAIF lingo)
   a scalar or a vector
 OPTIONAL INPUT PARAMETERS:
  frame (default 'J2000')
 KEYWORD INPUT PARAMETERS:
  none
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  rec6 = [X,Y,Z, dX/dt, dY/dt, dZ/dt]
   This is a J2000 state vector as descibed in the NAIF documents
   XYZ are in km, derivatives in km/s
   Coordinate system is J2000. 
   Origin is the Earth center, head is the site at the specified lon,lat,alt
  If et is a vector of n elements, then
   rec6 will be a matrix 6 x n
 COMMON BLOCKS:
  None
 SIDE EFFECTS:
 RESTRICTIONS:
  None
 PROCEDURE:

 MODIFICATION HISTORY:
  2005 Dec 29 Leslie A Young SwRI

(See oc/oc_lla2xyz.pro)


OC_MKSTAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   oc_mkstar

 PURPOSE:
   Returns an array of star structures.

 DESCRIPTION:
   Construct an array of star structures from argumant lists

 CALLING SEQUENCE:
   star = oc_mkstar(et, ra, dec, nstar)

 INPUTS:
   et     - ephemeris time (TDB seconds path J2000) of positions
   ra - J2000 right ascension in radians (scalar or array)
   dec - J2000 declination in radians (scalar or array)
   ra and dec are the same length (nstar)
 KEYWORDS
   idcat  - catalog for id.  String or array of length nstar. Default 'none' 
   idval  - id.  String or array of length nstar. Default 'none' 
            (using idval for star.id to avoid keyword name conflicts)
   poscat - catalog for ra, dec, raerr, decerr, radot, decdot,
            radoterr, decdoterr.  String or array of length nstar. 
            Default 'none' 
   raerr  - error in ra * cos(dec).  Radians. Scalar or array of
            length nstar.  Default -999
   decerr - error in dec.  Radians. Scalar or array of
            length nstar.  Default -999
   radotval -  proper motion in ra*cos(dec), radian/s.  Scalar or array
           of length nstar.  Default -999
   decdotval -  proper motion in dec, radian/s.  Scalar or array
           of length nstar.  Default -999
   radoterr - error in radot.  Radian/s. Scalar or array of length
              nstar. Default -999.
   decdoterr - error in decdot.  Radian/s. Scalar or array of length
              nstar. Default -999.
   etpm      - time of proper motion pivot point (where pm err
               doesn't contribute to raerr and decerr)
               Default et
   ra_etpm   - RA at etpm (default ra)
   dec_etpm  - Dec at etpm (default dec)
   raerr_etpm   - error in cos(dec)*RA at etpm (default raerr)
   decerr_etpm  - error in dec at etpm (default decerr)
   magcat - catalog for magname, mag, magerr.  String.  Scalar or array
            of length nmag. Default 'none'
   magname - name (eg filter) for mag, magerr.  String.  Array
            of length nmag. Default 'none'
   magval  - magnitudes.  Array of size [nmag, nstar]. Default -999.
             (using magval for star.mag to avoid keyword name conflicts)
   magerr  - error in mag.  Array of size [nmag, nstar]. Default -999.
   SpTcat  - catalog for SpT.  String or array of length
             nstar. Default 'none' 
   SpT     - spectral type. String or array of length nstar.  Default ''  
   notecat - catalogs for notes. Array of length nnote. Default 'none'
   note    - Notes.  Array of size [nnote, nstar]
   structname - fieldname for optional structure (default 'mkstar')
   structval  - Array of structures of length nstar with 
                user-defined information
 OUTPUTS:
   nstar - number of stars in array
   star - returns an array of star structures, optionally
      with star.mkstar structures 


 REVISON HISTORY:
   2005 Dec 29 Leslie A Young, SwRI 
   2006 Mar 12 LAY Added etpm, ra_etpm, dec_etpm, raerr_etpm, decerr_etpm
        Actually do the assignment of structval into the star
        structure array

(See oc/oc_mkstar.pro)


OC_NAIF_EV

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  oc_naif_ev
  
 PURPOSE: (one line)
  Find events given stars and an ephemeris list with naif info

 DESCRIPTION:
  Find events given stars and an ephemeris list with naif info

 CATEGORY:
  Occultation
  
 CALLING SEQUENCE:
  ev = oc_naif_ev(stars, eph, nev, posindex = posindex, VERBOSE = verbose, maxsep=maxsep)

 INPUTS:
  eph - array of ephemeris structures
  stars - array of star structure

 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  posindex - array (same length as stars) as a pointer into eph
  maxsep - maximum c/a separation
  /VERBOSE -- 
     Verbose = 1 Print error messages to screen 
     Verbos = 2 Print debugging statements 

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  Returns an array of event structures
    ev.et
    ev.fgh
    ev.fgherr
    ev.star
    ev.eph
  
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 EXAMPLE:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 2006 July 3 LAY

(See oc/oc_naif_ev.pro)


OC_SCAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_scat

 PURPOSE: (one line)
  call scat (Doug Mink) using spawn and report results

 DESCRIPTION:
  call scat (Doug Mink) using spawn and report results

 CATEGORY:
  Star catalogs.
  
 CALLING SEQUENCE: 
  ids = oc_scat(RA, DEC, RADIUS, NSTARS,  $
                            CATALOG=catalog [, /VERBOSE] )

 INPUTS:
  RA     -- Right ascension of center of search position.  Radians, J2000.
  DEC    -- Declination     of center of search position.  Radians, J2000.
  RADIUS -- Search radius.  Radians. 

  Inputs are single values, not arrays.

 OPTIONAL INPUT PARAMETERS:
  None

 KEYWORD INPUT PARAMETERS:
  CATALOG= -- Name of the catalog to use; e.g., 'HD', 'TY2', 'UCAC2', '2MASS'
    Defaults to 'HD' if not set.
  /VERBOSE -- If set, print error messages to screen.

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  result -- Array of stars found by scat
  NSTARS -- Number of stars found
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  The proper environment variable must be set for the catalog called.
   $TY2_PATH   -- For Tycho-2 catalog
   $WCS_CATDIR -- For HD and other WCS-based catalogs
   $UCAC2_PATH -- For UCAC2 catalog
   $TMC_PATH -- For UCAC2 catalog

 EXAMPLE:
  ids = oc_scat(0.5, 0.5, 0.01, nstars, catalog='hd')
 
 MODIFICATION HISTORY:
  Written  02-Jul-2006 by Leslie Young, SwRI, based on oc_search_pos_fullcat

(See oc/oc_scat.pro)


OC_SEARCH_EPH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_eph
 PURPOSE: (one line)
  Return array of star structures around ephemeris positions
 DESCRIPTION:
  Return array of star structures
 CATEGORY:
  occultation
 CALLING SEQUENCE:
 stars = oc_search_eph(eph, radius, single_fun, $
   nstars, _extra=extra,
   verbose=verbose)
 INPUTS:
  eph - ephemeris structure
  radius - search radius (radian) 
  single_fun - string name of search function for stars
   around one position.
   MUST BE OF THE FORM
   stars = single_func(ra, dec, radius, nstars, verbose=verbose,
   _extra=extra)
   where stars = -1 and nstars = 0 for no matches
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
  verbose : set (1) to print out information
  _extra : passed to single_func
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  nstars : number of stars found (0 if none)
  posindex : index array of length nstars into raArr and decArr
  returns array of star array (-1 is none found)
 COMMON BLOCKS:
  None
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
  call oc_search_pos_multiple, then ensure that a single event
  is only reported a single time. 
 MODIFICATION HISTORY:
  Written 2005 December, by Leslie Young, SwRI
  2006 July 02 LAY comment out help command

(See oc/oc_search_eph.pro)


OC_SEARCH_EPH_HD_HBT[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_eph_hd_hbt

 PURPOSE: (one line)
  Search the HD catalog using a list of positions in an ephemeris.

 DESCRIPTION:
  Search the HD catalog using a list of positions in an ephemeris.

  Routine is not very fast.  It calls 'scat' once per ephemeris point,
  and each call takes ~1 second to run.

  This routine currently returns each star ID a maximum of once, no 
  matter how many times the ephemeris may pass in front of it.  This is
  a limited and should be fixed, e.g., by calling LAY's oc_which_uniquev.

 CATEGORY:
  Occultations
  
 CALLING SEQUENCE:
  stars = oc_search_eph_hd_hbt( eph, ephindex [, NSTARS=nstars] $
                                [, MISS=miss] $
                                [, RADIUS=radius] [, /VERBOSE] )

 INPUTS:
  eph      -- Ephemeris.  Structure, or array of structures.

 OPTIONAL INPUT PARAMETERS:
  None
  
 OPTIONAL OUTPUT PARAMETERS:
  ephindex -- Index linking stars to ephemeris points at which they 
              were found.  Ephindex is of length nstars.  Ephindex[7] = 100
              indicates that the 7th stars was found at the 100th 
              ephemeris point searched.

 KEYWORD INPUT PARAMETERS:
  MISS     -- Miss distance between object and star.  Double, radians.
  /VERBOSE -- Print diagnostic messages to screen.

 KEYWORD OUTPUT PARAMETERS:
  NSTARS   -- Number of unique stars found.
  RADIUS   -- Search radius = sqrt(miss^2 + arclen^2)

 OUTPUTS:
  None
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  None

 EXAMPLE:
  stars = oc_search_eph_hd_hbt(eph, ephindex, nstars, MISS=2*arcmin, $
                               radius=radius, /VERBOSE)
 
 MODIFICATION HISTORY:
  Written   9-Dec-2005 by Henry Throop, SwRI.  Based on Leslie Young's
                    program occlpred/uvis/search_hd.pro
                    LAY and HBT in parallel modified that code into two
                    strains of the present code.
  Modified 15-Dec-2005 by HBT.  Fixed ephindex algorithm.
  Modified 23-Feb-2006 by HBT.  Improved documentation and formatting.
  Modified 13-Mar-2006 by HBT.  Added MISS= keyword.
  Modified 14-Mar-2006 by HBT.  Added RADIUS= keyword.  Pared down by 
                    removing TYC2 matching and plotting routines, and 
                    putting these into the _test routine.
  Modified 14-Apr-2006 by Leslie Young. Made loop index long.

(See oc/oc_search_eph_hd_hbt.pro)


OC_SEARCH_EPH_HD_HBT[2]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_eph_hd_hbt

 PURPOSE: (one line)
  Search the HD catalog using a list of positions in an ephemeris.

 DESCRIPTION:
  Search the HD catalog using a list of positions in an ephemeris.

  Routine is not very fast.  It calls 'scat' once per ephemeris point,
  and each call takes ~1 second to run.

  This routine currently returns each star ID a maximum of once, no 
  matter how many times the ephemeris may pass in front of it.  This is
  a limited and should be fixed, e.g., by calling LAY's oc_which_uniquev.

 CATEGORY:
  Occultations
  
 CALLING SEQUENCE:
  stars = oc_search_eph_hd_hbt( eph, ephindex [, NSTARS=nstars] $
                                [, MISS=miss] $
                                [, RADIUS=radius] [, /VERBOSE] )

 INPUTS:
  eph      -- Ephemeris.  Structure, or array of structures.

 OPTIONAL INPUT PARAMETERS:
  None
  
 OPTIONAL OUTPUT PARAMETERS:
  ephindex -- Index linking stars to ephemeris points at which they 
              were found.  Ephindex is of length nstars.  Ephindex[7] = 100
              indicates that the 7th stars was found at the 100th 
              ephemeris point searched.

 KEYWORD INPUT PARAMETERS:
  MISS     -- Miss distance between object and star.  Double, radians.
  /VERBOSE -- Print diagnostic messages to screen.

 KEYWORD OUTPUT PARAMETERS:
  NSTARS   -- Number of unique stars found.
  RADIUS   -- Search radius = sqrt(miss^2 + arclen^2)

 OUTPUTS:
  None
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  None

 EXAMPLE:
  stars = oc_search_eph_hd_hbt(eph, ephindex, nstars, MISS=2*arcmin, $
                               radius=radius, /VERBOSE)
 
 MODIFICATION HISTORY:
  Written   9-Dec-2005 by Henry Throop, SwRI.  Based on Leslie Young's
                    program occlpred/uvis/search_hd.pro
                    LAY and HBT in parallel modified that code into two
                    strains of the present code.
  Modified 15-Dec-2005 by HBT.  Fixed ephindex algorithm.
  Modified 23-Feb-2006 by HBT.  Improved documentation and formatting.
  Modified 13-Mar-2006 by HBT.  Added MISS= keyword.
  Modified 14-Mar-2006 by HBT.  Added RADIUS= keyword.  Pared down by 
                    removing TYC2 matching and plotting routines, and 
                    putting these into the _test routine.
  Modified 14-Apr-2006 by Leslie Young. Made loop index long.

(See oc/hd/oc_search_eph_hd_hbt.pro)


OC_SEARCH_EPH_HD_HBT_TEST[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_eph_hd_hbt_test

 PURPOSE: (one line)
  End-to-end test of HD ephemeris-searching routines, and TYC2-HD matching.

 DESCRIPTION:
  Reads in an ephemeris for Jupiter, and searches the HD catalog
  for stars which pass near it.  The HD stars are matched with their
  TYC2 counterparts, and the results plotted at each timestep.

  Routine uses the subcatalog search, not the full catalog search.  The
  subcatalog takes longer the first time, but is substantially faster on
  subsequent runs.

  Subsequent runs take ~15 minutes -- it still is a long search.

 CATEGORY:
  Occultations
  
 CALLING SEQUENCE:
  oc_search_eph_hd_hbt_test [, /VERBOSE]

 INPUTS:
  None

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  /VERBOSE -- If set, print diagnostics to screen.

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  None
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  File $HDOCCUL/sav/jupiter_20071201_20080715_144.000.sav must exist.
  Directory $HDOCCUL_TMP must exist.

 EXAMPLE:
  oc_search_eph_hd_hbt_test
 
 MODIFICATION HISTORY:
  Written   9-Dec-2005 by H. Throop, SwRI
  Modified 13-Mar-2006 by HBT. Improved documentation and formatting.
                      Renamed oc_search_eph_hbt -> oc_search_eph_hd_hbt_test.
  Modified 14-Mar-2006 by HBT.  Brought plotting and TYC2 matching from
                       oc_search_eph_hd_hbt.pro into here, where they belong.

(See oc/oc_search_eph_hd_hbt_test.pro)


OC_SEARCH_EPH_HD_HBT_TEST[2]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_eph_hd_hbt_test

 PURPOSE: (one line)
  End-to-end test of HD ephemeris-searching routines, and TYC2-HD matching.

 DESCRIPTION:
  Reads in an ephemeris for Jupiter, and searches the HD catalog
  for stars which pass near it.  The HD stars are matched with their
  TYC2 counterparts, and the results plotted at each timestep.

  Routine uses the subcatalog search, not the full catalog search.  The
  subcatalog takes longer the first time, but is substantially faster on
  subsequent runs.

  Subsequent runs take ~15 minutes -- it still is a long search.

 CATEGORY:
  Occultations
  
 CALLING SEQUENCE:
  oc_search_eph_hd_hbt_test [, /VERBOSE]

 INPUTS:
  None

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  /VERBOSE -- If set, print diagnostics to screen.

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  None
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  File $HDOCCUL/sav/jupiter_20071201_20080715_144.000.sav must exist.
  Directory $HDOCCUL_TMP must exist.

 EXAMPLE:
  oc_search_eph_hd_hbt_test
 
 MODIFICATION HISTORY:
  Written   9-Dec-2005 by H. Throop, SwRI
  Modified 13-Mar-2006 by HBT. Improved documentation and formatting.
                      Renamed oc_search_eph_hbt -> oc_search_eph_hd_hbt_test.
  Modified 14-Mar-2006 by HBT.  Brought plotting and TYC2 matching from
                       oc_search_eph_hd_hbt.pro into here, where they belong.

(See oc/hd/oc_search_eph_hd_hbt_test.pro)


OC_SEARCH_MULTIPLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_multiple
 PURPOSE: (one line)
  Return array of star structures around multiple positions
 DESCRIPTION:
  Return array of star structures
 CATEGORY:
  occultation
 CALLING SEQUENCE:
 stars = oc_search_multiple(raArr, decArr, radius, single_fun, $
   nstars, _extra=extra,
   verbose=verbose)
 INPUTS:
  raArr - right ascension (radian)
  decArr - declination (radian)
  radius - search radius (radian) 
  single_fun - string name of search function for stars
   around one position.
   MUST BE OF THE FORM
   stars = single_func(ra, dec, radius, nstars, verbose=verbose,
   _extra=extra)
   where stars = -1 and nstars = 0 for no matches
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
  verbose : set (1) to print out information
  _extra : passed to single_func
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  nstars : number of stars found (0 if none)
  posindex : index array of length nstars into raArr and decArr
  returns array of star array (-1 is none found)
 COMMON BLOCKS:
  None
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 2005 December, by Leslie Young, SwRI

(See oc/oc_search_multiple.pro)


OC_SEARCH_POS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_pos

 PURPOSE: (one line)
  Search for stars in a catalog by position.

 DESCRIPTION:
  This routine searches around a specified (ra, dec, radius) in a 
  specified star catalog.  It returns a fully-populated star structure
  for each star found.

  This is the main callable external routine for the occultation position
  searching.  It allows for selection of arbitrary catalogs, and it allows
  for ra/dec to be either scalar or vector.

  This routine is a wrapper to routines like oc_search_pos_fullcat,
  oc_search_pos_subcat, etc.

 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  result = oc_search_pos_fullcat(RA, DEC, RADIUS, CATALOG, NSTARS,  $
                            [, /VERBOSE] )

 INPUTS:
  RA      -- Right ascension of center of search position.  Radians, J2000.
              Scalar or vector.
  DEC     -- Declination     of center of search position.  Radians, J2000.
              Scalar or vector.
  RADIUS  -- Search radius.  Radians.   Scalar.
  CATALOG -- Name of the catalog or search routine to use.  This is parsed
    in two steps.  First, a function name is constructed using the name, and 
    this function is called if it exists.
       oc_search_pos_single_CATALOG or    [if RA, DEC are scalars]
       oc_search_pos_multiple_CATALOG     [if RA, DEC are vectors]

    If this fails, then CATALOG is assumed to be a function name itself, and
    is compiled and called directly.
       oc_search_testing_july
    
    If this fails, then execution stops.

 OPTIONAL INPUT PARAMETERS:
  _extra -- Passed on to searching routine.
  
 KEYWORD INPUT PARAMETERS:
  /VERBOSE -- If set, print error messages to screen.

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  result -- Array of structures [nstars], with each element being a 
    fully-populated star structure containing RA, Dec, magnitude, etc.
  NSTARS -- Number of stars found
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  The proper environment variable must be set for the catalog called.
   $TY2_PATH   -- For Tycho-2 catalog
   $WCS_CATDIR -- For HD and other WCS-based catalogs
   $UCAC2_PATH -- For UCAC2 catalog

 EXAMPLE:
 a=oc_search_pos(1,       3,       0.01, 'hd', nstars, /verbose)
 a=oc_search_pos([1,2,5], [3,4,6], 0.01, 'hd', nstars, /verbose)
 a=oc_search_pos([1,2,5], [3,4,6], 0.01,'oc_search_pos_single_hd',nstars,/v)
 
 MODIFICATION HISTORY:
  Written  15-Dec-2005 by Henry Throop, SwRI
  Modified 23-Feb-2006 by HBT. Improved documentation and formatting.

(See oc/oc_search_pos.pro)


OC_SEARCH_POS_FULLCAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_pos_fullcat

 PURPOSE: (one line)
  Search for stars by position, not using pre-computed subcatalog.

 DESCRIPTION:
  This routine searches around a specified (ra, dec, radius) in a 
  specified star catalog.  It returns a fully-populated star structure
  for each star found.

  For text catalogs such as HD, this routine is slow and a subcatalog-type 
  search is likely to be faster.

  This routine is designed to be flexible and allow for new catalogs
  with minimal effort.  Because each catalog has different ID formats, etc.
  it is unlikely that there will be zero effort in adding a new catalog.

 CATEGORY:
  Star catalogs.
  
 CALLING SEQUENCE: 
  result = oc_search_pos_fullcat(RA, DEC, RADIUS, NSTARS,  $
                            CATALOG=catalog [, /VERBOSE] )

 INPUTS:
  RA     -- Right ascension of center of search position.  Radians, J2000.
  DEC    -- Declination     of center of search position.  Radians, J2000.
  RADIUS -- Search radius.  Radians. 

  Inputs are single values, not arrays.

 OPTIONAL INPUT PARAMETERS:
  None

 KEYWORD INPUT PARAMETERS:
  CATALOG= -- Name of the catalog to use; e.g., 'HD', 'TY2', 'UCAC2', '2MASS'
    Defaults to 'HD' if not set.
  /VERBOSE -- If set, print error messages to screen.

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  result -- Array of structures [nstars], with each element being a 
    fully-populated star structure containing RA, Dec, magnitude, etc.
  NSTARS -- Number of stars found
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  The proper environment variable must be set for the catalog called.
   $TY2_PATH   -- For Tycho-2 catalog
   $WCS_CATDIR -- For HD and other WCS-based catalogs
   $UCAC2_PATH -- For UCAC2 catalog
   $TMC_PATH -- For UCAC2 catalog

 EXAMPLE:
  stars = oc_search_pos_fullcat(0.5, 0.5, 0.01, nstars, catalog='hd')
 
 MODIFICATION HISTORY:
  Written  25-Jan-2005 by Henry Throop, SwRI
  Modified 26-Jan-2005 by HBT. Minor changes
  Modified 22-Feb-2005 by HBT. Generalized to work for catalogs beyond HD
  Modified 10-Oct-2005 by HBT. Minor changes to bring into CVS.
  Modified  4-Nov-2005 by HBT. ID's are returned, not structures
  Modified 21-Nov-2005 by HBT. Structures are returned, not ID's.
  Modified  7-Dec-2005 by HBT. Bug and documentation fixes.
  Modified 30-Jan-2006 by HBT. UCAC2 incorporated.
  Modified 23-Feb-2006 by HBT. Improved documentation and formatting.
  Modified 05-Mar-2006 by LAY. Uncomment call to oc_getstar_hd
  Modified 05-Mar-2006 by HBT. Uncomment call to oc_getstar_tyc2
  Modified 15-Mar-2006 by HBT. Changed COUNT -> NSTARS in a few instances.
  Modified 14-Apr-2006 by Leslie Young. Made loop index long.
  Modified 25-Apr-2006 by HBT. 2MASS incorporated.

(See oc/oc_search_pos_fullcat.pro)


OC_SEARCH_POS_MULTIPLE[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_pos_multiple 

 PURPOSE: (one line)
  Return array of star structures around multiple positions

 DESCRIPTION:
  Return array of star structures

 CATEGORY:
  occultation

 CALLING SEQUENCE:
 stars = oc_search_pos_multiple(raArr, decArr, radius, single_fun, $
   nstars, _extra=extra,
   verbose=verbose)

 INPUTS:
  raArr - right ascension (radian)
  decArr - declination (radian)
  radius - search radius (radian) 
  single_fun - string name of search function for stars
   around one position.
   MUST BE OF THE FORM
   stars = single_func(ra, dec, radius, nstars, verbose=verbose,
   _extra=extra)
   where stars = -1 and nstars = 0 for no matches

 OPTIONAL INPUT PARAMETERS:
  none

 KEYWORD INPUT PARAMETERS:
  verbose : set (1) to print out information
  _extra : passed to single_func

 KEYWORD OUTPUT PARAMETERS:
  none

 OUTPUTS:
  nstars : number of stars found (0 if none)
  posindex : index array of length nstars into raArr and decArr
  returns array of star array (-1 is none found)

 COMMON BLOCKS:
  None

 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 2005 December, by Leslie Young, SwRI
  Renamed from oc_search_multiple.pro, HBT, 15-Dec-2005
  Changed looping variable from int to long,LAY 08-Jan-2006
  Return if bad radius array, LAY 23-Apr-2006
  Pass verbose to called function LAY 02-July-2006

(See oc/oc_search_pos_multiple.pro)


OC_SEARCH_POS_MULTIPLE[2]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_pos_multiple 

 PURPOSE: (one line)
  Return array of star structures around multiple positions

 DESCRIPTION:
  Return array of star structures

 CATEGORY:
  occultation

 CALLING SEQUENCE:
 stars = oc_search_pos_multiple(raArr, decArr, radius, nstars, $
   _extra=extra, verbose=verbose)

 INPUTS:
  raArr - right ascension (radian)
  decArr - declination (radian)
  radius - search radius (radian) 

 OPTIONAL INPUT PARAMETERS:
  none

 KEYWORD INPUT PARAMETERS:
  verbose : set (1) to print out information
  _extra : passed to single_func

 KEYWORD OUTPUT PARAMETERS:
  none

 OUTPUTS:
  nstars : number of stars found (0 if none)
  posindex : index array of length nstars into raArr and decArr
  returns array of star array (-1 is none found)

 COMMON BLOCKS:
  None

 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 2005 December, by Leslie Young, SwRI
  Renamed from oc_search_multiple.pro, HBT, 15-Dec-2005
  Changed looping variable from int to long,LAY 08-Jan-2006
  Return if bad radius array, LAY 23-Apr-2006

(See oc/hd/oc_search_pos_multiple_hd.pro)


OC_SEARCH_POS_MULTIPLE[3]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_pos_multiple 

 PURPOSE: (one line)
  Return array of star structures around multiple positions

 DESCRIPTION:
  Return array of star structures

 CATEGORY:
  occultation

 CALLING SEQUENCE:
 stars = oc_search_pos_multiple(raArr, decArr, radius, nstars, $
   _extra=extra, verbose=verbose)

 INPUTS:
  raArr - right ascension (radian)
  decArr - declination (radian)
  radius - search radius (radian) 

 OPTIONAL INPUT PARAMETERS:
  none

 KEYWORD INPUT PARAMETERS:
  verbose : set (1) to print out information
  _extra : passed to single_func

 KEYWORD OUTPUT PARAMETERS:
  none

 OUTPUTS:
  nstars : number of stars found (0 if none)
  posindex : index array of length nstars into raArr and decArr
  returns array of star array (-1 is none found)

 COMMON BLOCKS:
  None

 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 2005 December, by Leslie Young, SwRI
  Renamed from oc_search_multiple.pro, HBT, 15-Dec-2005
  Changed looping variable from int to long,LAY 08-Jan-2006
  Return if bad radius array, LAY 23-Apr-2006

(See oc/tyc2/oc_search_pos_multiple_tyc2.pro)


OC_SEARCH_POS_SINGLE_HD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_pos_single_hd

 PURPOSE: (one line)
  Searches around a given position in the HD catalog.

 DESCRIPTION:
  This routine is a wrapper to oc_search_pos_fullcat/oc_search_pos_subcat .

 CATEGORY:
  Star catalogs

 CALLING SEQUENCE:
  oc_search_pos_single_hd, RA, DEC, RADIUS, NSTARS, 
   METHOD=method, _extra=extra

 INPUTS:
  RA     -- Right ascension of center of search position.  Radians, J2000.
  DEC    -- Declination     of center of search position.  Radians, J2000.
  RADIUS -- Search radius.  Radians. 

  Inputs are single values, not arrays.

 OPTIONAL INPUT PARAMETERS:
  METHOD -- either 'FULLCAT' or 'SUBCAT', for on search method requested.

 KEYWORD INPUT PARAMETERS:
  /VERBOSE -- If set, print diagnostics to screen.
  _extra -- Passed on 

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  result -- Array of structures [nstars], with each element being a 
    fully-populated star structure containing RA, Dec, magnitude, etc.
  NSTARS -- Number of stars found
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  The proper environment variable must be set for the catalog called.
   $WCS_CATDIR/hd -- For HD catalog

 EXAMPLE:
  print, (oc_search_pos_single_hd(0.1, 0.1, 0.01, nstars)).ID
    [Locates three stars]

 MODIFICATION HISTORY:
  Written  10-Oct-2005 by Henry Throop, SwRI
  Modified  9-Dec-2005 by HBT. Improved to handle FULLCAT case.
  Modified 15-Dec-2005 by HBT.  Renamed oc_search_hd_single -> 
    oc_search_pos_single_hd
  Modified 27-Feb-2006 by HBT. Improved documentation and formatting.

(See oc/hd/oc_search_pos_single_hd.pro)


OC_SEARCH_POS_SINGLE_HD_TEST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_pos_single_hd_test

 PURPOSE: (one line)
  Make a call to oc_search_pos_single_hd to test it.

 DESCRIPTION:
  Make a call to oc_search_pos_single_hd to test it.

  Makes a plot of found stars.
 
  Prints results, and prints 'benchmark' results which 
  should be obtained.

 CATEGORY:
  Star catalogs.
  
 CALLING SEQUENCE:
  oc_search_pos_single_hd_teset

 INPUTS:
  None

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  None

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  None
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  None

 EXAMPLE:
  oc_search_pos_single_hd_test
 
 MODIFICATION HISTORY:
  Written  10-Oct-2005 by Henry Throop, SwRI
  Modified 15-Dec-2005 by HBT.  Minor changes
  Modified 27-Feb-2006 by HBT. Improved documentation and formatting.

(See oc/hd/oc_search_pos_single_hd_test.pro)


OC_SEARCH_POS_SINGLE_STARARR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_pos_single_stararr
  
 PURPOSE: (one line)
  Searches around a given position in a stararray

 DESCRIPTION:
  Searches around a given position in a stararray

 CATEGORY:
  Star catalogs

 CALLING SEQUENCE:
  oc_search_pos_single_stararr, RA, DEC, RADIUS, NSTARS, stararr=stararr

 INPUTS:
  RA     -- Right ascension of center of search position.  Radians, J2000.
  DEC    -- Declination     of center of search position.  Radians, J2000.
  RADIUS -- Search radius.  Radians. 

  Inputs are single values, not arrays.

 INPUT KEYWORD PARAMETERS:
  stararr=stararr - the star array to be matched.

 OPTIONAL INPUT PARAMETERS:
  sorted  true is star array is increasing in ra
  verbose 1 for informational outputs. 2 for debugging 

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  result -- Array of structures [nstars], with each element being a 
    fully-populated star structure containing RA, Dec, magnitude,
    etc.
  NSTARS -- Number of stars found
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:

 EXAMPLE:
  print, (oc_search_pos_single_stararr(0.1, 0.1, 0.01, nstars, stararr=ss)).ID

 MODIFICATION HISTORY:
  Written 2006-Mar-19  by Leslie Young, SwRI

(See oc/oc_search_pos_single_stararr.pro)


OC_SEARCH_POS_SINGLE_USNOB10

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_pos_single_usnob10

 PURPOSE: (one line)
  Return array of star structures around a single position

 DESCRIPTION:
  Searches the online USNO-B1.0 catalog and returns array of star structures

 CATEGORY:
  Star catalogs

 CALLING SEQUENCE:
 stars = oc_search_usnob10_single(ra, dec, radius, nstars, _extra=extra,
   verbose=verbose, method = method)

 INPUTS:
  ra - right ascension  (radian)
  dec - declination (radian)
  radius - search radius (radian)

 OPTIONAL INPUT PARAMETERS:
  None

 KEYWORD INPUT PARAMETERS:
  verbose : set (1) to print out information
  method : 'scat' or 'vizier'  

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  nstars : number of stars found (0 if none)
  returns array of star array (-1 is none found)

 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  This version fills in only the minimum star

 EXAMPLE:
  a=oc_search_pos_single_usnob10(0.1, 0.1, 0.01, nstars, /verb)
   [Finds 6016 stars]

 MODIFICATION HISTORY:
  Written 2005 November, by Leslie Young, SwRI
  Renamed 2005 December, HBT, from oc_search_usnob10_single
  Modified 14-Apr-2006 by Leslie Young. Made loop index long.

(See oc/oc_search_pos_single_usnob10.pro)


OC_SEARCH_POS_SUBCAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_pos_subcat

 PURPOSE: (one line)
  Searches for stars by position, using pre-computed subcatalogs.

 DESCRIPTION:
  This routine searches around a specified (ra, dec, radius) in a 
  specified star catalog.  It returns a fully-populated star structure
  for each star found.

  Rather than searching the full catalog, this routine searches subcatalogs
  which break the catalog into small regions of RA/DEC.  For text catalogs
  such as HD, this routine is faster than searching the entire catalog.

  If the subcatalogs do not exist, they are created and saved on-the-fly.
  The first time this routine is called, there is substantial overhead
  in extracting the subcatalogs.  Subsequent searches are much faster.

  This routine currently works only with the HD catalog.  It could
  be set up to work with Tycho-2.

 CATEGORY:
  Star catalogs.
  
 CALLING SEQUENCE: 
  result = oc_search_pos_subcat(RA, DEC, RADIUS, NSTARS,  $
                            CATALOG=catalog [, /VERBOSE] )

 INPUTS:
  RA     -- Right ascension of center of search position.  Radians, J2000.
  DEC    -- Declination     of center of search position.  Radians, J2000.
  RADIUS -- Search radius.  Radians. 

  Inputs are single values, not arrays.

 OPTIONAL INPUT PARAMETERS:
  None

 KEYWORD INPUT PARAMETERS:
  CATALOG= -- Name of the catalog to use; e.g., 'HD'.
    Defaults to 'HD' if not set.
  /VERBOSE -- If set, print diagnostics to screen.

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  result -- Array of structures [nstars], with each element being a 
    fully-populated star structure containing RA, Dec, magnitude, etc.
  NSTARS -- Number of stars found
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  The proper environment variable must be set for the catalog called.
   $WCS_CATDIR -- For HD and other WCS-based catalogs
  The directory $HDOCCUL_TMP must exist and be writeable for the subcatalogs
   to be stored in.  [2006-Mar-05 - obviated.  LAY]
  The temporary directory used by tmpfile (nominally /tmp) should
   exist and be writable for the subcatalogs to be stored in
   [2006-Mar-5 LAY]

 EXAMPLE:
  print,(oc_search_pos_subcat(0.1, 0.1, 0.01, nstars, catalog='hd')).id
    [Locates three stars]
 
 MODIFICATION HISTORY:
  Written  31-Jan-2005 by Henry Throop, SwRI.
  Modified 22-Feb-2005 by HBT. Renamed, and generalized to work with other
                                catalogs.
  Modified  9-Dec-2005 by HBT. Renamed again.
  Modified 27-Feb-2006 by HBT. Improved documentation and formatting.
  Modified 5-Mar-2006 by LAY.  Replaced get_pid with tmpfile
         Replace ip_down with built-in floor
         Uncomment the spawn, command_rm
         Calculate distances of grid centers with rd2ang
  Modified 14-Apr-2006 by Leslie Young. Made loop index long.

(See oc/oc_search_pos_subcat.pro)


OC_SEARCH_USNOB10_SINGLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_usnob10_single
 PURPOSE: (one line)
  Return array of star structures around a single position
 DESCRIPTION:
  Return array of star structures
 CATEGORY:
  occultation
 CALLING SEQUENCE:
 stars = oc_search_usnob10_single(ra, dec, radius, nstars, _extra=extra,
   verbose=verbose, method = method)
 INPUTS:
  ra - right ascension  (radian)
  dec - declination (radian)
  radius - search radius (radian)
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
  verbose : set (1) to print out information
  method : 'scat' or 'vizier'  
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  nstars : number of stars found (0 if none)
  returns array of star array (-1 is none found)
 COMMON BLOCKS:
  None
 SIDE EFFECTS:
 RESTRICTIONS:
  This version fills in only the minimum star
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 2005 November, by Leslie Young, SwRI

(See oc/oc_search_usnob10_single.pro)


OC_SEPMIN_CUB

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  oc_sepmin_cub
  
 PURPOSE: (one line)
  Find minimum separation of a target and a star

 DESCRIPTION:
  Find minimum separation of a target and a star assuming cubic motion

 CATEGORY:
  Occultation
  
 CALLING SEQUENCE:
  sepmin = oc_sepmin_cub(t, x, y, tmin, xmin, ymin)

 INPUTS:
 t = time (array of 2 dates) in units of TIME 
 x = array of 2 offsets in ra, target-star, in units of ANG 
 y = array of 2 offsets in dec, target-star, in units of ANG
 xdot = array of 2 derivatives of x, in units of ANG/TIME
 ydot = array of 2 derivatives of y, in units of ANG/TIME

 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:

 KEYWORD OUTPUT PARAMETERS:
  Extrap : set 1 if this is an extrapolation

 OUTPUTS:
  tmin = time of minimum in units of TIME
  xmin = ra sep at tmin in units of ANG
  ymin = dec sep at tmin in units of ANG
  xdotmin = ra rate at tmin in units of ANG/TIME
  ydotmin = decrate at tmin in units of ANG/TIME
  returns sepmin = minimum separation at tmin in ANG

 If t is in seconds, x and y in radian
 the tmin will be in seconds, xmin and ymin in radian
 and xdotmin, ydotmin in radian/sex.

 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 EXAMPLE:
 PROCEDURE:
   Assume cubic motion matching values and derivatives at endpoints
 MODIFICATION HISTORY:
  Modified 2006 Mar 2 LAY
  2006 July 02 LAY clean up debugging print statements

(See oc/oc_sepmin_cub.pro)


OC_SEPMIN_LIN

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  oc_sepmin_lin
  
 PURPOSE: (one line)
  Find minimum separation of a target and a star

 DESCRIPTION:
  Find minimum separation of a target and a star assuming linear motion

 CATEGORY:
  Occultation
  
 CALLING SEQUENCE:
  sepmin = oc_sepmin_lin(t, x, y, tmin, xmin, ymin)

 INPUTS:
 t = time (array of 2 dates) in units of TIME 
 x = array of 2 offsets in ra, target-star, in units of ANG 
 y = array of 2 offsets in dec, target-star, in units of ANG

 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:

 KEYWORD OUTPUT PARAMETERS:
  Extrap : set 1 if this is an extrapolation

 OUTPUTS:
  tmin = time of minimum in units of TIME
  xmin = ra sep at tmin in units of ANG
  ymin = dec sep at tmin in units of ANG
  xdotmin = ra rate at tmin in units of ANG/TIME
  ydotmin = decrate at tmin in units of ANG/TIME
  returns sepmin = minimum separation at tmin in ANG

 If t is in seconds, x and y in radian
 the tmin will be in seconds, xmin and ymin in radian
 and xdotmin, ydotmin in radian/sex.

 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 EXAMPLE:
 PROCEDURE:
   Assume linear motion
 MODIFICATION HISTORY:
  Modified 2006 Mar 2 LAY

(See oc/oc_sepmin_lin.pro)


OC_SEPMIN_NAIF

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  oc_sepmin_naif
  
 PURPOSE: (one line)
  Find minimum separation of a target and a star

 DESCRIPTION:
  Find minimum separation of a target and a star

 CATEGORY:
  Occultation
  
 CALLING SEQUENCE:
  sepmin = oc_sepmin_naif(et, radec_star, dradec_star, targ, $
	tmin, xmin,ymin,xdotmin,ydotmin, extrap=extrap, $
	obs=obs,abcorr=abcorr,frame=frame,lonlatalt=lonlatalt )

 INPUTS:
  et - approximate time of closest approach (TBD s since J2000)
  star - a star structure
  naif - a naif structure

 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  /VERBOSE -- 
     Verbose = 1 Print error messages to screen 
     Verbos = 2 Print debugging statements 

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  tmin = time of minimum in units of TIME
  xmin = ra sep at tmin in units of ANG
  ymin = dec sep at tmin in units of ANG
  xdotmin = ra rate at tmin in units of ANG/TIME
  ydotmin = decrate at tmin in units of ANG/TIME
  returns sepmin = minimum separation at tmin in ANG
  
  
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 EXAMPLE:
 PROCEDURE:
   If eph has a naif structure, then find event near
    minimum miss distance using naif calls
 MODIFICATION HISTORY:
  Modified 2006 Mar 2 LAY

(See oc/oc_sepmin_naif.pro)


OC_SINGLE_EV

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  oc_single_ev
  
 PURPOSE: (one line)
  Calculate a single event structure

 DESCRIPTION:
  Calculate an occultation event structure

 CATEGORY:
  Occultation
  
 CALLING SEQUENCE:
  ev = oc_single_ev(star, eph, nev, VERBOSE = verbose)

 INPUTS:
  eph - an array of ephemeris structures
    Critical parameters are eph[*].ra and eph[*].dec
    If present, eph[*].radot and eph[*].decdot are used
    If present, eph[*].naif are used
  star - a star structure

 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  /VERBOSE -- 
     Verbose = 1 Print error messages to screen 
     Verbos = 2 Print debugging statements 

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  Returns an ephemeris structure
    et - time of closest approach
    ra_targ - ra of target at closest approach
    dec_targ - ra of target at closest approach
    miss - miss distance in radians
    pa - position angle in radians
    star - star structure
    eph - eph structure (or array)
  
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 EXAMPLE:
 PROCEDURE:
   If eph has a naif structure, then find event near
    minimum miss distance using naif calls
 MODIFICATION HISTORY:
  Modified 2006 Mar 2 LAY

(See oc/oc_single_ev.pro)


OC_STAR_APPLY_PM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   oc_star_apply_pm

 PURPOSE:
   Apply proper motion to a star

 DESCRIPTION:
   Apply proper motion to a star

 CALLING SEQUENCE:
   star_et = oc_star_apply_pm(star, et)

 INPUTS:
   star - star structure or array of structures
   et - ephemeris time (seconds TDB after J2000)

 OPTIONAL INPUT PARAMETERS:
  None

 KEYWORDS:
  None

 OUTPUTS:
  If et is a scalar and star is a single structure then
  return a star structure

  If et is an array and the star is a single structure
  then return [star_0,star_1,...] where star_i is for et[i]

  If et is a scalar and the star is an array of structures
  then return [ star_0, star_1, ... ] where star_i is for star[i]
  
  If both et and the star are arrays
  then return [ star_0, star_1, ... ] where star_i is for et[i], star[i]
  (if they are different lengths, then do up to the minimum)
 
  REVISON HISTORY:
   2006 Mar 08 Leslie Young.  
   2006 Mar 21 Henry Throop.  Modified to return proper ET.

(See oc/oc_star_apply_pm.pro)


OC_STAR_APPLY_PM_TEST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_star_apply_pm_test

 PURPOSE: (one line)
  Test proper motion calculations

 DESCRIPTION:
  Test proper motion calculations

 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  oc_star_apply_pm_test

 INPUTS:
  None

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  VERBOSE -- If set, print diagnostics to screen.

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  None
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  None

 EXAMPLE:
  oc_star_apply_pm_test, /VERBOSE
 
 MODIFICATION HISTORY:
  Written  21-Mar-2006 by H. Throop, SwRI

(See oc/oc_star_apply_pm_test.pro)


OC_STAR_ISEMPTY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_star_isempty

 PURPOSE: (one line)
  Indicates whether a star structure is empty or not.

 DESCRIPTION:
  Indicates whether a star structure is empty or not, based on the contents
  of numerous fields  within it.

  We make an educated guess as to whether the star is  empty or not, based
  on the number of fields that are 0, -999, 'none', or ''.  We could be
  wrong, but it's unlikely.  There is not a single field that indicates
  an empty star; we require all examined fields to be empty.

  This routine works for *stars*.  It does not work for, e.g., matching
  catalogs such as tyc2_hd.
  
 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  result = is_empty(star)

 INPUTS:
  star -- Star structure(s).  Either scalar or vector.

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  None

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  Boolean flag, 1 or 0.  Returned value is a double rather than an int,
  because IDL's not() function can return nonintuitive results on ints.

  Output is a scalar or vector, with one element for each element of input.
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  None

 EXAMPLE:
  print, oc_star_isempty(oc_getstar_ucac2(['1.0', '1.1']))
    Returns "1.0 0.0" because first ID is invalid.
 
 MODIFICATION HISTORY:
  Written   7-Dec-2005 by Henry Throop, SwRI
  Modified 27-Feb-2006 by HBT. Improved documentation and formatting.
  Modified 14-Apr-2006 by Leslie Young. Made loop index long.

(See oc/oc_star_isempty.pro)


OC_STAR_NEW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   oc_star_new

 PURPOSE:
   Returns an empty star structure

 DESCRIPTION:
   Returns an empty star structure

 CALLING SEQUENCE:
   star = oc_star_new()

 INPUTS:
   none
 KEYWORDS
 OUTPUTS:
   star - returns a star structures
    idcat  - catalog for id.  String or array of length nstar. Default 'none' 
    id     - id.  String or array of length nstar. Default 'none' 
    poscat - catalog for ra, dec, raerr, decerr, radot, decdot,
            radoterr, decdoterr.  String or array of length nstar. 
            Default 'none' 
    ra - J2000 right ascension in radians (scalar or array)
    dec - J2000 declination in radians (scalar or array)
    raerr  - error in ra * cos(dec).  Radians. Scalar or array of
            length nstar.  Default -999
    decerr - error in dec.  Radians. Scalar or array of
            length nstar.  Default -999
    radot -  proper motion in ra*cos(dec), radian/s.  Scalar or array
           of length nstar.  Default -999
    decdot -  proper motion in dec, radian/s.  Scalar or array
           of length nstar.  Default -999
    radoterr - error in radot.  Radian/s. Scalar or array of length
              nstar. Default -999.
    decdoterr - error in decdot.  Radian/s. Scalar or array of length
              nstar. Default -999.
    magcat - catalog for magname, mag, magerr.  String.  Scalar or array
            of length nmag. Default 'none'
    magname - name (eg filter) for mag, magerr.  String.  Array
            of length nmag. Default 'none'
    mag     - magnitudes.  Array of size [nstar, nmag]. Default -999.
    magerr  - error in mag.  Array of size [nstar, nmag]. Default -999.
    SpTcat  - catalog for SpT.  String or array of length
             nstar. Default 'non' 
    SpT     - spectral type. String or array of length nstar.  Default ''  
    notecat - catalogs for notes. String or array of length
             nstar. Default 'none'
    note    - Notes.  String or array of length
             nstar. Default ''

 REVISON HISTORY:
   2005 Dec 31 Leslie A Young, SwRI 
   2006 Mar 12 LAY Added etpm, ra_etpm, dec_etpm, raerr_etpm, decerr_etpm

(See oc/oc_star_new.pro)


OC_STAR_RADEC.PRO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   oc_star_radec.pro

 PURPOSE:
   returns [ra, dec] for a star at a given et

 DESCRIPTION:
   returns [ra, dec] for a star at a given et

 CALLING SEQUENCE:
   [ra,dec] = oc_star_radec(et,star, dradec, radecerr)

 INPUTS:
   et - ephemeris time (seconds TDB after J2000)
   star - star structure or array of structures
 OPTIONAL INPUT PARAMETERS:

 KEYWORDS
 OUTPUTS:
  If et is a scalar and star is a single structure then
  return [ra, dec].

  If et is an array and the star is a single structure
  then return [ radec_0, radec_1, ... ] where radec_i is for et[i]

  If et is a scalar and the star is an array of structures
  then return [ radec_0, radec_1, ... ] where radec_i is for star[i]
  
  If both et and the star are arrays
  then return [ radec_0, radec_1, ... ] where radec_i is for et[i], star[i]
  (if they are different lengths, then do up to the minimum)
 
  dradec is the derivatives of cos(dec) ra and dec w/ respect to time
  (radian/sec).  Note: cos(dec) d ra/dt, not dra/dt.

  REVISON HISTORY:
   2006 Jan 02 Leslie Young.  
   2006 Mar 08 LAY.  Corrected docs on dradec, added 2-element et,
                     added array of radecerr.

(See oc/oc_star_radec.pro)


OC_STAR_SET_EMPTY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_star_set_empty

 PURPOSE: (one line)
  Sets a star structure(s) to be empty (i.e., invalid).

 DESCRIPTION:
  Sets a star structure(s) to be empty (i.e., invalid).

 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  empty = oc_star_set_empty(stars)

 INPUTS:
  stars -- Star or array of stars to be set empty.

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  None

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  Returns the newly-emptied stars.
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  None

 EXAMPLE:
  print, oc_star_isempty(oc_star_set_empty(oc_getstar_hd('100')))
     [Prints 1, to indicate that star is empty]
 
 MODIFICATION HISTORY:
  Written   7-Dec-2005 by Henry Throop, SwRI
  Modified 28-Feb-2006 by HBT.  Improved documentation and formatting.
                                Renamed oc_star_set_invalid -> 
                                        oc_star_set_empty.
  Modified 14-Apr-2006 by Leslie Young. Made loop index long.

(See oc/oc_star_set_empty.pro)


OC_TEST_HD_TYC2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_test_hd_tyc2

 PURPOSE: (one line)
  Test to validate that HD -> TYC2 ID's can be properly matched.

 DESCRIPTION:
  Tests end-to-end HD search and matching to TYC2.  Makes a plot
  showing positions of HD and TYC2 stars.  This is a very
  extensive test, which validates many many routines.

  Program oc_test_tyc2_hd tests this in the opposite direction.

 CATEGORY:
  Star catalogs.
  
 CALLING SEQUENCE:
  oc_test_hd_tyc2

 INPUTS:
  None

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  None

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  None

 EXAMPLE:
  oc_test_hd_tyc2
 
 MODIFICATION HISTORY:
  Written   4-Nov-2005 by Henry Throop, SwRI
  Modified 15-Dec-2005 by HBT. Minor changes.
  Modified 23-Feb-2006 by HBT. Improved documentation and formatting.

(See oc/tyc2_hd/oc_test_hd_tyc2.pro)


OC_TEST_TYC2_HD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_test_tyc2_hd

 PURPOSE: (one line)
  Test end-to-end TYC2 search and cross-matching with HD.

 DESCRIPTION:
  Makes plot showing positions of HD and TYC2 stars.

  Takes several minutes to run.

 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  oc_test_tyc2_hd

 INPUTS:
  None

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  None

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  None

 EXAMPLE:
  oc_test_tyc2_hd
 
 MODIFICATION HISTORY:
  Written  30-Nov-2005 by Henry Throop, SwRI.  Based on oc_test_hd_tyc2, 
                                which is the same in opposite direction.
  Modified  7-Dec-2005 by HBT.  Minor changes.
  Modified 23-Feb-2006 by HBT.  Improved documentation and formatting.

(See oc/tyc2_hd/oc_test_tyc2_hd.pro)


OC_TYC2_HD_TEST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_tyc2_hd_test

 PURPOSE: (one line)
  Test end-to-end TYC2 search and cross-matching with HD.

 DESCRIPTION:
  Makes plot showing positions of HD and TYC2 stars.

  Takes several minutes to run.

 CATEGORY:
  Star catalogs
  
 CALLING SEQUENCE:
  oc_tyc2_hd_test

 INPUTS:
  None

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  None

 KEYWORD OUTPUT PARAMETERS:
  None

 OUTPUTS:
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  None

 EXAMPLE:
  oc_tyc2_hd_test
 
 MODIFICATION HISTORY:
  Written  30-Nov-2005 by Henry Throop, SwRI.  Based on oc_test_hd_tyc2, 
                                which is the same in opposite direction.
  Modified  7-Dec-2005 by HBT.  Minor changes.
  Modified 23-Feb-2006 by HBT.  Improved documentation and formatting.
  Modified 24-Mar-2006 by HBT.  Renamed oc_test_tyc2_hd -> oc_tyc2_hd_test.

(See oc/tyc2_hd/oc_tyc2_hd_test.pro)


OC_WHICH_UNIQEV

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_which_uniqev
 PURPOSE: (one line)
  find the unique events from a list of matching stars and positions
 DESCRIPTION:
 given a list of indexes and a list of values 
 return indices g s.t. j[g] has the smallest distance
 for a run of contiguous j's (one per group of contiguous j's)
 CATEGORY:
  occultation
 CALLING SEQUENCE:
   gmin = whereimcontig(i, d, ng)
 INPUTS:
  j - list of indices
  d - list of values
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  ng : number of contiguous runs of j
  returns array indices into the minimum value of d within
   each contiguous run.  This array has ng elements.  
 COMMON BLOCKS:
  None
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 2005 January, by Leslie Young, SwRI

(See oc/oc_which_uniqev.pro)


OC_X2F_ROTMAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_x2f_rotmat
 PURPOSE: (one line)
  Return the matrix for rotating XYZ to FGH 
 DESCRIPTION:
  Return the matrix for rotating XYZ to FGH 
 CATEGORY:
  Occultations
 CALLING SEQUENCE:
  R = oc_x2f_rotmat(ra, dec)
 INPUTS:
  ra - right ascension of occultation star in radians
  dec - declination of occultation star in radians
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
  none
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  R - rotation matrix for rotating an XYZ vector to FGH
    XYZ are defined in the usual manner
     X = cos(ra_s) cos(dec_s)
     Y = sin(ra_s) cos(dec_s)
     Z =     sin(dec_s)

   FGH are defined as in Elliot et al. 1993. Astron. J. 106, 2544-2572
     H is toward the occultation star
     F is perpendicular to H and Z (Z x H)
     G completes the right hand system
 COMMON BLOCKS:
  None
 SIDE EFFECTS:
 RESTRICTIONS:
  None
 PROCEDURE:
  The function returns the matrix
           -sin(ra)               cos(ra)           0
       -cos(ra) sin(dec)  -sin(ra) sin(dec)  cos(dec)
        cos(ra) cos(dec)   sin(ra) cos(dec)  sin(dec)      
  
 USE:
  The matrix is defined so that
       fgh = R ## xyz     ; fgh, xyz column vectors
  where fgh and xyz are column vectors (Array[1,3]) and ## is the
  IDL operator for ordinary matrix multiplication (inner product).
  It is usually more convenient to use xyz and fgh as row vectors
  (Array[3]).  In this case we have
       fgh = transpose(R) # xyz     ; fgh, xyz row vectors

 MODIFICATION HISTORY:
  2005 Aug 19 Leslie A Young SwRI
  2005 Dec 28, LAY.  
    Added documentation, added function to $layoung/oc/. 

(See oc/oc_x2f_rotmat.pro)


SPLIT_CONTIG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  split_contig
 PURPOSE: (one line)
  identify runs of contiguous indices 
 DESCRIPTION:
 given a list of indexes, find the number of runs of contiguous 
 indices, the starting index, and the length of the run
 CATEGORY:
  occultation
 CALLING SEQUENCE:
       g0 = split_contig(j, glen, ng)
 INPUTS:
  j - list of indices
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  glen: length of each run
  ng : number of contiguous runs of j
  returns array indices into the first of each run.  
    This array has ng elements.  
 COMMON BLOCKS:
  None
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 2005 January, by Leslie Young, SwRI

(See oc/split_contig.pro)


WHEREMINCONTIG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  wheremincontig
 PURPOSE: (one line)
  find minimum value within runs of contiguous indices 
 DESCRIPTION:
 given a list of indexes and a list of values 
 return indices g s.t. j[g] has the smallest distance
 for a run of contiguous j's (one per group of contiguous j's)
 CATEGORY:
  occultation
 CALLING SEQUENCE:
   gmin = whereimcontig(i, d, ng)
 INPUTS:
  j - list of indices
  d - list of values
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  ng : number of contiguous runs of j
  returns array indices into the minimum value of d within
   each contiguous run.  This array has ng elements.  
 COMMON BLOCKS:
  None
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 2005 January, by Leslie Young, SwRI

(See oc/wheremincontig.pro)


WORLDBOOK_MAPSET

[Previous Routine] [List of Routines]
 NAME:
   worldbook_mapset

 PURPOSE:
   Mapping over the CIA worldbook maps

 DESCRIPTION:
   Set up for mapping over the CIA worldbook maps

 CALLING SEQUENCE:
   worldbook_mapset, map, _extra

 INPUTS:
   map - name of a map in ~/reference/maps/Earth/cia_factbook2004
 KEYWORDS
   dir - alternate directory
   _extra - passes things on to map_set
 OUTPUTS:
   None
 REVISON HISTORY:
   2005 Dec 31 Leslie A Young, SwRI 

(See oc/worldbook_mapset.pro)