NAME:
  obswind
 PURPOSE:
  Compute possible observing window for a celestial object.
 DESCRIPTION:

 This routines determines the possible observing window for an object.
 The times of sunrise and sunset are left as input parameters to help
 speed up the computations.  It is expected that this routine will be called
 many times for a given date (LST0), but for different objects.
 RTIME and STIME denote the earliest time and the latest time that the object
 can be observed.  Note that if RTIME > STIME then the range passes through
 0 hours.  RKIND and SKIND tell what limits the ends of the window as follows:
        RKIND  will be either 'sunset' or 'rises' for TYPE = 0
        RKIND  will be 'sunset' for TYPE =  1
        RKIND  is undefined for TYPE = -1
        SKIND  will be either 'sunrise' or 'sets' for TYPE = 0
        SKIND  will be 'sunrise' for TYPE = 1
        SKIND  is undefined for TYPE = -1
        if TYPE = 2 then object is not available when sun is down.

 CATEGORY:
  Astronomy

 CALLING SEQUENCE:
  obswind,lst0,lat,ra,dec,srise,sset,rtime,rkind,stime,skind,type
 INPUTS:
  lst0  - Local Sidereal Time at local midnight (radians).
  lat   - Latitude of observatory (radians).
  ra    - right ascension of object (radians), should be of date.
  dec   - declination of object (radans), should be of date.
  srise - Time of sunrise (JD).
  sset  - Time of sunset (JD).
  
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  AMLIMIT - Air Mass limit to denote rise and set of object.  Default=3.0

 OUTPUTS:
  rtime - Time of opening of observing window (at rise or sunset)
  rkind - String that identifies limit, either 'sunset' or 'rises'
  stime - Time of closing of observing window (at rise or sunset)
  skind - String that identifies limit, either 'sunset' or 'rises'
  type  - Indicator of type of window
           2 - Object not available when sun is down.
           1 - Object always up.
           0 - Object rises and sets.
          -1 - Object always down.

 KEYWORD OUTPUT PARAMETERS:
  JDTRANS - JD of object transit

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  1997/9/3, Written by Marc W. Buie, Lowell Observatory
  2002/03/27, MWB, fixed AMLIMIT bug.
  2012/01/28, MWB, validation changed to enforce only scalar input
  2018/05/23, MWB, added JDTRANS output keyword