;* day_of_year.pro ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* IDL programming language. ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* ;/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ FUNCTION day_of_year, year, month, day day_tab = INTARR (13, 2) day_tab [*, 0] = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] day_tab [*, 1] = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] y4 = year MOD 4 y100 = year MOD 100 y400 = year MOD 400 leap = (y4 EQ 0) AND (y100 NE 0) OR (y400 EQ 0) ;print, 'year: ', year, ' leap: ', leap FOR i = 1, month-1 DO $ BEGIN day = day + day_tab [i, leap]; END RETURN, day END ;/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */