esmvaltool/diag_scripts/ocean/diagnostic_tools.py
def guess_calendar_datetime(cube):
    """Guess the cftime.datetime form to create datetimes."""
    time_coord = cube.coord('time')

    if time_coord.units.calendar in ['360_day', ]:
        datetime = cftime.Datetime360Day
    elif time_coord.units.calendar in ['365_day', 'noleap']:
        datetime = cftime.DatetimeNoLeap
    elif time_coord.units.calendar in ['julian', ]:
        datetime = cftime.DatetimeJulian
    elif time_coord.units.calendar in ['gregorian', ]:
        datetime = cftime.DatetimeGregorian
    elif time_coord.units.calendar in ['proleptic_gregorian', ]:
        datetime = cftime.DatetimeProlepticGregorian
    else:
        logger.warning('Calendar set to Gregorian, instead of %s',
                       time_coord.units.calendar)
        datetime = cftime.DatetimeGregorian
    return datetime
Guess the cftime.datetime form to create datetimes.
Guess the cftime.datetime form to create datetimes.
Guess the cftime . datetime form to create datetimes .
def guess_calendar_datetime(cube):
    time_coord = cube.coord('time')
    if time_coord.units.calendar in ['360_day', ]:
        datetime = cftime.Datetime360Day
    elif time_coord.units.calendar in ['365_day', 'noleap']:
        datetime = cftime.DatetimeNoLeap
    elif time_coord.units.calendar in ['julian', ]:
        datetime = cftime.DatetimeJulian
    elif time_coord.units.calendar in ['gregorian', ]:
        datetime = cftime.DatetimeGregorian
    elif time_coord.units.calendar in ['proleptic_gregorian', ]:
        datetime = cftime.DatetimeProlepticGregorian
    else:
        logger.warning('Calendar set to Gregorian, instead of %s',
                       time_coord.units.calendar)
        datetime = cftime.DatetimeGregorian
    return datetime
def guess_calendar_datetime ( cube ) : time_coord = cube . coord ( 'time' ) if time_coord . units . calendar in [ '360_day' , ] : datetime = cftime . Datetime360Day elif time_coord . units . calendar in [ '365_day' , 'noleap' ] : datetime = cftime . DatetimeNoLeap elif time_coord . units . calendar in [ 'julian' , ] : datetime = cftime . DatetimeJulian elif time_coord . units . calendar in [ 'gregorian' , ] : datetime = cftime . DatetimeGregorian elif time_coord . units . calendar in [ 'proleptic_gregorian' , ] : datetime = cftime . DatetimeProlepticGregorian else : logger . warning ( 'Calendar set to Gregorian, instead of %s' , time_coord . units . calendar ) datetime = cftime . DatetimeGregorian return datetime
Guess the cftime.datetime form to create datetimes.
Guess the cftime . datetime form to create datetimes .
"""Guess the cftime.datetime form to create datetimes."""
cube