timedate Package

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

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)[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.

Returns :

jul : numpy.ndarray or double

Julian day.

Notes

  • no error handling implemented
  • works only for years past 1582
  • time not yet supported
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.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.

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

Convert a matplotlib date to a Julian days.

Parameters :

j : numpy.ndarray

Julian days.

Returns :

num : numpy.ndarray

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

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

Convert a Julian days to a matplotlib date.

Parameters :

n : numpy.ndarray

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

Returns :

j : numpy.ndarray

Julian days.

Table Of Contents

Previous topic

sat Package

This Page