!$Header: /weru/cvs/weps/weps.src/util/date/julday.for,v 1.1.1.1.8.1 2002-11-22 21:46:20 fredfox Exp $ ! ! JULDAY is taken from _Numerical_Recipes:_The_Art_of_Scientific_Computing_ integer function julday (dd, mm, yyyy) ! + + + PURPOSE + + + ! In this routine JULDAY returns the Julian Day Number which begins at ! noon of the calendar date specified by day "dd", month "mm", & year "yyyy" ! All are integer variables. Positive year signifies A.D.; negative, B.C. ! Remember that the year after 1 B.C. was 1 A.D. ! The following invalid calendar dates are checked for and reported: ! 1. zero year ! 2. dates between 4/10/1582 and 15/10/1582 are specified. ! ! Additional checking for other invalid dates could be added ! in the future if necessary. ! ! + + + KEYWORDS + + + ! date, utility ! ! + + + ARGUMENT DECLARATIONS + + + integer dd, mm, yyyy integer igreg ! ! ! + + + ARGUMENT DEFINITIONS + + + ! dd - integer value of day in the range 1-31 ! mm - month in the range 1-12 ! yyyy - year (negative A.D., positive B.C.) ! ! + + + PARAMETERS + + + ! Gregorian Calendar was adopted on Oct. 15, 1582. parameter (igreg=15+31*(10+12*1582)) ! ! + + + LOCAL VARIABLES + + + integer jy, jm, ja ! ! + + + END SPECIFICATIONS + + + ! if (yyyy.eq.0) pause 'There is no year zero' if ((yyyy.eq.1582) .and. (mm.eq.10) .and. & & (dd.lt.15) .and. (dd.gt.4)) pause 'This is an invalid date' if (yyyy.lt.0) yyyy=yyyy+1 if (mm.gt.2) then jy=yyyy jm=mm+1 else jy=yyyy-1 jm=mm+13 endif julday=int(365.25*jy)+int(30.6001*jm)+dd+1720995 if (dd+31*(mm+12*yyyy).ge.igreg) then ja=jy/100 ! ja=int(dble(0.01)*dble(jy)) julday=julday+2-ja+int(dble(0.25)*dble(ja)) endif return end ! !$Log: not supported by cvs2svn $ !Revision 1.2 2002/09/04 20:22:18 wagner !allow free format src compilation ! !Revision 1.1.1.1 1999/03/12 17:05:31 wagner !Baseline version of WEPS with Bill Rust's modifications ! ! Revision 1.2 1998/09/03 18:35:36 jt ! check in a full copy of WEPS - I hope ??? ! ! Revision 1.1.1.1 1995/01/18 04:20:07 wagner ! Initial checkin ! ! Revision 2.2 1992/04/03 23:04:07 wagner ! changed from multiplying by 0.01 to dividing by 100 ! to alleviate floating point roundoff problem that ! exists with Microsoft FORTRAN v5.1 compiler when ! the dates of 28/2/1900 - 28/2/1901 are input. ! Hopefully, this will fix that problem without ! others surfacing from this change. ! The line used to be: ! ja=int(dble(0.01)*dble(jy)) ! It is now: ! ja=jy/100 ! ! Revision 2.1 1992/03/27 17:22:53 wagner ! Fixed roundoff problems by adding some ! double precision casts (DBLE) to some ! constants and integer variables in a ! couple of intermediate computations. ! ! Also added some preliminary error checking ! for a zero year and the "missing" days ! between 4/10/1582 and 15/10/1582. ! ! Version 2 code. !