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:
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:
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

pytesmo.timedate.julian.julian2num(jd)[source]

Convert a matplotlib date to a Julian days.

Parameters:

jd (numpy.ndarray : int32) – Julian days.

Returns:

num – Number of days since 0001-01-01 00:00:00 UTC plus one.

Return type:

numpy.ndarray : int32

pytesmo.timedate.julian.num2julian(num)[source]

Convert a Julian days to a matplotlib date.

Parameters:

num (numpy.ndarray : int32) – Number of days since 0001-01-01 00:00:00 UTC plus one.

Returns:

jd – Julian days.

Return type:

numpy.ndarray : int32