def get_time_variable(ds):
    '''
    Returns the likeliest variable to be the time coordiante variable

    :param netCDF4.Dataset ds: An open netCDF4 Dataset
    '''
    for var in ds.variables:
        if getattr(ds.variables[var], 'axis', '') == 'T':
            return var
    else:
        candidates = ds.get_variables_by_attributes(standard_name='time')
        if len(candidates) == 1:
            return candidates[0].name
        else:  # Look for a coordinate variable time
            for candidate in candidates:
                if candidate.dimensions == (candidate.name,):
                    return candidate.name

    return None
def get_time_variable ( ds ) : for var in ds . variables : if getattr ( ds . variables [ var ] , 'axis' , '' ) == 'T' : return var else : candidates = ds . get_variables_by_attributes ( standard_name = 'time' ) if len ( candidates ) == 1 : return candidates [ 0 ] . name else : for candidate in candidates : if candidate . dimensions == ( candidate . name , ) : return candidate . name return None
Returns the likeliest variable to be the time coordiante variable

    :param netCDF4.Dataset ds: An open netCDF4 Dataset