date_to_mjd Subroutine

public pure subroutine date_to_mjd(year, month, day, mjd)

Convert calendar date to Modified Julian Date (MJD)

Arguments

Type IntentOptional Attributes Name
integer(kind=ip), intent(in) :: year
integer(kind=ip), intent(in) :: month
integer(kind=ip), intent(in) :: day
real(kind=dp), intent(out) :: mjd

Calls

proc~~date_to_mjd~~CallsGraph proc~date_to_mjd date_to_mjd proc~julian_day julian_day proc~date_to_mjd->proc~julian_day

Called by

proc~~date_to_mjd~~CalledByGraph proc~date_to_mjd date_to_mjd proc~sw_init sw_data_type%sw_init proc~sw_init->proc~date_to_mjd proc~jr_init jacchia_roberts_type%jr_init proc~jr_init->proc~sw_init

Source Code

   pure subroutine date_to_mjd(year, month, day, mjd)
      integer(ip), intent(in) :: year, month, day
      real(dp), intent(out) :: mjd

      ! Convert JDN to MJD at midnight (00:00 UTC)
      ! JDN is at noon, so JDN - 0.5 gives midnight
      ! MJD = JD - 2400000.5 = (JDN - 0.5) - 2400000.5 = JDN - 2400001.0
      mjd = real(julian_day(year, month, day) - 2400001, dp)

   end subroutine date_to_mjd