/usr/share/gnudatalanguage/astrolib/altaz2hadec.pro is in gdl-astrolib 2018.02.16+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | PRO altaz2hadec, alt, az, lat, ha, dec
;+
; NAME:
; ALTAZ2HADEC
; PURPOSE:
; Convert Horizon (Alt-Az) coordinates to Hour Angle and Declination.
; EXPLANATION::
; Can deal with the NCP singularity. Intended mainly to be used by
; program hor2eq.pro
; CALLING SEQUENCE:
; ALTAZ2HADEC, alt, az, lat, ha, dec
;
; INPUTS
; alt - the local apparent altitude, in DEGREES, scalar or vector
; az - the local apparent azimuth, in DEGREES, scalar or vector,
; measured EAST of NORTH!!! If you have measured azimuth west-of-south
; (like the book MEEUS does), convert it to east of north via:
; az = (az + 180) mod 360
;
; lat - the local geodetic latitude, in DEGREES, scalar or vector.
;
; OUTPUTS
; ha - the local apparent hour angle, in DEGREES. The hour angle is the
; time that right ascension of 0 hours crosses the local meridian.
; It is unambiguously defined.
; dec - the local apparent declination, in DEGREES.
;
; EXAMPLE:
; Arcturus is observed at an apparent altitude of 59d,05m,10s and an
; azimuth (measured east of north) of 133d,18m,29s while at the
; latitude of +43.07833 degrees.
; What are the local hour angle and declination of this object?
;
; IDL> altaz2hadec, ten(59,05,10), ten(133,18,29), 43.07833, ha, dec
; ===> Hour angle ha = 336.683 degrees
; Declination, dec = 19.1824 degrees
;
; The widely available XEPHEM code gets:
; Hour Angle = 336.683
; Declination = 19.1824
;
; REVISION HISTORY:
; Written Chris O'Dell Univ. of Wisconsin-Madison May 2002
;-
if N_params() LT 4 then begin
print,'Syntax - ALTAZ2HADEC, alt, az, lat, ha, dec'
return
endif
d2r = !dpi/180.0d
alt_r = alt*d2r
az_r = az*d2r
lat_r = lat*d2r
;******************************************************************************
; find local HOUR ANGLE (in degrees, from 0. to 360.)
ha = atan( -sin(az_r)*cos(alt_r), $
-cos(az_r)*sin(lat_r)*cos(alt_r)+sin(alt_r)*cos(lat_r))
ha = ha / d2r
w = where(ha LT 0.)
if w[0] ne -1 then ha[w] = ha[w] + 360.
ha = ha mod 360.
; Find declination (positive if north of Celestial Equator, negative if south)
sindec = sin(lat_r)*sin(alt_r) + cos(lat_r)*cos(alt_r)*cos(az_r)
dec = asin(sindec)/d2r ; convert dec to degrees
END
|