pytesmo.timedate package¶
Submodules¶
pytesmo.timedate.julian module¶
Created on Tue Apr 02 16:50:34 2013
@author: tm
computes julian date, given month (1..12). day(1..31) and year, its inverse (calendar date from julian), and the day of the year (doy), assuming it is a leap year.
julday and caldat are adapted from “Numerical Recipes in C’, 2nd edition, pp. 11
restrictions - no error handling implemented - works only for years past 1582 - time not yet supported
- pytesmo.timedate.julian.caldat(julian)[source]¶
Calendar date (month, day, year) from julian date, inverse of ‘julday()’ Return value: month, day, and year in the Gregorian Works only for years past 1582!
Parameters: julian : numpy.ndarray or double
Julian day.
Returns: month : numpy.ndarray or int32
Month.
day : numpy.ndarray or int32
Day.
year : numpy.ndarray or int32
Year.
- pytesmo.timedate.julian.doy(month, day, year=None)[source]¶
Calculation of day of year. If year is provided it will be tested for leap years.
Parameters: month : numpy.ndarray or int32
Month.
day : numpy.ndarray or int32
Day.
year : numpy.ndarray or int32, optional
Year.
- pytesmo.timedate.julian.is_leap_year(year)[source]¶
Check if year is a leap year.
Parameters: year : numpy.ndarray or int32
Returns: leap_year : numpy.ndarray or boolean
True if year is a leap year.
- pytesmo.timedate.julian.julday(month, day, year, hour=0, minute=0, second=0)[source]¶
Julian date from month, day, and year (can be scalars or arrays)
Parameters: month : numpy.ndarray or int32
Month.
day : numpy.ndarray or int32
Day.
year : numpy.ndarray or int32
Year.
hour : numpy.ndarray or int32, optional
Hour.
minute : numpy.ndarray or int32, optional
Minute.
second : numpy.ndarray or int32, optional
Second.
Returns: jul : numpy.ndarray or double
Julian day.
- pytesmo.timedate.julian.julian2date(julian)[source]¶
Calendar date from julian date. Works only for years past 1582!
Parameters: julian : numpy.ndarray or double
Julian day.
Returns: year : numpy.ndarray or int32
Year.
month : numpy.ndarray or int32
Month.
day : numpy.ndarray or int32
Day.
hour : numpy.ndarray or int32
Hour.
minute : numpy.ndarray or int32
Minute.
second : numpy.ndarray or int32
Second.
- pytesmo.timedate.julian.julian2datetime(julian, tz=None)[source]¶
converts julian date to python datetime default is not time zone aware
Parameters: julian : float
julian date
- pytesmo.timedate.julian.julian2datetimeindex(j, tz=<UTC>)[source]¶
Converting Julian days to datetimeindex.
Parameters: j : numpy.ndarray or int32
Julian days.
tz : instance of pytz, optional
Time zone. Default: UTC
Returns: datetime : pandas.DatetimeIndex
Datetime index.
- pytesmo.timedate.julian.julian2doy(j, consider_nonleap_years=True)[source]¶
Calendar date from julian date. Works only for years past 1582!
Parameters: j : numpy.ndarray or double
Julian days.
consider_nonleap_years : boolean, optional
Flag if all dates are interpreted as leap years (False) or not (True).
Returns: doy : numpy.ndarray or int32
Day of year.