diff --git a/Changelog b/Changelog
index e888a118..a6e89abd 100644
--- a/Changelog
+++ b/Changelog
@@ -1,5 +1,5 @@
-version 1.2.0 (not yet released)
-================================
+version 1.2.0 (release tag v1.2.0rel)
+=====================================
* Return the default values of dayofwk and dayofyr when calendar
is '' (issue #173).
* fix treatment of masked arrays in num2date and date2num (issue #175).
diff --git a/README.md b/README.md
index 97120da4..58b48b32 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,8 @@ Time-handling functionality from netcdf4-python
## News
For details on the latest updates, see the [Changelog](https://github.com/Unidata/cftime/blob/master/Changelog).
+7/06/2020: version 1.2.0 released. New microsecond accurate algorithm for date2num/num2date contributed by @spencerkclark. Bugs fixed in masked array handling.
+
5/12/2020: version 1.1.3 released. Add isoformat method for compatibility with python datetime (issue #152).
Make 'standard' default calendar for cftime.datetime so that dayofwk,dayofyr methods don't fail (issue #169).
diff --git a/docs/_build/doctrees/api.doctree b/docs/_build/doctrees/api.doctree
index df53611c..83961994 100644
Binary files a/docs/_build/doctrees/api.doctree and b/docs/_build/doctrees/api.doctree differ
diff --git a/docs/_build/doctrees/environment.pickle b/docs/_build/doctrees/environment.pickle
index b15f506b..9254b925 100644
Binary files a/docs/_build/doctrees/environment.pickle and b/docs/_build/doctrees/environment.pickle differ
diff --git a/docs/_build/doctrees/index.doctree b/docs/_build/doctrees/index.doctree
index 6cc8b525..d7e6696d 100644
Binary files a/docs/_build/doctrees/index.doctree and b/docs/_build/doctrees/index.doctree differ
diff --git a/docs/_build/doctrees/installing.doctree b/docs/_build/doctrees/installing.doctree
index ea991265..e12c409e 100644
Binary files a/docs/_build/doctrees/installing.doctree and b/docs/_build/doctrees/installing.doctree differ
diff --git a/docs/_build/html/.buildinfo b/docs/_build/html/.buildinfo
index e242cfe9..606024d5 100644
--- a/docs/_build/html/.buildinfo
+++ b/docs/_build/html/.buildinfo
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: f84fed7cc3841bb85e202f7b3dd39189
+config: 2629b59f89353a6a3eea208d9d747f2a
tags: 645f666f9bcd5a90fca523b33c5a78b7
diff --git a/docs/_build/html/_sources/installing.rst.txt b/docs/_build/html/_sources/installing.rst.txt
index 06fd7c57..2208e6d1 100644
--- a/docs/_build/html/_sources/installing.rst.txt
+++ b/docs/_build/html/_sources/installing.rst.txt
@@ -4,7 +4,7 @@ Installation
Required dependencies
---------------------
-- Python 2.7, 3.4, 3.5, or 3.6
+- Python: >3.2
- `numpy Bases: The base class implementing most methods of datetime classes that
mimic datetime.datetime but support calendars other than the proleptic
Gregorial calendar. Return a string representing the date, controlled by an explicit format
string. For a complete list of formatting directives, see section
‘strftime() and strptime() Behavior’ in the base Python documentation. Return a time.struct_time such as returned by time.localtime().
The DST flag is -1. d.timetuple() is equivalent to
time.struct_time((d.year, d.month, d.day, d.hour, d.minute,
@@ -73,73 +69,72 @@
Return numeric time values given datetime objects. The units
-of the numeric time values are described by the units argument
-and the calendar keyword. The datetime objects must
+of the numeric time values are described by the units argument
+and the calendar keyword. The datetime objects must
be in UTC with no time-zone offset. If there is a
-time-zone offset in units, it will be applied to the
+time-zone offset in units, it will be applied to the
returned numeric values. dates: A datetime object or a sequence of datetime objects.
+ `dates`: A datetime object or a sequence of datetime objects.
The datetime objects should not include a time-zone offset. units: a string of the form <time units> since <reference time>
-describing the time units. <time units> can be days, hours, minutes,
-seconds, milliseconds or microseconds. <reference time> is the time
-origin. months_since is allowed only for the 360_day calendar. calendar: describes the calendar used in the time calculations.
+ `units`: a string of the form <time units> since <reference time>
+describing the time units. <time units> can be days, hours, minutes,
+seconds, milliseconds or microseconds. <reference time> is the time
+origin. months_since is allowed only for the 360_day calendar. `calendar`: describes the calendar used in the time calculations.
All the values currently defined in the
[CF metadata convention](http://cfconventions.org)
-Valid calendars ‘standard’, ‘gregorian’, ‘proleptic_gregorian’
-‘noleap’, ‘365_day’, ‘360_day’, ‘julian’, ‘all_leap’, ‘366_day’.
-Default is ‘standard’, which is a mixed Julian/Gregorian calendar.","
"],col:[2,"
"],tr:[2,"","
"],td:[3,"
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n"," API¶
cftime.
datetime
(int year, int month, int day, int hour=0, int minute=0, int second=0, int microsecond=0, int dayofwk=-1, int dayofyr=-1, calendar='standard')¶cftime.
datetime
(int year, int month, int day, int hour=0, int minute=0, int second=0, int microsecond=0, int dayofwk=-1, int dayofyr=1)¶
object
-
-
isoformat
(self, sep='T', timespec='auto')¶
strftime
(self, format=None)¶strftime
(self, format=None)¶
timetuple
(self)¶timetuple
(self)¶
cftime.
date2num
(dates, units, calendar='standard')¶cftime.
date2num
(dates, units, calendar='standard')¶
returns a numeric time value, or an array of numeric time values -with approximately 1 microsecond accuracy.
+with approximately 100 microsecond accuracy.cftime.
num2date
(times, units, calendar='standard', only_use_cftime_datetimes=True, only_use_python_datetimes=False)¶Decode times exactly with timedelta arithmetic.
-Return datetime objects given numeric time values. The units
-of the numeric time values are described by the units argument
-and the calendar keyword. The returned datetime objects represent
+cftime.
num2date
(times, units, calendar='standard', only_use_cftime_datetimes=True, only_use_python_datetimes=False)¶
+
Return datetime objects given numeric time values. The units +of the numeric time values are described by the units argument +and the calendar keyword. The returned datetime objects represent UTC with no time-zone offset, even if the specified -units contain a time-zone offset.
-times: numeric time values.
-units: a string of the form <time units> since <reference time> -describing the time units. <time units> can be days, hours, minutes, -seconds, milliseconds or microseconds. <reference time> is the time -origin. months_since is allowed only for the 360_day calendar.
-calendar: describes the calendar used in the time calculations. +units contain a time-zone offset.
+`times`: numeric time values.
+`units`: a string of the form <time units> since <reference time> +describing the time units. <time units> can be days, hours, minutes, +seconds, milliseconds or microseconds. <reference time> is the time +origin. months_since is allowed only for the 360_day calendar.
+`calendar`: describes the calendar used in the time calculations. All the values currently defined in the [CF metadata convention](http://cfconventions.org) -Valid calendars ‘standard’, ‘gregorian’, ‘proleptic_gregorian’ -‘noleap’, ‘365_day’, ‘360_day’, ‘julian’, ‘all_leap’, ‘366_day’. -Default is ‘standard’, which is a mixed Julian/Gregorian calendar.
-only_use_cftime_datetimes: if False, python datetime.datetime +Valid calendars ‘standard’, ‘gregorian’, ‘proleptic_gregorian’ +‘noleap’, ‘365_day’, ‘360_day’, ‘julian’, ‘all_leap’, ‘366_day’. +Default is ‘standard’, which is a mixed Julian/Gregorian calendar.
+`only_use_cftime_datetimes`: if False, python datetime.datetime objects are returned from num2date where possible; if True dates which -subclass cftime.datetime are returned for all calendars. Default True.
-only_use_python_datetimes: always return python datetime.datetime +subclass cftime.datetime are returned for all calendars. Default True.
+`only_use_python_datetimes`: always return python datetime.datetime objects and raise an error if this is not possible. Ignored unless -only_use_cftime_datetimes=False. Default False.
+only_use_cftime_datetimes=False. Default False.returns a datetime instance, or an array of datetime instances with -microsecond accuracy, if possible.
+approximately 100 microsecond accuracy.*Note*: If only_use_cftime_datetimes=False and use_only_python_datetimes=False, the datetime instances returned are ‘real’ python datetime -objects if calendar=’proleptic_gregorian’, or -calendar=’standard’ or ‘gregorian’ +objects if calendar=’proleptic_gregorian’, or +calendar=’standard’ or ‘gregorian’ and the date is after the breakpoint between the Julian and Gregorian calendars (1582-10-15). Otherwise, they are ctime.datetime objects which support some but not all the methods of native python datetime objects. The datetime instances -do not contain a time-zone offset, even if the specified units +do not contain a time-zone offset, even if the specified units contains one.
cftime.
num2pydate
(times, units, calendar='standard')¶cftime.
num2pydate
(times, units, calendar='standard')¶
Always returns python datetime.datetime objects and raise an error if this is not possible.
Same as @@ -148,25 +143,25 @@
cftime.
date2index
(dates, nctime, calendar=None, select='exact')¶cftime.
date2index
(dates, nctime, calendar=None, select='exact')¶
Return indices of a netCDF time variable corresponding to the given dates.
-dates: A datetime object or a sequence of datetime objects. +
`dates`: A datetime object or a sequence of datetime objects. The datetime objects should not include a time-zone offset.
-nctime: A netCDF time variable object. The nctime object must have a -units attribute.
-calendar: describes the calendar used in the time calculations. +
`nctime`: A netCDF time variable object. The nctime object must have a +units attribute.
+`calendar`: describes the calendar used in the time calculations. All the values currently defined in the [CF metadata convention](http://cfconventions.org) -Valid calendars ‘standard’, ‘gregorian’, ‘proleptic_gregorian’ -‘noleap’, ‘365_day’, ‘360_day’, ‘julian’, ‘all_leap’, ‘366_day’. -Default is ‘standard’, which is a mixed Julian/Gregorian calendar. -If calendar is None, its value is given by nctime.calendar or -standard if no such attribute exists.
-select: ‘exact’, ‘before’, ‘after’, ‘nearest’ -The index selection method. exact will return the indices perfectly -matching the dates given. before and after will return the indices +Valid calendars ‘standard’, ‘gregorian’, ‘proleptic_gregorian’ +‘noleap’, ‘365_day’, ‘360_day’, ‘julian’, ‘all_leap’, ‘366_day’. +Default is ‘standard’, which is a mixed Julian/Gregorian calendar. +If calendar is None, its value is given by nctime.calendar or +standard if no such attribute exists.
+`select`: ‘exact’, ‘before’, ‘after’, ‘nearest’ +The index selection method. exact will return the indices perfectly +matching the dates given. before and after will return the indices corresponding to the dates just before or just after the given dates if -an exact match cannot be found. nearest will return the indices that +an exact match cannot be found. nearest will return the indices that correspond to the closest dates.
returns an index (indices) of the netCDF time variable corresponding to the given datetime object(s).
@@ -174,9 +169,8 @@cftime.
JulianDayFromDate
(date, calendar='standard')¶JulianDayFromDate(date, calendar=’standard’)
-creates a Julian Day from a ‘datetime-like’ object. Returns the fractional
+cftime.
JulianDayFromDate
(date, calendar='standard')¶
+
creates a Julian Day from a ‘datetime-like’ object. Returns the fractional Julian Day (approximately 100 microsecond accuracy).
if calendar=’standard’ or ‘gregorian’ (default), Julian day follows Julian Calendar on and before 1582-10-5, Gregorian calendar after 1582-10-15.
@@ -186,7 +180,7 @@cftime.
DatetimeJulian
(*args, **kwargs)¶cftime.
DatetimeJulian
(*args, **kwargs)¶
Bases: cftime._cftime.datetime
Phony datetime object which mimics the python datetime object, but uses the “julian” calendar.
@@ -194,7 +188,7 @@cftime.
DatetimeProlepticGregorian
(*args, **kwargs)¶cftime.
DatetimeProlepticGregorian
(*args, **kwargs)¶
Bases: cftime._cftime.datetime
Phony datetime object which mimics the python datetime object, but allows for dates that don’t exist in the proleptic gregorian calendar.
@@ -211,7 +205,7 @@cftime.
DatetimeNoLeap
(*args, **kwargs)¶cftime.
DatetimeNoLeap
(*args, **kwargs)¶
Bases: cftime._cftime.datetime
Phony datetime object which mimics the python datetime object, but uses the “noleap” (“365_day”) calendar.
@@ -219,7 +213,7 @@cftime.
DatetimeAllLeap
(*args, **kwargs)¶cftime.
DatetimeAllLeap
(*args, **kwargs)¶
Bases: cftime._cftime.datetime
Phony datetime object which mimics the python datetime object, but uses the “all_leap” (“366_day”) calendar.
@@ -227,7 +221,7 @@cftime.
DatetimeGregorian
(*args, **kwargs)¶cftime.
DatetimeGregorian
(*args, **kwargs)¶
Bases: cftime._cftime.datetime
Phony datetime object which mimics the python datetime object, but uses the mixed Julian-Gregorian (“standard”, “gregorian”) calendar.
@@ -241,7 +235,7 @@cftime.
DateFromJulianDay
(JD, calendar='standard', only_use_cftime_datetimes=True, return_tuple=False)¶cftime.
DateFromJulianDay
()¶
returns a ‘datetime-like’ object given Julian Day. Julian Day is a fractional day with approximately 100 microsecond accuracy.
if calendar=’standard’ or ‘gregorian’ (default), Julian day follows Julian @@ -257,19 +251,19 @@
cftime.
time2index
(times, nctime, calendar=None, select='exact')¶cftime.
time2index
(times, nctime, calendar=None, select='exact')¶
Return indices of a netCDF time variable corresponding to the given times.
-param times: A numeric time or a sequence of numeric times.
-nctime: A netCDF time variable object. The nctime object must have a +
@param times: A numeric time or a sequence of numeric times.
+@param nctime: A netCDF time variable object. The nctime object must have a C{units} attribute. The entries are assumed to be stored in increasing order.
-calendar: Describes the calendar used in the time calculation. +
@param calendar: Describes the calendar used in the time calculation. Valid calendars C{‘standard’, ‘gregorian’, ‘proleptic_gregorian’ ‘noleap’, ‘365_day’, ‘360_day’, ‘julian’, ‘all_leap’, ‘366_day’}. Default is C{‘standard’}, which is a mixed Julian/Gregorian calendar If C{calendar} is None, its value is given by C{nctime.calendar} or C{standard} if no such attribute exists.
-select: ‘exact’, ‘before’, ‘after’, ‘nearest’ +
@param select: C{‘exact’, ‘before’, ‘after’, ‘nearest’} The index selection method. C{exact} will return the indices perfectly matching the times given. C{before} and C{after} will return the indices corresponding to the times just before or just after the given times if @@ -310,23 +304,17 @@
- |
Related TopicsQuick search©2018, Jeff Whitaker. | - Powered by Sphinx 2.2.1 - & Alabaster 0.7.12 + Powered by Sphinx 1.7.6 + & Alabaster 0.7.11 diff --git a/docs/_build/html/index.html b/docs/_build/html/index.html index 5585e77e..65597d26 100644 --- a/docs/_build/html/index.html +++ b/docs/_build/html/index.html @@ -1,9 +1,11 @@ - + - + +Contents
Required dependencies¶
@@ -106,23 +107,17 @@
-
-
-
-
-
-
-
-
@@ -131,8 +126,8 @@ Related TopicsQuick search©2018, Jeff Whitaker. | - Powered by Sphinx 2.2.1 - & Alabaster 0.7.12 + Powered by Sphinx 1.7.6 + & Alabaster 0.7.11 | + - + +Related Topics- - - - - - - - @@ -110,8 +105,8 @@Quick search©2018, Jeff Whitaker. | - Powered by Sphinx 2.2.1 - & Alabaster 0.7.12 + Powered by Sphinx 1.7.6 + & Alabaster 0.7.11 diff --git a/docs/_build/html/search.html b/docs/_build/html/search.html index 21afd90e..122c4fdb 100644 --- a/docs/_build/html/search.html +++ b/docs/_build/html/search.html @@ -1,22 +1,26 @@ - + - + +Searchcontaining fewer words won't appear in the result list. |