source: trunk/CALENDRIER/leapyr.pro @ 2

Last change on this file since 2 was 2, checked in by opalod, 22 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.2 KB
Line 
1;-----------------------------------------------------------------
2        function leapyr,year
3;+
4; NAME:                 leapyr
5;
6; PURPOSE:              determine whether the input year is a leap year or not
7;                       Very useful for finding number of days in a year.
8;                       eg. NUM_DAYS_IN_YR = 365 + leapyr(year)
9;
10; CATEGORY:             Utility
11;
12; CALLING SEQUENCE:     result = leapyr(year)
13;
14; INPUTS:               year    = test if year is a leap year
15;                                 year may be a vector and may be in the 
16;                                 form MCDU eg. 1788 else defaults to 19XX
17;
18; OUTPUTS:              result  = 0 then not a leap year
19;                               = 1 then year is a leap year
20;                               = (399+(yr mod 400))/400 - (3+(yr mod 4))/4
21;
22; COMMON BLOCKS:
23;       none.
24; SIDE EFFECTS:
25;       none.
26; MODIFICATION HISTORY:
27;       Written by: Trevor Harris, Physics Dept., University of Adelaide,
28;               20/09/88
29;
30;-
31
32;       this function returns with an I*4 value of :-
33;                                               1  if year is a leap year
34;                                               0  if year is not a leap year
35;       T.J.H. 20/09/88
36
37;       Note:  year must be in the form MCDU eg. 1788  else defaults to 19XX
38
39       
40        yr = year
41        tmp = where(yr lt 100,count)
42        if (count gt 0) then yr(tmp) = yr(tmp)+1900 ;make it the 20th century
43        print,'TOTO'   
44;       return,(399+(yr mod 400))/400 - (3+(yr mod 4))/4
45        return, 0       
46        end
Note: See TracBrowser for help on using the repository browser.