pytesmo.timedate.julian module
Most datetime functions from pytesmo are now in the cadati package Website: https://github.com/TUW-GEO/cadati To install cadati, run ‘pip install cadati’ This module will be removed in future versions of pytesmo
- pytesmo.timedate.julian.caldat(jd)[source]
Calendar date (month, day, year) from julian date, inverse of ‘julday()’ Return value: month, day, and year in the Gregorian calendar.
Adapted from “Numerical Recipes in C’, 2nd edition, pp. 11
Works only for years past 1582!
- Parameters:
jd (numpy.ndarray or float64) – 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.
- Returns:
day_of_year – Day of year.
- Return type:
numpy.ndarray or int32
- pytesmo.timedate.julian.is_leap_year(year)[source]
Check if year is a leap year.
- Parameters:
year (numpy.ndarray or int32) – Years.
- Returns:
leap_year – Returns true if year is a leap year.
- Return type:
numpy.ndarray or boolean
- pytesmo.timedate.julian.julday(month, day, year, hour=0, minute=0, second=0)[source]
Julian date from month, day, and year. Adapted from “Numerical Recipes in C’, 2nd edition, pp. 11
- 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:
jd – Julian day.
- Return type:
numpy.ndarray or float64
- pytesmo.timedate.julian.julian2datetime(jd, tz=None)[source]
Converts julian date to python datetime. Default is not time zone aware.
- Parameters:
julian (float64) – Julian date.
- Returns:
dt – Datetime object.
- Return type:
datetime