C+ C NAME: C precession_drive.f C PURPOSE: C precess RA and DEC from any Date and time to another using the precession routines and eliiptic_equator C CATEGORY: C I/O C CALLING SEQUENCE: C call precession_drive(imode,iY1,Doy1,iY2,Doy2,iMO,iD,UT,iRAI,iDECI,iRA,iDEC,cRA,cDEC) C C INPUTS: C ReadACE8: C imode integer mode of operation C 0 - any date to any date conversion C 1 - J1950 to J2000 conversion C 2 - J1950 to present day conversion C 3 - J2000 to present day conversion C iY1 integer input beginning year - (like 1950 - for imode = 0) C Doy1 real*8 input beginning day of year (for imode = 0) C iY2 integer input ending year - (like 2013 for present day) C Doy2 real*8 input beginning day of year (for imode = 0) C iMO integer input ending month C iD integer input ending day C UT real input ending UT in hours C iRAI(3) integer Right Ascension (hh mm ss) C iDECI(3) integer Declination (deg mm ss) C C OUTPUTS: C iRA(3) integer Right Ascension (hh mm ss) C iDEC(3) integer Declination (deg mm ss). If any preceeding input is zero the minus sign is C placed on a following valid number (on output) C cRA(3) character*3 Right Ascension (hh mm ss) in character values C cDEC(3) character*3 Declination (deg mm ss) in character values C C SUBROUTINE CALLS: C Date_DOY, Julian8, C C MODIFICATION HISTORY: C August-2013, Bernard Jackson (UCSD) C subroutine precession_drive(imode,iY1,Doy1,iY2,Doy2,iMO,iD,UT,iRAI,iDECI,iRA,iDEC,cRA,cDEC) real*8 Doy1,Doy18 ! beginning day real*8 Doy2,Doy28 ! ending day real*8 JEpoch1, JEpoch2 real*8 JD1, JD2 integer iRAI(3),iRA(3) ! Right Ascension (hh mm ss) integer iDECI(3),iDEC(3) ! Declination (deg mm ss) character*3 cMon character*3 cRA(3) ! Right Ascension (hh mm ss) character*3 cDEC(3) ! Declination (dec mm ss) character*3 cRA1,cRA2,cRA3 character*3 cDEC1,cDEC2,cDEC3 character*3 cBLANK /' '/ C C print *, 'Into precession_drive' C write(*,'(A24,3I4,2X,3I4)') ' Input digital RA, DEC', iRAI(1), iRAI(2), iRAI(3), iDECI(1), iDECI(2), iDECI(3) if(imode.eq.0) then ! Used if both RA and DEC input and output times are specified in year and day of years nYr1 = iY1 Doy18 = Doy1 nYr2 = iY2 Doy28 = Doy2 end if if(imode.eq.1.or.imode.eq.2) then ! Used if the start RA, and DECs are in J1950 coordinates nYr1 = 1950 Doy18 = 0.923D0 ! Simonetti "Observational Astrophysics" end if if(imode.eq.3) then ! Used if the start RA, and DECs are in J2000 coordinates nYr1 = 2000 Doy18 = 0.50 ! Simonetti "Observational Astrophysics" end if call Julian8(0,nYr1,Doy18,JD1,JEpoch1) C if(imode.eq.1) then ! Used if the end RA, and DECs are in J2000 coordinates nYr2 = 2000 Doy28 = 0.50 ! Simonetti "Observational Astrophysics" end if if(imode.eq.2.or.imode.eq.3) then ! Used if the end RA, and DECs are in present-day coordinates - time inputs in iY2,iMO,ID,UT nYr2 = iY2 cMon = ' ' call Date_DOY(0,nYr2,cMon,iMO,iD,iDoy) Doy28 = iDoy+dble(UT/24.) end if call Julian8(0,nYr2,Doy28,JD2,JEpoch2) C C Precess from IRAI, DECI to IRA, IDEC C rLng = (float(iRAI(1))+(float(iRAI(2))+float(iRAI(3))/60.)/60.)*15. ! RA input (deg) if(iDECI(1).lt.0.or.iDECI(2).lt.0.or.iDECI(3).lt.0) then if(iDECI(3).lt.0) then rLat = float(iDECI(3))/3600.0 else if(iDECI(2).lt.0) then rLat = float(iDECI(2))/60.0 - float(iDECI(3))/3600.0 else rLat = float(iDECI(1)) - float(iDECI(2))/60.0 - float(iDECI(3))/3600.0 end if end if else rLat = float(iDECI(1)) + (float(iDECI(2)) + float(iDECI(3))/60.)/60. ! Decl input (deg) end if call ECLIPTIC_EQUATOR8(1,nYr1,Doy18,rLng,rLat) ! Convert equatorial to ecliptic (degrees) call Precession_Rot(JEpoch1,JEpoch2,rLng,rLat) ! Precess to current day call ECLIPTIC_EQUATOR8(0,nYr2,Doy28,rLng,rLat) ! Convert ecliptic to equatorial (degrees) iRA(1) = int(rlng/15.0) rmaiRA1 = (rlng - 15.0*float(iRA(1)))*4.0 iRA(2) = int(rmaiRA1) iRA(3) = nint((rmaiRA1 - float(iRA(2)))*60.0) iRA3P = 0 if(iRA(3).ge.60) then iRA3P = iRA(3) - 59 iRA(3) = iRA(3) + iRA3P - 61 end if iRA2P = 0 if((iRA(2)+((iRA3P + 59)/60)).ge.60) then iRA2P = iRA(2) - 59 iRA(2) = iRA(2) + iRA2P - 61 else iRA2P = 0 iRA(2) = iRA(2) + ((iRAP + 59)/60) end if iRA(1) = iRA(1) + ((iRA2P + 59)/60) if(iRA(1).ge.24) iRA(1) = iRA(1) - 24 idsign = 1 if(rLat.lt.0.0) idsign = -1 rLata = abs(rLat) iDEC(1) = int(rLata) aiDEC1 = (rLata - float(iDEC(1)))*60.0 iDEC(2) = int(aiDEC1) iDEC(3) = nint((aiDEC1 - float(iDEC(2)))*60.0) C iDEC3P = 0 if(iDEC(3).ge.60) then iDEC3P = iDEC(3) - 59 iDEC(3) = iDEC(3) + iDEC3P - 61 end if if((iDEC(2)+((iDEC3P + 59)/60)).ge.60) then iDEC2P = iDEC(2) - 59 iDEC(2) = iDEC(2) + iDEC2P - 61 else iDEC2P = 0 iDEC(2) = iDEC(2) + ((iDEC3P + 59)/60) end if if((iDEC(1)+((iDEC2P + 59)/60)).gt.90) then iDEC(1) = 90 - ((iDEC2P + 59)/60) iRA(1) = 23 - iRA(1) iRA(2) = 59 - iRA(2) iRA(3) = 60 - iRA(3) end if iDEC(1) = iDEC(1) - ((iDEC2P + 59)/60) C if(iDEC(1).ne.0) then iDEC(1) = iDEC(1)*idsign else if(iDEC(2).ne.0) then iDEC(2) = iDEC(2)*idsign else iDEC(3) = iDEC(3)*idsign end if end if C write(cRA1(1:3),'(I3)') iRA(1) write(cRA2(1:3),'(I3)') iRA(2) write(cRA3(1:3),'(I3)') iRA(3) cRA(1) = cRA1 cRA(2) = cRA2 cRA(3) = cRA3 if(iDEC(1).eq.0) then cDEC1 = cBLANK else write(cDEC1(1:3),'(I3)') iDEC(1) end if if(iDEC(2).eq.0.and.cDEC1.eq.cBLANK) then cDEC2 = cBLANK else write(cDEC2(1:3),'(I3)') iDEC(2) end if write(cDEC3(1:3),'(I3)') iDEC(3) cDEC(1) = cDEC1 cDEC(2) = cDEC2 cDEC(3) = cDEC3 C write(*,'(A24,3I4,2X,3I4)') 'Output digital RA, DEC', iRA(1), iRA (2), iRA(3), iDEC(1), iDEC(2), iDEC(3) C write(*,'(A24,1X,A3,1X,A3,1X,A3,3X,A3,1X,A3,1X,A3)') 'Output character RA, DEC', cRA(1), cRA(2), cRA(3), cDEC(1), cDEC(2), cDEC(3) return end