C+ C NAME: C N_CARRINGTON C PURPOSE: C Return Carrington rotation number for given time (iYr,Doy) C CALLING SEQUENCE: function N_CARRINGTON(iYr,Doy) C INPUTS: C iYr integer year C Doy real day of year (including fraction for time of day) C OUTPUTS: C N_CARRINGTON integer Carrington rotation number C iYr integer start year and ... C Doy real .. day of year for rotation N_CARRINGTON C CALLS: C Julian,MAP_TZERO C INCLUDE: include 'sun.h' C EXTERNAL: external EARTH C PROCEDURE: C See R. Green, Spherical Astronomy, Cambridge UP, p. 430-434. C The formulae on p. 434 is used to obtain a first estimate for C the Carrington rotation number. The subroutine MAP_TZERO is used C to refine the estimate. C MODIFICATION HISTORY: C APR-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- integer iYr real Doy double precision JD double precision JEpoch double precision RJD parameter (nCar = 3) double precision JDCar(nCar) call Julian(0,iYr,Doy,JD,JEpoch) !------- ! RJD is approximate start time for Carrington rotation N_CARRINGTON RJD = 1750.0d0+(JD-2445871.91d0)/SUN__SYNODICP if (RJD .lt. 1.0d0) stop 'N_CARRINGTON: sorry, prehistoric dates not permitted' N_CARRINGTON = int(RJD)-1 RJD = (N_CARRINGTON-1750)*SUN__SYNODICP+2445871.91d0 call Julian(1,JYR,RDoy,RJD,JEpoch) !------- ! Exact start time JDCar(1) for Carrington rotation N_CARRINGTON, JDCar(2) for ! rotation N_CARRINGTON+1 RDoy = RDoy-1.0 call MAP_TZERO(EARTH,JYR,RDoy,0.005,nCar,JDCar) if (abs(JDCar(1)-RJD) .gt. 1.0) stop 'N_CARRINGTON: something wrong, I guess' !------- ! Correct Carrington rotation number if necessary if (JD .gt. JDCar(3)) then N_CARRINGTON = N_CARRINGTON+2 call Julian(1,iYr,Doy,JDCar(3),JEpoch) else if (JD .gt. JDCar(2)) then N_CARRINGTON = N_CARRINGTON+1 call Julian(1,iYr,Doy,JDCar(2),JEpoch) else call Julian(1,iYr,Doy,JDCar(1),JEpoch) end if return end