- Timestamp:
- Apr 29, 2019, 7:18:15 PM (6 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r2480 r2481 937 937 * leap years: 'leap', '365d', 'gregorian', 'Gregorian', 'standard', 938 938 'Standard' 939 * no-leap years: 'noleap', '360d' 939 * no-leap years: 'noleap', '360d', '365d', '365_day' 940 940 'matYmdHMS': numerical vector with [[YYYY], [MM], [DD], [HH], [MI], [SS]] 941 941 'YmdHMS': [YYYY][MM][DD][HH][MI][SS] format … … 976 976 availcftimeu = ['weeks', 'days', 'hours', 'minutes', 'seconds', 'milliseconds'] 977 977 availcalendar = ['leap', '366d', 'gregorian', 'Gregorian', 'standard', \ 978 'Standard', 'noleap', '365d', '36 0d', 'proleptic_gregorian']978 'Standard', 'noleap', '365d', '365_day', '360d', 'proleptic_gregorian'] 979 979 980 980 if type(StringDT) == type('S') and StringDT[0:1] == 'h': … … 1071 1071 1072 1072 removeleap = False 1073 if calendar == 'noleap' or calendar == '365d' :1073 if calendar == 'noleap' or calendar == '365d' or calendar == '365_day': 1074 1074 newdate = advance_cfDate(refdate, timeval, tunits) 1075 1075 if int(yrref) <= newdate.year: … … 1290 1290 totsecs = difft.days()*24*3600. + difft.seconds() 1291 1291 1292 if calendar == 'noleap' or calendar == '365d' :1292 if calendar == 'noleap' or calendar == '365d' or calendar == '365_day': 1293 1293 removeleap = False 1294 1294 if int(yrref) <= datei.year: … … 1299 1299 totsecs = totsecs-Nleapd*24*3600. 1300 1300 1301 if calendar == 'noleap' or calendar == '365d' :1301 if calendar == 'noleap' or calendar == '365d' or calendar == '365_day': 1302 1302 removeleap = False 1303 1303 if days_month(datei.year,2) == 29: … … 2234 2234 2235 2235 availTu = ['weeks', 'days', 'hours', 'minutes', 'seconds'] 2236 availcalendar = ['noleap', '365d' ]2236 availcalendar = ['noleap', '365d', '365_day'] 2237 2237 2238 2238 lTunits = Tunits.split(' ') … … 2287 2287 2288 2288 yrref = refdate.year 2289 if cal == 'noleap' or cal == '365d' :2289 if cal == 'noleap' or cal == '365d' or cal == '365_day': 2290 2290 for it in range(dimt): 2291 2291 # Some issues in implementations/machines ... … … 2334 2334 2335 2335 availTu = ['weeks', 'days', 'hours', 'minutes', 'seconds'] 2336 availcalendar = ['noleap', '365d' ]2336 availcalendar = ['noleap', '365d', '365_day'] 2337 2337 2338 2338 lTunits = Tunits.split(' ') … … 2388 2388 2389 2389 yrref = refdate[0] 2390 if cal == 'noleap' or cal == '365d' :2390 if cal == 'noleap' or cal == '365d' or cal == '365_day': 2391 2391 for it in range(dimt): 2392 2392 tdays = refdays + timevdays[it] … … 2443 2443 2444 2444 # For non-gregorian calendars, we impose gregorian (since, we are using python) 2445 if cal == 'noleap' or cal == '365d' :2445 if cal == 'noleap' or cal == '365d' or cal == '365_day': 2446 2446 timev = impose_gregorian(timeval, tu + ' since ' + daterefS, cal) 2447 2447 else: … … 2589 2589 if tcalendar is not None: 2590 2590 print ' netCDFdatetime_realdatetime: There is a calendar attribute' 2591 if tcalendar == '365_day' or tcalendar == 'noleap' :2591 if tcalendar == '365_day' or tcalendar == 'noleap' or tcalendar == '365d': 2592 2592 print ' netCDFdatetime_realdatetime: No leap years!' 2593 2593 isleapcal = False 2594 elif tcalendar == 'proleptic_gregorian' or tcalendar == 'standard' or tcalendar == 'gregorian': 2594 elif tcalendar == 'proleptic_gregorian' or tcalendar == 'standard' or \ 2595 tcalendar == 'gregorian': 2595 2596 isleapcal = True 2596 2597 elif tcalendar == '360_day': … … 2599 2600 else: 2600 2601 print errormsg 2601 print ' netCDFdatetime_realdatetime: Calendar "' + tcalendar + '" not prepared!' 2602 print ' netCDFdatetime_realdatetime: Calendar "' + tcalendar + \ 2603 '" not prepared!' 2602 2604 quit(-1) 2603 2605 … … 5432 5434 if tcalendar is not None: 5433 5435 print ' netCDFdatetime_realdatetime: There is a calendar attribute' 5434 if tcalendar == '365_day' or tcalendar == 'noleap' :5436 if tcalendar == '365_day' or tcalendar == 'noleap' or tcalendar == '365d': 5435 5437 print ' netCDFdatetime_realdatetime: No leap years!' 5436 5438 isleapcal = False 5437 elif tcalendar == 'proleptic_gregorian' or tcalendar == 'standard' or tcalendar == 'gregorian': 5439 elif tcalendar == 'proleptic_gregorian' or tcalendar == 'standard' or \ 5440 tcalendar == 'gregorian': 5438 5441 isleapcal = True 5439 5442 elif tcalendar == '360_day': … … 16339 16342 16340 16343 # If the calendar is not gregorian, it needs to be fixed from origSrefdate! 16341 if origcal == 'noleap' or origcal == '365d' :16344 if origcal == 'noleap' or origcal == '365d' or origcal == '365_day': 16342 16345 print ' ' + fname + ": found non-standard calendar '" + origcal + "' !!" 16343 16346 # Imposing to gregorian calendar -
trunk/tools/nc_var_tools.py
r2480 r2481 25562 25562 quit(-1) 25563 25563 25564 if calendar == 'noleap' or calendar == '365d' :25564 if calendar == 'noleap' or calendar == '365d' or calendar == '365_day' : 25565 25565 # Adding leap days to avoid dephase (thus, imposing 'gregorian' calendar) 25566 25566 gregtime = gen.impose_gregorian(timev0, uTunits, calendar)
Note: See TracChangeset
for help on using the changeset viewer.