CALDAT Subroutine

public subroutine CALDAT(JULIAN, MM, ID, IYYY)

Arguments

Type IntentOptional Attributes Name
integer(kind=INT64) :: JULIAN
integer :: MM
integer :: ID
integer :: IYYY

Called by

proc~~caldat~~CalledByGraph proc~caldat CALDAT proc~getdateint8 GetDateInt8 proc~getdateint8->proc~caldat interface~getdate GetDate interface~getdate->proc~getdateint8 proc~getdateint4 GetDateInt4 interface~getdate->proc~getdateint4 proc~getdateint4->proc~getdateint8 proc~getbegdatetime GetBegDateTime proc~getbegdatetime->interface~getdate proc~getdatetimevec GetDateTimeVec proc~getdatetimevec->interface~getdate proc~cfio_getvar CFIO_GetVar proc~cfio_getvar->proc~getdatetimevec proc~cfio_sgetvar CFIO_SGetVar proc~cfio_sgetvar->proc~getdatetimevec proc~esmf_cfiosdffileopen ESMF_CFIOSdfFileOpen proc~esmf_cfiosdffileopen->proc~getbegdatetime

Source Code

      SUBROUTINE CALDAT (JULIAN,MM,ID,IYYY)
!
!C   ROUTINE CONVERTS JULIAN DAY TO MONTH, DAY, & YEAR.
!C   THIS CODE IS LIFTED FROM THE BOOK:
!C   W.H. PRESS ET AL., NUMERICAL RECIPES, CAMBRIDGE UNIV. PRESS, 1986.
!C   THE ONLY MODIFICATION IS THAT REAL ARITHMETIC IS DONE IN R*8.
!C
!C   THE ROUTINE OUTPUTS THE MONTH, DAY, AND YEAR ON WHICH THE
!C   SPECIFIED JULIAN DAY STARTED AT NOON.
!C
!C   TO CONVERT MODIFIED JULIAN DAY, CALL THIS ROUTINE WITH
!C     JULIAN = MJD + 2400001
!C
      integer(INT64) JULIAN
      integer IGREG
      integer JALPHA, JA, JB, JC, JD, JE, ID, MM, IYYY
      PARAMETER (IGREG=2299161)
      IF (JULIAN.GE.IGREG) THEN
         JALPHA=INT((DBLE(JULIAN-1867216)-0.25D0)/36524.25D0)
         JA=JULIAN+1+JALPHA-INT(0.25D0*DBLE(JALPHA))
      ELSE
         JA=JULIAN
      ENDIF
      JB=JA+1524
      JC=INT(6680.D0+(DBLE(JB-2439870)-122.1D0)/365.25D0)
      JD=365*JC+INT(0.25D0*DBLE(JC))
      JE=INT(DBLE(JB-JD)/30.6001D0)
      ID=JB-JD-INT(30.6001D0*DBLE(JE))
      MM=JE-1
      IF (MM.GT.12) MM=MM-12
      IYYY=JC-4715
      IF (MM.GT.2) IYYY=IYYY-1
      IF (IYYY.LE.0) IYYY=IYYY-1
      RETURN
      END subroutine CALDAT