c c **************************** c *** Subroutine MJLcYD *** c *** 1984/12/06/10-07 *** c **************************** c Subroutine MJLcYD(mjl,fmjl, iyear,idayy,fdayy) *********************************************************************** * * * Purpose: Given the modified Julian date in days and fraction * * of days (mjl, fmjl). * * * * Return the (actual) year and the (actual!) day * * and fractional parts of the actual day from * * beginning of year. * * * * The modified Julian date is obtained from the * * Julian date by computing * * (mjl, fmjl) = (jl-2400000, fjl-0.5) * * * * The Julian date is a continuous count of days and * * fractional days from -4712 b.C. january 1 at * * 0.5 hours UT. * * * * * * Parameters Type I/O Function * * * * mjl i*4 I days of modified Julian * * date * * fmjl r*8 I fractional part of days * * of modified Julian date * * * * iyear i*4 O actual year * * idayy i*4 O actual day (of the year) * * cf. examples * * fdayy r*8 O fractional part of the actual * * day (of the year) * * * * * * Examples * * * * Input: mjl = 45699, fmjl = 0.9999898548239468 * * Represents: 1983/12/31/23/59/59.1234567890 * * Output: iyear = 83, idayy = 365, fdayy = 0.9999898548239468 * * * * Input: mjl = 45700, fmjl = 0.0 * * Represents: 1984/01/01/00/00/00.0 * * Output: iyear = 84, idayy = 1, fdayy = 0.0000000000000000 * * * * Input: mjl = 45700, fmjl = 0.0000115740740740 * * Represents: 1984/01/01/00/00/01.0000000000 * * Output: iyear = 84, idayy = 1, fdayy = 0.0000115740740740 * * * * Input: mjl = 45980, fmjl = 0.6459736511202435 * * Represents: 1984/10/07/15/30/12.1234567890 * * Output: iyear = 84, idayy = 281, fdayy = 0.6459736511202435 * * * * Thus you can see: idayy never may be 0! This means we start * * the year with Jan. 1.0, or using other words, idayy = 1 * * and fdayy = 0.0 means we are at the precise beginning of * * the first day of a year (idayy = 1) and nothing (fdayy = 0.0) * * of this day is over! * * * * * * B. Hofmann-Wellenhof, B. Remondi * * * *********************************************************************** c implicit real*8 (a-h,o-z) dimension idb(4) data idb/365,365,365,366/ c c Input data test. c if(mjl .lt. 15385 .or. mjl .ge. 88069) + stop ' MJLcYD: "mjl" must be 15385 <= mjl < 88069' if(fmjl .lt. 0.d0 .or. fmjl .ge. 1.d0) + stop ' MJLcYD: "fmjl" must be 0.0 <= fmjl < 1.0' c c Determination of basis year (1901, 1949, 2001 or 2049). c The January 1 of these four years corresponds to the modified c Julian day numbers 15385, 32917, 51910, 69442. c if(mjl .ge. 51910) goto 3010 if(mjl .ge. 32917) goto 3000 c c The actual mjl lies in the range from 1901-1948. c ibase = 15385 iyear = 1 goto 3030 3000 continue c c The actual mjl lies in the range from 1949-2000. c ibase = 32917 iyear = 49 goto 3030 3010 continue if(mjl .ge. 69442) goto 3020 c c The actual mjl lies in the range from 2001-2048. c ibase = 51910 iyear = 101 goto 3030 3020 continue c c The actual mjl lies in the range from 2049-2099. c ibase = 69442 iyear = 149 3030 continue c c Determination of the year. c 2000 i = 0 2010 i = i + 1 if(i .gt. 4) goto 2000 ibase = ibase + idb(i) if(ibase .gt. mjl) goto 3040 iyear = iyear + 1 goto 2010 3040 continue idayy = mjl - ibase + idb(i) + 1 fdayy = fmjl return c c End of Subroutine MJLcYD c c ***************************************************************** end