Changeset 2482 in lmdz_wrf
- Timestamp:
- Apr 29, 2019, 8:35:45 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/tools/generic_tools.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r2481 r2482 2336 2336 availcalendar = ['noleap', '365d', '365_day'] 2337 2337 2338 lTunits = Tunits.split(' ') 2339 NTunits = len(lTunits) 2340 Tu = lTunits[0] 2341 2342 if NTunits < 4: 2343 print infmsg 2344 print ' ' + fname + ": CF-time units without time, adding '00:00:00' !!" 2345 Srefdate = lTunits[2] + ' 00:00:00' 2346 else: 2347 Srefdate = lTunits[2] + ' ' + lTunits[3] 2348 refdate = [int(Srefdate[0:4]), int(Srefdate[5:7]), int(Srefdate[8:10]), \ 2349 int(Srefdate[11:13]), int(Srefdate[14:16]), int(Srefdate[17:19]) ] 2338 timeinf = CFtimeU_inf(Tunits) 2339 2340 refdate = timeinf.refdate 2341 Tu = timeinf.Tunits 2350 2342 2351 2343 if type(timev) == type(range(2)): … … 2367 2359 quit(-1) 2368 2360 2369 if Tu == 'weeks': 2370 timevdays = timev * 7 2371 elif Tu == 'days': 2372 timevdays = timev * 1. 2373 elif Tu == 'hours': 2374 timevdays = timev / 24. 2375 elif Tu == 'minutes': 2376 timevdays = timev / (24.*60.) 2377 elif Tu == 'seconds': 2378 timevdays = timev / (24.*3600.) 2379 else: 2380 print errormsg 2381 print ' ' + fname + ": CF time units '" + Tu + "' not ready !!" 2382 print ' available ones:', availTu 2383 quit(-1) 2361 # Transforming to days 2362 factordays = timeinf.utodays 2363 timevdays = timev * factordays 2384 2364 2385 2365 newtimes = np.zeros((dimt), dtype=np.float64) 2386 2387 refdays = juliandate(refdate[0], refdate[1], refdate[2], refdate[3], refdate[4], refdate[5]) 2388 2389 yrref = refdate[0] 2366 refdays = timeinf.refdatejuliand 2367 yrref = timeinf.refdatemat[0] 2390 2368 if cal == 'noleap' or cal == '365d' or cal == '365_day': 2391 2369 for it in range(dimt): … … 2409 2387 2410 2388 # Re-transforming to the original units 2411 if Tu == 'weeks': 2412 newtimes = newtimes/(7.) 2413 elif Tu == 'days': 2414 newtimes = newtimes*1. 2415 elif Tu == 'hours': 2416 newtimes = newtimes*60. 2417 elif Tu == 'minutes': 2418 newtimes = newtimes*24.*3600. 2389 newtimes = newtimes/factordays 2419 2390 2420 2391 return newtimes
Note: See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/LMDZ_WRF/chrome/site/your_project_logo.png)