Last change
on this file since 7 was
7,
checked in by pinsard, 18 years ago
|
1st commit according to cerbere.lodyc.jussieu.fr:/usr/home/smasson/IDL_RD/
|
-
Property svn:eol-style set to
native
-
Property svn:executable set to
*
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
1.1 KB
|
Rev | Line | |
---|
[2] | 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 |
---|
[7] | 43 | |
---|
| 44 | return,(399+(yr mod 400))/400 - (3+(yr mod 4))/4 |
---|
| 45 | |
---|
[2] | 46 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.