Changeset 2481 in lmdz_wrf for trunk


Ignore:
Timestamp:
Apr 29, 2019, 7:18:15 PM (6 years ago)
Author:
lfita
Message:

Adding '365_day' as noleap calendar

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic_tools.py

    r2480 r2481  
    937937              * leap years: 'leap', '365d', 'gregorian', 'Gregorian', 'standard',
    938938                'Standard'
    939               * no-leap years: 'noleap', '360d'
     939              * no-leap years: 'noleap', '360d', '365d', '365_day'
    940940        'matYmdHMS': numerical vector with [[YYYY], [MM], [DD], [HH], [MI], [SS]]
    941941        'YmdHMS': [YYYY][MM][DD][HH][MI][SS] format
     
    976976    availcftimeu = ['weeks', 'days', 'hours', 'minutes', 'seconds', 'milliseconds']
    977977    availcalendar = ['leap', '366d', 'gregorian', 'Gregorian', 'standard',           \
    978       'Standard', 'noleap', '365d', '360d', 'proleptic_gregorian']
     978      'Standard', 'noleap', '365d', '365_day', '360d', 'proleptic_gregorian']
    979979
    980980    if type(StringDT) == type('S') and StringDT[0:1] == 'h':
     
    10711071
    10721072        removeleap = False
    1073         if calendar == 'noleap' or calendar == '365d':
     1073        if calendar == 'noleap' or calendar == '365d' or calendar == '365_day':
    10741074            newdate = advance_cfDate(refdate, timeval, tunits)
    10751075            if int(yrref) <= newdate.year:
     
    12901290            totsecs = difft.days()*24*3600. + difft.seconds()
    12911291
    1292         if calendar == 'noleap' or calendar == '365d':
     1292        if calendar == 'noleap' or calendar == '365d' or calendar == '365_day':
    12931293            removeleap = False
    12941294            if int(yrref) <= datei.year:
     
    12991299            totsecs = totsecs-Nleapd*24*3600.
    13001300
    1301         if calendar == 'noleap' or calendar == '365d':
     1301        if calendar == 'noleap' or calendar == '365d' or calendar == '365_day':
    13021302            removeleap = False
    13031303            if days_month(datei.year,2) == 29:
     
    22342234
    22352235    availTu = ['weeks', 'days', 'hours', 'minutes', 'seconds']
    2236     availcalendar = ['noleap', '365d']
     2236    availcalendar = ['noleap', '365d', '365_day']
    22372237
    22382238    lTunits = Tunits.split(' ')
     
    22872287
    22882288    yrref = refdate.year
    2289     if cal == 'noleap' or cal == '365d':
     2289    if cal == 'noleap' or cal == '365d' or cal == '365_day':
    22902290        for it in range(dimt):
    22912291            # Some issues in implementations/machines ...
     
    23342334
    23352335    availTu = ['weeks', 'days', 'hours', 'minutes', 'seconds']
    2336     availcalendar = ['noleap', '365d']
     2336    availcalendar = ['noleap', '365d', '365_day']
    23372337
    23382338    lTunits = Tunits.split(' ')
     
    23882388
    23892389    yrref = refdate[0]
    2390     if cal == 'noleap' or cal == '365d':
     2390    if cal == 'noleap' or cal == '365d' or cal == '365_day':
    23912391        for it in range(dimt):
    23922392            tdays = refdays + timevdays[it]
     
    24432443
    24442444    # 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':
    24462446        timev = impose_gregorian(timeval, tu + ' since ' + daterefS, cal)
    24472447    else:
     
    25892589    if tcalendar is not None:
    25902590      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':
    25922592          print '    netCDFdatetime_realdatetime: No leap years!'
    25932593          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':
    25952596          isleapcal = True
    25962597      elif tcalendar == '360_day':
     
    25992600      else:
    26002601          print errormsg
    2601           print '    netCDFdatetime_realdatetime: Calendar "' + tcalendar + '" not prepared!'
     2602          print '    netCDFdatetime_realdatetime: Calendar "' + tcalendar +          \
     2603            '" not prepared!'
    26022604          quit(-1)
    26032605
     
    54325434    if tcalendar is not None:
    54335435      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':
    54355437          print '    netCDFdatetime_realdatetime: No leap years!'
    54365438          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':
    54385441          isleapcal = True
    54395442      elif tcalendar == '360_day':
     
    1633916342
    1634016343    # 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':
    1634216345        print '  ' + fname + ": found non-standard calendar '" + origcal + "' !!"
    1634316346        # Imposing to gregorian calendar
  • trunk/tools/nc_var_tools.py

    r2480 r2481  
    2556225562        quit(-1)
    2556325563   
    25564     if calendar == 'noleap' or calendar == '365d':
     25564    if calendar == 'noleap' or calendar == '365d' or calendar == '365_day' :
    2556525565        # Adding leap days to avoid dephase (thus, imposing 'gregorian' calendar)
    2556625566        gregtime = gen.impose_gregorian(timev0, uTunits, calendar)
Note: See TracChangeset for help on using the changeset viewer.