Changeset 2459 in lmdz_wrf
- Timestamp:
- Apr 23, 2019, 2:31:25 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r2458 r2459 142 142 # latex_text: Function to transform a text to LaTeX following style rules 143 143 # Latin_Greek: Function to pass an ASCII latin character to its equivalent greek 144 # leapyr: Function to determine if it is a leap year (independently of datetime) 144 145 # leapdays: Function to provide how many leap days are between two years 145 146 # linearint_weights: Function to provide the weights for a linear interpolation of a value between a couple of values as a weighted distance mean … … 15803 15804 # print ' ' , '(', inds[i,j,0], ',', inds[i,j,1], ')' 15804 15805 15806 def leapyr(yr): 15807 """ Function to determine if it is a leap year (independently of datetime) 15808 FROM: https://en.wikipedia.org/wiki/Leap_year 15809 yr: year to check 15810 >>> leapyr(2019) 15811 False 15812 >>> leapyr(1976) 15813 True 15814 >>> leapyr(1800) 15815 False 15816 >>> leapyr(1850) 15817 False 15818 """ 15819 fname = 'leapyr' 15820 15821 isleap = False 15822 if np.mod(yr,4) == 0: isleap = True 15823 if np.mod(yr,100) == 0: isleap = False 15824 if np.mod(yr,400) == 0: isleap = True 15825 15826 return isleap 15827 15805 15828 def fix_CFdates(timevals, origcftimeu, origcal, \ 15806 15829 newcftimeu= 'hours since 1949-12-01 00:00:00', newcal='gregorian'):
Note: See TracChangeset
for help on using the changeset viewer.