Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for issue #198 (take 3) #202

Merged
merged 37 commits into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
165bc9b
have cftime.datetime return calendar-aware instances (don't use
jswhit Sep 27, 2020
6a13f66
update
jswhit Sep 27, 2020
f851679
fix bugs in __add__
jswhit Sep 27, 2020
1e12091
'no_leap' --> 'noleap'
jswhit Sep 27, 2020
e9c2366
support calendar='' for backward compatibility
jswhit Sep 27, 2020
4f22f9e
update
jswhit Sep 28, 2020
dfbd627
update
jswhit Sep 28, 2020
f06d280
bug fix for proleptic_gregorian
jswhit Sep 28, 2020
5a77c68
update
jswhit Sep 28, 2020
0d2d1ff
update
jswhit Sep 28, 2020
d35e8fd
update
jswhit Sep 28, 2020
0a0cf80
update
jswhit Sep 28, 2020
000b69c
update
jswhit Sep 28, 2020
d79d68f
update docstrings
jswhit Sep 28, 2020
717fc57
bump version number, update Changelog and docstrings.
jswhit Sep 28, 2020
f92546f
fix typo
jswhit Sep 28, 2020
f534831
update docstring
jswhit Sep 28, 2020
9211fc5
add test for issue #198
jswhit Sep 28, 2020
fe5d170
update docs
jswhit Sep 29, 2020
97e430c
have __add__ and __sub__ return calendar-specific sub-classes as before
jswhit Sep 30, 2020
e5cd1b2
update
jswhit Sep 30, 2020
49e4217
update
jswhit Sep 30, 2020
b576fc2
add hooks to allow year zero in real-world calendars (currently disab…
jswhit Sep 30, 2020
c762797
more hooks for year zero
jswhit Oct 1, 2020
a6768e8
fix typo
jswhit Oct 9, 2020
b2892d4
change default calendar in cftime.datetime to None (same as '')
jswhit Oct 14, 2020
cc16287
update __repr__ so it works with calendar=None
jswhit Oct 14, 2020
e252660
fix repr test
jswhit Oct 14, 2020
40fee16
change default calendar back to 'standard'
jswhit Oct 15, 2020
3d3e5b7
update test_repr
jswhit Oct 15, 2020
bb37f96
update
jswhit Oct 15, 2020
e74b794
update
jswhit Oct 16, 2020
3d70c7d
update
jswhit Oct 16, 2020
34bf8c2
update
jswhit Oct 16, 2020
77a2922
update
jswhit Oct 16, 2020
d783ffa
update
jswhit Oct 16, 2020
411390a
remove commented out lines
jswhit Oct 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
since version 1.2.1
===================
version 1.3.0 (release tag v1.3.0rel)
=====================================
* zero pad years in strtime (issue #194)
* have cftime.datetime constuctor create 'calendar-aware' instances (default is
'standard' calendar, if calendar='' or None the instance is not calendar aware and some
methods, like dayofwk, dayofyr, __add__ and __sub__, will not work). Fixes issue #198.
The calendar specific sub-classes are now deprecated, but remain for now
as stubs that just instantiate the base class and override __repr__.

version 1.2.1 (release tag v1.2.1rel)
=====================================
Expand Down
493 changes: 307 additions & 186 deletions cftime/_cftime.pyx

Large diffs are not rendered by default.

Binary file modified docs/_build/doctrees/api.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
43 changes: 31 additions & 12 deletions docs/_build/html/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,28 @@
<dt id="cftime.datetime">
<em class="property">class </em><code class="sig-prename descclassname">cftime.</code><code class="sig-name descname">datetime</code><span class="sig-paren">(</span><em class="sig-param">int year</em>, <em class="sig-param">int month</em>, <em class="sig-param">int day</em>, <em class="sig-param">int hour=0</em>, <em class="sig-param">int minute=0</em>, <em class="sig-param">int second=0</em>, <em class="sig-param">int microsecond=0</em>, <em class="sig-param">int dayofwk=-1</em>, <em class="sig-param">int dayofyr=-1</em>, <em class="sig-param">calendar='standard'</em><span class="sig-paren">)</span><a class="headerlink" href="#cftime.datetime" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>The base class implementing most methods of datetime classes that
mimic datetime.datetime but support calendars other than the proleptic
Gregorial calendar.</p>
<p>This class mimics datetime.datetime but support calendars other than the proleptic
Gregorian calendar.</p>
<p>Supports timedelta operations by overloading +/-, and
comparisons with other instances using the same calendar.</p>
<p>Comparison with native python datetime instances is possible
for cftime.datetime instances using
‘gregorian’ and ‘proleptic_gregorian’ calendars.</p>
<p>All the calendars currently defined in the
[CF metadata convention](<a class="reference external" href="http://cfconventions.org">http://cfconventions.org</a>) are supported.
Valid calendars are ‘standard’, ‘gregorian’, ‘proleptic_gregorian’
‘noleap’, ‘365_day’, ‘360_day’, ‘julian’, ‘all_leap’, ‘366_day’.
Default is ‘standard’, which is a mixed Julian/Gregorian calendar.
‘standard’ and ‘gregorian’ are synonyms, as are ‘all_leap’/’366_day’
and ‘noleap’/’365_day’.</p>
<p>If the calendar kwarg is set to a blank string (‘’) the
instance will not be calendar-aware and some methods will not work.</p>
<p>Has isoformat, strftime, timetuple, replace, dayofwk, dayofyr, daysinmonth,
__repr__, __add__, __sub__, __str__ and comparison methods.</p>
<p>dayofwk, dayofyr, daysinmonth, __add__ and __sub__ only work for calendar-aware
instances.</p>
<p>The default format of the string produced by strftime is controlled by self.format
(default %Y-%m-%d %H:%M:%S).</p>
<dl class="method">
<dt id="cftime.datetime.isoformat">
<code class="sig-name descname">isoformat</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">sep='T'</em>, <em class="sig-param">timespec='auto'</em><span class="sig-paren">)</span><a class="headerlink" href="#cftime.datetime.isoformat" title="Permalink to this definition">¶</a></dt>
Expand Down Expand Up @@ -260,19 +279,19 @@
<dd><p>Return indices of a netCDF time variable corresponding to the given times.</p>
<p><strong>times</strong>: A numeric time or a sequence of numeric times.</p>
<p><strong>nctime</strong>: A netCDF time variable object. The nctime object must have a
C{units} attribute. The entries are assumed to be stored in increasing
<cite>units</cite> attribute. The entries are assumed to be stored in increasing
order.</p>
<p><strong>calendar</strong>: 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.</p>
Valid calendars ‘standard’, ‘gregorian’, ‘proleptic_gregorian’
‘noleap’, ‘365_day’, ‘360_day’, ‘julian’, ‘all_leap’, ‘366_day’.
Default is <cite>standard</cite>, which is a mixed Julian/Gregorian calendar
If <cite>calendar</cite> is None, its value is given by <cite>nctime.calendar</cite> or
<cite>standard</cite> if no such attribute exists.</p>
<p><strong>select</strong>: <strong>‘exact’, ‘before’, ‘after’, ‘nearest’</strong>
The index selection method. C{exact} will return the indices perfectly
matching the times given. C{before} and C{after} will return the indices
The index selection method. <cite>exact</cite> will return the indices perfectly
matching the times given. <cite>before</cite> and <cite>after</cite> will return the indices
corresponding to the times just before or just after the given times if
an exact match cannot be found. C{nearest} will return the indices that
an exact match cannot be found. <cite>nearest</cite> will return the indices that
correspond to the closest times.</p>
</dd></dl>

Expand Down
2 changes: 1 addition & 1 deletion docs/_build/html/searchindex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading