Viewing contents of file '../idllib/ghrs/pro/astro.pro'
pro astro,selection ;Interactive astronomical utility
;+
; NAME:
; ASTRO
; PURPOSE:
; Interactive astronomical utitlity for precession and coordinate
; conversion.
; CALLING SEQUENCE:
; ASTRO,[SELECTION]
; OPTIONAL INPUT:
; SELECTION - Integer (0-6) giving the the particular astronomical
; utility to be used. (0) Precession, (1) RA, Dec to Galactic
; coordinates, (2) Galactic to RA,Dec (3) RA,Dec to Ecliptic,
; (4) Ecliptic to RA, Dec, (5) Ecliptic to Galactic, (6) Galactic
; to Ecliptic. Program will prompt for SELECTION if this parameter
; is omitted.
; METHOD:
; ASTRO uses PRECESS to compute precession, and EULER to compute
; coordinate conversions.
; REVISION HISTORY
; Written, W. Landsman November 1987
;-
output_type = [0,2,1,2,1,2,2] ;Data type (0) RA,DEC (1) HR,MIN,SEC
input_type = [0,0,2,0,2,2,2] ; (2) LONG,LAT
sv_quiet = !quiet & !quiet = 1 ;Don't display compiled procedures
yeari = 1950 & yearf = 1950 ;Default equinox values except for Precession
select=['(0) Precession: (RA, Dec) ', $
'(1) Conversion: (RA, Dec 1950) to Galactic', $
'(2) Conversion: Galactic to (RA, Dec 1950)', $
'(3) Conversion: (RA, Dec 1950) to Ecliptic', $
'(4) Conversion: Ecliptic to (RA, Dec 1950)', $
'(5) Conversion: Ecliptic to Galactic ', $
'(6) Conversion: Galactic to Ecliptic ']
npar = n_params(0)
selector: if npar eq 0 then begin
print,'Select astronomical utility'
for i=0,6 do print,select(i)
read,'Utility Number? ',selection
print,' '
endif
print,select(selection)
case selection of
0: read,'Enter initial and final equinox (e.g. 1950,2000): ',yeari,yearf
1: gtypeo = ' Galactic'
2: gtypei = ' Galactic'
3: gtypeo = ' Ecliptic'
4: gtypei = ' Ecliptic'
5: begin & gtypei = ' Ecliptic' & gtypeo = ' Galactic' & end
6: begin & gtypei = ' Galactic' & gtypeo = ' Ecliptic' & end
else: begin
print,string(7b),selection,' is not an available option'
npar = 0
goto, selector
end
endcase
radec = ' '
;
help_inp: if input_type(selection) eq 0 then begin
namei = ' RA Dec (' + string(fix(yeari),form='(i4)') + ')'
print,format='(/A)',' Enter RA, DEC with either 2 or 6 parameters '
print,format='(A/)',' Either RA, DEC (degrees) or HR, MIN, SEC, DEG, MIN SEC'
endif
if output_type(selection) lt 2 then $
nameo = ' RA Dec (' + string(fix(yearf),format='(i4)') + ')'
read_inp: if input_type(selection) eq 0 then $
read,'Enter'+ namei + ' (RETURN to exit): ',radec $
else read,'Enter'+gtypei+' Longitude and Latitude (RETURN to exit): ',radec
if strlen(radec) eq 0 then begin
!quiet = sv_quiet
return
endif
ra_dec = getopt(radec,'F')
case n_elements(ra_dec) of
2: begin
ra = ra_dec(0)
dec = ra_dec(1)
if output_type(selection) ne 2 then output_type(selection) = 0
end
6: begin
ra = ten(ra_dec(0:2))*15.
dec = ten(ra_dec(3:5))
if output_type(selection) ne 2 then output_type(selection) = 1
end
else: begin
print,string(7B),'ASTRO: ERROR - Invalid Input'
goto,help_inp
end
endcase
if selection eq 0 then begin
precess,ra,dec,yeari,yearf ;Actual Calculations
newra = ra & newdec = dec
endif else euler,ra,dec,newra,newdec,selection
if newra lt 0 then newra = newra + 360.
case output_type(selection) of
0: print,form='(A,F7.2,F7.2)',nameo,newra,newdec
1: print,nameo,adstring([newra,newdec])
2: print,form='(A,f7.2,A,F7.2)',gtypeo+' Longitude:',newra,' Latitude:',newdec
endcase
print,' '
goto,read_inp
end