def get_outtime(cls, intime): from pygeode.timeaxis import SeasonalTAxes from pygeode.timeutils import _uniquify try: SeasonalAxis = SeasonalTAxes[intime.__class__] except: raise NotImplemented( 'Seasonal Time axis not implemented for this calendar') # Wrap in axis with a seasonal axis to allow reduction outax = SeasonalAxis(values = intime.values, \ startdate = intime.startdate, \ units = intime.units) if 'year' in outax.auxarrays: fields = [outax.auxarrays['year'], outax.auxarrays['season']] fields = _uniquify(fields) auxarrays = {'year': fields[0], 'season': fields[1]} else: fields = [outax.auxarrays['season']] fields = _uniquify(fields) auxarrays = {'season': fields[0]} return SeasonalAxis(startdate=intime.startdate, units=intime.units, **auxarrays)
def get_outtime (cls, intime): from pygeode.timeaxis import SeasonalTAxes from pygeode.timeutils import _uniquify try: SeasonalAxis = SeasonalTAxes[intime.__class__] except: raise NotImplemented('Seasonal Time axis not implemented for this calendar') # Wrap in axis with a seasonal axis to allow reduction outax = SeasonalAxis(values = intime.values, \ startdate = intime.startdate, \ units = intime.units) if 'year' in outax.auxarrays: fields = [outax.auxarrays['year'], outax.auxarrays['season']] fields = _uniquify(fields) auxarrays = {'year':fields[0], 'season':fields[1]} else: fields = [outax.auxarrays['season']] fields = _uniquify(fields) auxarrays = {'season':fields[0]} return SeasonalAxis (startdate=intime.startdate, units=intime.units, **auxarrays)
def _uniquify (fields): from pygeode import timeutils from warnings import warn warn ("Deprecated. Use timeutils module.") return timeutils._uniquify(fields)