Changeset 2426 in lmdz_wrf
- Timestamp:
- Apr 9, 2019, 7:54:13 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r2425 r2426 140 140 # latex_text: Function to transform a text to LaTeX following style rules 141 141 # Latin_Greek: Function to pass an ASCII latin character to its equivalent greek 142 # leapdays: Function to provide how many leap days are between two years 142 143 # linearint_weights: Function to provide the weights for a linear interpolation of a value between a couple of values as a weighted distance mean 143 144 # linearint_3x3weights: Function to provide the weights for a linear interpolation of a value inside a 3x3 matrix of values as a weighted distance mean … … 508 509 return diffdate.days 509 510 511 def leapdays(yeari, yeare): 512 """ Function to provide how many leap days are between two years 513 yeari: initial year from [yeari] Jan 01 514 yeare: end year until [yearf] Dec 12 515 >>> leapdays(1970,1980) 516 3 517 >>> leapdays(1976,1976) 518 1 519 """ 520 fname = 'leapdays' 521 522 Nleapdays = 0 523 for iyr in range(yeari,yeare+1): 524 if days_month(iyr,2) == 29: Nleapdays=Nleapdays+1 525 526 527 return Nleapdays 528 510 529 def datetimeStr_datetime(StringDT): 511 530 """ Function to transform a string date ([YYYY]-[MM]-[DD]_[HH]:[MI]:[SS] format) to a date object … … 601 620 >>> datetimeStr_conversion('1980/03/05 18-00-00','Y/m/d H-M-S','cfTime,minutes since 1979-12-01_00:00:00') 602 621 137880.0 622 >>> datetimeStr_conversion('-12357.961','cfTimeCal,days since 1949-12-01 00:00:00,noleap','Y/m/d H-M-S') 623 603 624 """ 604 625 import datetime as dt … … 1040 1061 1041 1062 return dateYmdHMS 1063 1064 print datetimeStr_conversion('-12357.961','cfTimeCal,days since 1949-12-01 00:00:00,noleap','Y/m/d H-M-S') 1065 quit() 1042 1066 1043 1067 def period_information(idate, edate, totunits):
Note: See TracChangeset
for help on using the changeset viewer.