@@ -896,92 +896,6 @@ def _parse_date(datestring):
896896 int (groups ["hour" ]), int (groups ["minute" ]), int (groups ["second" ]),\
897897 tzoffset_mins
898898
899-
900- def date2num (dates , units , calendar = 'standard' ):
901- """
902- date2num(dates,units,calendar='standard')
903-
904- Return numeric time values given datetime objects. The units
905- of the numeric time values are described by the L{units} argument
906- and the L{calendar} keyword. The datetime objects must
907- be in UTC with no time-zone offset. If there is a
908- time-zone offset in C{units}, it will be applied to the
909- returned numeric values.
910-
911- Like the matplotlib C{date2num} function, except that it allows
912- for different units and calendars. Behaves the same if
913- C{units = 'days since 0001-01-01 00:00:00'} and
914- C{calendar = 'proleptic_gregorian'}.
915-
916- @param dates: A datetime object or a sequence of datetime objects.
917- The datetime objects should not include a time-zone offset.
918-
919- @param units: a string of the form C{'B{time units} since B{reference time}}'
920- describing the time units. B{C{time units}} can be days, hours, minutes
921- or seconds. B{C{reference time}} is the time origin. A valid choice
922- would be units=C{'hours since 1800-01-01 00:00:00 -6:00'}.
923-
924- @param calendar: describes the calendar used in the time calculations.
925- All the values currently defined in the U{CF metadata convention
926- <http://cf-pcmdi.llnl.gov/documents/cf-conventions/>} are supported.
927- Valid calendars C{'standard', 'gregorian', 'proleptic_gregorian'
928- 'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'}.
929- Default is C{'standard'}, which is a mixed Julian/Gregorian calendar.
930-
931- @return: a numeric time value, or an array of numeric time values.
932-
933- The maximum resolution of the numeric time values is 1 second.
934- """
935- cdftime = utime (units , calendar = calendar )
936- return cdftime .date2num (dates )
937-
938-
939- def num2date (times , units , calendar = 'standard' ):
940- """
941- num2date(times,units,calendar='standard')
942-
943- Return datetime objects given numeric time values. The units
944- of the numeric time values are described by the C{units} argument
945- and the C{calendar} keyword. The returned datetime objects represent
946- UTC with no time-zone offset, even if the specified
947- C{units} contain a time-zone offset.
948-
949- Like the matplotlib C{num2date} function, except that it allows
950- for different units and calendars. Behaves the same if
951- C{units = 'days since 001-01-01 00:00:00'} and
952- C{calendar = 'proleptic_gregorian'}.
953-
954- @param times: numeric time values. Maximum resolution is 1 second.
955-
956- @param units: a string of the form C{'B{time units} since B{reference time}}'
957- describing the time units. B{C{time units}} can be days, hours, minutes
958- or seconds. B{C{reference time}} is the time origin. A valid choice
959- would be units=C{'hours since 1800-01-01 00:00:00 -6:00'}.
960-
961- @param calendar: describes the calendar used in the time calculations.
962- All the values currently defined in the U{CF metadata convention
963- <http://cf-pcmdi.llnl.gov/documents/cf-conventions/>} are supported.
964- Valid calendars C{'standard', 'gregorian', 'proleptic_gregorian'
965- 'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'}.
966- Default is C{'standard'}, which is a mixed Julian/Gregorian calendar.
967-
968- @return: a datetime instance, or an array of datetime instances.
969-
970- The datetime instances returned are 'real' python datetime
971- objects if the date falls in the Gregorian calendar (i.e.
972- C{calendar='proleptic_gregorian'}, or C{calendar = 'standard'} or C{'gregorian'}
973- and the date is after 1582-10-15). Otherwise, they are 'phony' datetime
974- objects which support some but not all the methods of 'real' python
975- datetime objects. This is because the python datetime module cannot
976- the uses the C{'proleptic_gregorian'} calendar, even before the switch
977- occured from the Julian calendar in 1582. The datetime instances
978- do not contain a time-zone offset, even if the specified C{units}
979- contains one.
980- """
981- cdftime = utime (units , calendar = calendar )
982- return cdftime .num2date (times )
983-
984-
985899def _check_index (indices , times , nctime , calendar , select ):
986900 """Return True if the time indices given correspond to the given times,
987901 False otherwise.
0 commit comments