Package netcdftime :: Module netcdftime
[hide private]
[frames] | no frames]

Module netcdftime

source code

Performs conversions of netCDF time coordinate data to/from datetime objects.

Classes [hide private]
  datetime
Phony datetime object which mimics the python datetime object, but allows for dates that don't exist in the proleptic gregorian calendar.
  utime
Performs conversions of netCDF time coordinate data to/from datetime objects.

Functions [hide private]
  DateFromJulianDay(JD, calendar='standard')
returns a 'datetime-like' object given Julian Day.
  JulianDayFromDate(date, calendar='standard')
creates a Julian Day from a 'datetime-like' object.
  _360DayFromDate(date)
creates a Julian Day for a calendar where all months have 30 daysfrom a 'datetime-like' object.
  _AllLeapFromDate(date)
creates a Julian Day for a calendar where all years have 366 days from a 'datetime-like' object.
  _DateFrom360Day(JD)
returns a 'datetime-like' object given Julian Day for a calendar where all months have 30 days.
  _DateFromAllLeap(JD)
returns a 'datetime-like' object given Julian Day for a calendar where all years have 366 days.
  _DateFromNoLeapDay(JD)
returns a 'datetime-like' object given Julian Day for a calendar with no leap days.
  _NoLeapDayFromDate(date)
creates a Julian Day for a calendar with no leap years from a datetime instance.
  _dateparse(timestr, format='%Y-%m-%d %H:%M:%S')
parse a string of the form time-units since yyyy-mm-dd hh:mm:ss return a tuple (units, datetimeinstance)

Variables [hide private]
  __version__ = '0.5.1'
  _calendars = ['standard', 'gregorian', 'proleptic_gregorian', 'no...
  _units = ['days', 'hours', 'minutes', 'seconds', 'day', 'hour...

Function Details [hide private]

DateFromJulianDay(JD, calendar='standard')

source code 

returns a 'datetime-like' object given Julian Day. Julian Day is a fractional day with a resolution of 1 second.

if calendar='standard' or 'gregorian' (default), Julian day follows Julian Calendar on and before 1582-10-5, Gregorian calendar after 1582-10-15.

if calendar='proleptic_gregorian', Julian Day follows gregorian calendar.

if calendar='julian', Julian Day follows julian calendar.

The datetime object is a 'real' datetime object if the date falls in the Gregorian calendar (i.e. calendar='proleptic_gregorian', or calendar = 'standard'/'gregorian' and the date is after 1582-10-15). Otherwise, it's a 'phony' datetime object which is actually an instance of netcdftime.datetime.

Algorithm:

Meeus, Jean (1998) Astronomical Algorithms (2nd Edition). Willmann-Bell, Virginia. p. 63

JulianDayFromDate(date, calendar='standard')

source code 

creates a Julian Day from a 'datetime-like' object. Returns the fractional Julian Day (resolution 1 second).

if calendar='standard' or 'gregorian' (default), Julian day follows Julian Calendar on and before 1582-10-5, Gregorian calendar after 1582-10-15.

if calendar='proleptic_gregorian', Julian Day follows gregorian calendar.

if calendar='julian', Julian Day follows julian calendar.

Algorithm:

Meeus, Jean (1998) Astronomical Algorithms (2nd Edition). Willmann-Bell, Virginia. p. 63

_360DayFromDate(date)

source code 
creates a Julian Day for a calendar where all months have 30 daysfrom a 'datetime-like' object. Returns the fractional Julian Day (resolution 1 second).

_AllLeapFromDate(date)

source code 
creates a Julian Day for a calendar where all years have 366 days from a 'datetime-like' object. Returns the fractional Julian Day (resolution 1 second).

_DateFrom360Day(JD)

source code 
returns a 'datetime-like' object given Julian Day for a calendar where all months have 30 days. Julian Day is a fractional day with a resolution of 1 second.

_DateFromAllLeap(JD)

source code 
returns a 'datetime-like' object given Julian Day for a calendar where all years have 366 days. Julian Day is a fractional day with a resolution of 1 second.

_DateFromNoLeapDay(JD)

source code 
returns a 'datetime-like' object given Julian Day for a calendar with no leap days. Julian Day is a fractional day with a resolution of 1 second.

_NoLeapDayFromDate(date)

source code 
creates a Julian Day for a calendar with no leap years from a datetime instance. Returns the fractional Julian Day (resolution 1 second).

_dateparse(timestr, format='%Y-%m-%d %H:%M:%S')

source code 
parse a string of the form time-units since yyyy-mm-dd hh:mm:ss return a tuple (units, datetimeinstance)

Variables Details [hide private]

__version__

None
Value:
'0.5.1'                                                                
      

_calendars

None
Value:
['standard',
 'gregorian',
 'proleptic_gregorian',
 'noleap',
 'julian',
 'all_leap',
 '365_day',
 '366_day',
...                                                                    
      

_units

None
Value:
['days', 'hours', 'minutes', 'seconds', 'day', 'hour', 'minute', 'seco
nd']