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 Aug 18 15:38:05 2015.


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)


OC_AAREADME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   oc_AAREADME
 PURPOSE
   Print the file 'oc_AAREADME.pro'
 CATEGORY:
  Occultation searching and star catalog reading (oc)
 CALLING SEQUENCE:
  oc_AAREADME
 
 ---------------------------------------------------------------------------
 FILES AND ENVIRONMENT VARIABLES
 ---------------------------------------------------------------------------
 
 
 $WCS_CATDIR  : directory with stellar catalogs
   |
   |- hd      : Henry Draper Catalog directory
       |
       |- catalog.dat : HD catalog 
       |      (from Vizier  http://vizier.u-strasbg.fr/ftp/cats/III/135A
       |       edited to replace '.' with ' 'in mags for  stars 37030 and 37023
       |
       |- catalog.dat.lookup : file with starting location and lengths of HD lines
       |
       |- catalog.wcs.dat : HD catalog in format for WCS tools (eg scat)
    

   $SAO_PATH : Smithsonian Astrophysical Observatory catalog
       |
       |- sao.dat : SAO catalog (from Vizier)
       |
       |- saora : RA-sorted SAO catalog in format for WCS tools (eg scat)

   $UCAC2_PATH : UCAC2 catalog
       |
       |- u2
           |
           |- u2index.txt
           |
           |- z001 ... z288

   $TY2_PATH : Tycho2 catalog
       |
       |- data
           |
           |- catalog.dat : Tycho2 catalog

 ---------------------------------------------------------------------------
 FUNCTIONS
 ---------------------------------------------------------------------------
 
 SEARCH CATALOGS
 oc_getline[_hd, _sao, _tyc2, _ucac2] 
   return catalog lines by id
 oc_getstar[_hd, _sao, _tyc2, _ucac2] 
   return star structures by id
 oc_search_pos_single[_hd, _sao, _tyc2, _ucac2] 
   return star structures near one position
 oc_search_pos_multiple
 oc_search_eph

 EVENT
 oc_x2f_rotmat - Return the matrix for rotating XYZ to FGH (should be naif?)

 UTILITY FUNCTIONS (NOT CALLED BY USER)
 oc_star_isempty : Indicates whether a star structure is empty or not
 oc_scat : search catalogs using scat, returning ids
 oc_star_set_empty : Sets a star structure(s) to be empty (i.e., invalid)
 oc_which_uniqev

 ---------------------------------------------------------------------------
 VARIABLES
 ---------------------------------------------------------------------------
 
 

 dec
 declination, Equinox J2000
 radians
 
 id
 star id, unique within a catalog
 string, scalar

 ids
 star ids, unique within a catalog
 string, scalar or array

 nstars
 counter - number of stars returned by a getline routine
 long

 ra
 right ascension, Equinox J2000
 radians
 
 radius
 search radius
 radians

 stars

 mk_html_help,['.','hd','sao','tyc2','tyc2_hd','ucac2'],'oc.html'
 ---------------------------------------------------------------------------

(See ../oc/oc_AAREADME.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_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 ncat. Default 'none' 
   idval  - id.  String or array of length [ncat,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
   2009 Sep 6 LAY 
        change keyword_set(_raerr_etpm) to keyword_set(raerr_etpm)
        (and the same for _decerr_etpm)

(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_NAIF_GLOBE

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  oc_naif_globe
  
 PURPOSE: (one line)
  Find info for drawing globes for events (ev) with naif info

 DESCRIPTION:
  Find info for drawing globes for events (ev) with naif info

 CATEGORY:
  Occultation
  
 CALLING SEQUENCE:
  globe = oc_naif_globe(ev, nglobe)

 INPUTS:
  ev - event structure

 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 KEYWORD OUTPUT PARAMETERS:
 OUTPUTS:
  Returns a globe structre
  
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 EXAMPLE:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 2006 July 3 LAY
  2007 Apr 25 - changed ev.eph.naif.targetcode to e.eph.naif.targetcode

(See ../oc/oc_naif_globe.pro)


OC_PLOTGLOBE.PRO

[Previous Routine] [Next Routine] [List of Routines]
       NAME:
               oc_plotglobe.Pro

       PURPOSE:
		Make a globe of the Earth for an occultation

	DESCRIPTION:
		Constructs a globe as seen from the occulting body at the time of the 
		occultation.  Also, includes shadow where the sun is below a specified number
		of degrees below the horizon.

       CALLING SEQUENCE:
              oc_plotglobe, ev, globe, sunAng=sunang

 INPUTS:
		body   - string with the occultation body name: "Pluto"
		utc    - utc string giving the time of the occultation, string
       sunAng - the angle of the sun relative to the horizon for the shadow, deg
       missDist    - the closest approach distance of the occultation, arcsec
       paDeg    - the position angle at the closest approach distance, deg
		radius  - the radius of the occulting body, km

       OUTPUTS:

       REVISON HISTORY:
       05-April-05 CBO SwRI

(See ../oc/oc_plotglobe.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 [, /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. 
  NAME_CATALOG -- string.  Name of the catalog (as expected by scat)
                   act, gsc, ua2, usa2, or local file

  Inputs are single values, not arrays.

 OPTIONAL INPUT PARAMETERS:
  None

 KEYWORD INPUT PARAMETERS:
  /VERBOSE -- If set, print error messages to screen.

 OUTPUTS:
  ids -- Array of star ids found by scat (strings)
  NSTARS -- Number of stars found
  
 KEYWORD OUTPUT PARAMETERS:
  command -- the command called by spawn (string)
  scat -- the lines returned by scat (array of strings)
  

 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 RESTRICTIONS:
  
  This calls scat using spawn. Therefore, this 
  (1) only runs on unix operating systems and
  (2) must have scat installed.  
     http://tdc-www.harvard.edu/software/wcstools/index.html
  (3) 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 2MASS catalog
     This can be done prior to the call with (eg)
     setenv,'TY2_PATH=/Users/layoung/reference/stellar_cat/TYCHO2'

 EXAMPLE:
  print, getenv('WCS_CATDIR')
  ids = oc_scat(0.5, 0.5, 0.01, 'hd/catalog.wcs.dat', nstars)
  help, ids, nstars
  print, ids
  
 
 MODIFICATION HISTORY:
  Written  02-Jul-2006 by Leslie Young, SwRI, based on oc_search_pos_fullcat

(See ../oc/oc_scat.pro)


OC_SEARCH_DENIS_SINGLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_search_denis_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_denis_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_denis_single.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 if 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. 
 EXAMPLE:
 miss = 1/206265.
 eph = oc_ephicy_arclen('Pluto', 'Earth', $
  '2007 Mar 18 00:00', '2007 Mar 19 00:00', 2*miss, neph)
 raArr = eph.ra
 decArr = eph.dec
 single_func = 'oc_search_pos_single_ucac2'
 stars = oc_search_eph(eph, sqrt(2)*miss, single_func, $
                           nstars, posindex, verbose=1)
 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

[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_TEST

[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_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.
  FAST= -- If set, perform a fast search which returns limited stellar
    information, not as complete as full catalog search.
  /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')
  stars = oc_search_pos_fullcat(0.5, 0.5, 0.01, nstars, catalog='tyc2')
 
 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.
  Modified 24-Oct-2006 by HBT. Speed improvement in string handling.

(See ../oc/oc_search_pos_fullcat.pro)


OC_SEARCH_POS_MULTIPLE

[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:
 EXAMPLE:
 miss = 1/206265.
 eph = oc_ephicy_arclen('Pluto', 'Earth', $
  '2007 Mar 18 00:00', '2007 Mar 19 00:00', 2*miss, neph)
 raArr = eph.ra
 decArr = eph.dec
 single_func = 'oc_search_pos_single_ucac2'
 stars = oc_search_pos_multiple(raArr, decArr, sqrt(2)*miss, single_func, $
                           nstars, posindex, verbose=1)
 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_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
  2007 May 4 LAY. Use obs in final call to single_eph

(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_T2X_ROTMAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_t2x_rotmat
 PURPOSE: (one line)
  Return the matrix for rotating target coords to XYZ
 DESCRIPTION:
  Return the matrix for rotating target coords to XYZ
 CATEGORY:
  Occultations
 CALLING SEQUENCE:
  R = oc_t2x_rotmat(targ, et)
 INPUTS:
  targ = target (string or id)
  et = ephemeris time (TDB seconds after J2000)
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
  none
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  R - rotation matrix for rotating an vector xyz in target's
      coordinate system to XYZ
   xyz are defined in terms of the targets pole and central meridian
     unit vector  is on the equator at zero longitude
     unit vector  is on the equator at 90 deg longitude
     unit vector  is toward the North pole, 

    XYZ are the J2000 rectangular coordinates
     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:

  Call CSPICE_CIDFRM to get the frame name and 
  CSPICE_PXFORM for the matrix
  
 USE:
  The matrix is defined so that
       XYZ_j2000 = R ## xyz_targ     ; xyz_targ, XYZ_j2000 column vectors
  where XYZ_j2000 and xyz_targ 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_targ and XYZ_j2000 as row vectors
  (Array[3]).  In this case we have
       XYZ_j2000 = transpose(R) # xyz_targ     ; XYZ_j2000, xyz_targ row vectors

 MODIFICATION HISTORY:
  2005 Dec 29 Leslie A Young SwRI

(See ../oc/oc_t2x_rotmat.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:
  iuniq = oc_which_uniqev(ra, dec, posindex, stars, nstars, nuniq)
 INPUTS:
  ra - array of right ascention of ephemeris points (radians)
  dec - array of declination of ephemeris points (radians)
    ra and dec are implicitly assumed to be in chronological order
  posindex - array nstars long of index into ra and dec
    stars[i] is near ra[posindex[i]], dec[posindex[i]]
  stars - list of stars near ra, dec points
  nstars - number of stars
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  nuniq - number of unique stars near ra, dec
  iuniq - indices of unique stars
 COMMON BLOCKS:
  None
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
  A single star can be near more than one ra, dec.  If the ra, dec
  are continuous, then this is a single event, and the index is the
  index of minimum separation.  Discontinuous runs of ra, dec are
  treated as different events.
 MODIFICATION HISTORY:
  Written 2005 January, by Leslie Young, SwRI

(See ../oc/oc_which_uniqev.pro)


OC_WRITE_LC_FGNOM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_write_lc_fgnom
 PURPOSE: (one line)
  Write a lightcurve fits table
 CATEGORY:
  Occultation
 CALLING SEQUENCE:
  oclc_write_fgnom, target, date_obs, sec_mid, lc, rastr, decstr, latstr, lonstr, site_name
 INPUTS:
  target - string, used to look up NAIF id
  date_obs - string in FITS header format, YYYY-MM-DD
  sec_mid - seconds since 00:00 UTC on data_obs, of the midtime of the bin
  lc - lightcurve, normalized 0 for no star to 1 for complete star
    lc and sec_mid are both N elements long
  rastr = RA string, 'hh:mm:ss.ss'
  decstr = Declination string, 'dd:mm:ss.sss'
  latstr - Latitude string, referenced to WGS-84
  lonstr - Longitude string, referenced to WGS-84
  site_name - string. Also used for file name
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
  kernel - string. Name of kernel to load.
  lc_err - error in lc (N elements)
  lc_ref - string.  reference for the lightcurve
  flux - original flux, Pluto + star, in DN or other "natural"
         units. N elements long
  flux_err - error in the lightcurvce
  flux_ref - reference for the flux
  qualflag - quality flag. N elements long.  0 = good.  Any other = bad
  qualhist - Array of strings.  HISTORY comments explaining qual
  itime - integration time of each bin, sec. N elements long
  time_ref - reference for the time of each bin
  alt - altitude (km)
  site_ref - string. reference for lat, lon, alt
  site_label - string. Label in plots, etc.
  observer - observers (string)
  instrument - instruemtn (string)
  wavelen - wavelength (micron)
  outdir - string, ending '/'.  directory for output (default = '').
  version - file version number
 SIDE EFFECTS:
  writes 
 RESTRICTIONS:
  None
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 2000 October, by Leslie Young, SwRI
  Nov 2000.  Allow non-scalar argument, LAY

(See ../oc/oc_write_lc_fgnom.pro)


OC_X2FP_ROTMAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_x2fp_rotmat
 PURPOSE: (one line)
  Return the matrix for rotating XYZ to F'G'H 
 DESCRIPTION:
  Return the matrix for rotating XYZ to F'G'H 
 CATEGORY:
  Occultations
 CALLING SEQUENCE:
  R = oc_x2fp_rotmat(rec6)
 INPUTS:
  rec6 - 6-element rectangular position & velocity vector
   0:2   R = [X,Y,Z], defined in the usual manner
     X = cos(ra_s) cos(dec_s)
     Y = sin(ra_s) cos(dec_s)
     Z =     sin(dec_s)
   3:5   V = [dX/dt, dY/dt, dZ/dt]
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
  none
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  R - rotation matrix for rotating an XYZ vector to F'G'H
    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

     F' and G' are a rotated version of F and G, so that
     F' is the projection of the velocity vector onto the sky plane
     G' is the orbit normal, R x V
 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_x2fp_rotmat.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)


OC_X2T_ROTMAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  oc_x2t_rotmat
 PURPOSE: (one line)
  Return the matrix for rotating J2000 XYZ to target coords
 DESCRIPTION:
  Return the matrix for rotating J2000 XYZ to target coords
 CATEGORY:
  Occultations
 CALLING SEQUENCE:
  R = oc_x2t_rotmat(targ, et)
 INPUTS:
  targ = target (string or id)
  et = ephemeris time (TDB seconds after J2000)
 OPTIONAL INPUT PARAMETERS:
  none
 KEYWORD INPUT PARAMETERS:
  none
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  R - rotation matrix for rotating an vector 
      XYZ in J2000 coordinates to
      xyz in target's coordinate system 

    XYZ are the J2000 rectangular coordinates
     X = cos(ra_s) cos(dec_s)
     Y = sin(ra_s) cos(dec_s)
     Z =     sin(dec_s)

   xyz are defined in terms of the targets pole and central meridian
     unit vector  is on the equator at zero longitude
     unit vector  is on the equator at 90 deg longitude
     unit vector  is toward the North pole, 

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


  Since r is a rotation matrix, the inverse equals the transpose,
  and we simply call oc_x2t_rotmat
  
 USE:
  The matrix is defined so that
       xyz_targ = R ## XYZ_j2000     ; XYZ_j2000, xyz_targ column vectors
  where xyz_targ and XYZ_j2000 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_j2000 and xyz_targ as row vectors
  (Array[3]).  In this case we have
       xyz_targ = transpose(R) # XYZ_j2000     ; xyz_targ, XYZ_j2000 row vectors

 MODIFICATION HISTORY:
  2007 Sep 12 Leslie A Young SwRI

(See ../oc/oc_x2t_rotmat.pro)


REFRACTIVITY

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  refractivity
 PURPOSE: 
  return the refractivity, give the number density of constituents
 DESCRIPTION:
  Using Allen's Astrophysical Quantities (AQ) 4th Ed.
  Arther Cox, editor, p. 100
 CATEGORY:
  Occultation analysis
 CALLING SEQUENCE:
  nu = refractivity(lam, n_array)

 INPUTS:
  lam - wavelength in micron
  n_array = list of number densities for
 H2, He, Ar, N2, CH4, CO, O2, CO2, NH3

 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  nu   - refractivity = n-1 (unitless)
  
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  01/11/26 - Written by Leslie A. Young, Southwest Research Institute

(See ../oc/refractivity.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)