Skip to content

Commit

Permalink
Merge pull request #254 from Unidata/v1.5.1rel
Browse files Browse the repository at this point in the history
prepare for 1.5.1 release
  • Loading branch information
jswhit authored Sep 24, 2021
2 parents 897003e + e37c3cf commit 334895d
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 83 deletions.
7 changes: 4 additions & 3 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ version 1.5.1 (not yet released)
* '360_day' was missing from list of 'idealized' calendars.
* fixed a bug that led to subclasses losing their type identity upon
pickling (issue #251, PR #252).
* Change default behavior of proleptic_gregorian to has_year_zero=T to
conform to upcoming changes in CF v1.9 (PR #238). Issue warning when trying
to create a cftime.datetime instance that is not allowed in CF.
* Change default behavior of proleptic_gregorian to has_year_zero=T
(to be consistent with ISO-8601 since CF does not specify the year zero convention
for this calendar). Issue warning when trying to
to create a cftime.datetime instance that is not allowed in CF (PR #238).


version 1.5.0 (release tag v1.5.0.rel)
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ Time-handling functionality from netcdf4-python
## News
For details on the latest updates, see the [Changelog](https://github.com/Unidata/cftime/blob/master/Changelog).

10/1/2021: Version 1.5.1 released. Changed default behavior of ``proleptic_gregorian``
to has_year_zero=T (since it is allowed in ISO-8601 and CF does not specify the
year zero convention for this calendar). Raise warning message when trying
to create a calendar that is not supported by CF version 1.9 (no years < 1
allowed for 'standard'/'gregorian' or 'julian' calendars).
Added support for "common_year" and "common_years" units for "noleap"
and "365_day" calendars.

5/20/2021: Version 1.5.0 released. Includes support for astronomical year numbering
(including the year zero) for real-world calendars ('julian', 'gregorian'/'standard',
and 'proleptic_gregorian') using 'has_year_zero' `cftime.datetime` kwarg.
Expand Down
Binary file modified docs/_build/doctrees/api.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/installing.doctree
Binary file not shown.
18 changes: 12 additions & 6 deletions docs/_build/html/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

<title>API &#8212; cftime 1.0 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
Expand All @@ -31,7 +32,7 @@

<div class="body" role="main">

<div class="section" id="module-cftime">
<section id="module-cftime">
<span id="api"></span><h1>API<a class="headerlink" href="#module-cftime" title="Permalink to this headline"></a></h1>
<dl class="py function">
<dt id="cftime.date2index">
Expand Down Expand Up @@ -87,7 +88,8 @@
<p><strong>units</strong>: a string of the form <strong>&lt;time units&gt; since &lt;reference time&gt;</strong>
describing the time units. <strong>&lt;time units&gt;</strong> can be days, hours, minutes,
seconds, milliseconds or microseconds. <strong>&lt;reference time&gt;</strong> is the time
origin. <strong>months_since</strong> is allowed <em>only</em> for the <strong>360_day</strong> calendar.</p>
origin. <strong>months since</strong> is allowed <em>only</em> for the <strong>360_day</strong> calendar
and <strong>common_years since</strong> is allowed <em>only</em> for the <strong>365_day</strong> calendar.</p>
<p><strong>calendar</strong>: describes the calendar to be used in the time calculations.
All the values currently defined in the
<a class="reference external" href="http://cfconventions.org/cf-conventions/cf-conventions#calendar">CF metadata convention</a> are supported.
Expand All @@ -103,6 +105,9 @@
CF version 1.9 conventions (False for ‘julian’, ‘gregorian’/’standard’, True
for ‘proleptic_gregorian’ (ISO 8601) and True for the idealized
calendars ‘noleap’/’365_day’, ‘360_day’, 366_day’/’all_leap’)
Note that CF v1.9 does not specifically mention whether year zero
is allowed in the proleptic_gregorian calendar, but ISO-8601 has
a year zero so we have adopted this as the default.
The defaults can only be over-ridden for the real-world calendars,
for the the idealized calendars the year zero
always exists and the has_year_zero kwarg is ignored.
Expand Down Expand Up @@ -202,7 +207,7 @@
<dd><p>Return (integer) julian day ordinal.</p>
<p>Day 0 starts at noon January 1 of the year -4713 for the
julian, gregorian and standard calendars (year -4712 if year
zero allowd).</p>
zero allowed).</p>
<p>Day 0 starts at noon on November 24 of the year -4714 for the
proleptic gregorian calendar (year -4713 if year zero allowed).</p>
<p>Day 0 starts at noon on January 1 of the year zero is for the
Expand All @@ -225,7 +230,8 @@
<p><strong>units</strong>: a string of the form <strong>&lt;time units&gt; since &lt;reference time&gt;</strong>
describing the time units. <strong>&lt;time units&gt;</strong> can be days, hours, minutes,
seconds, milliseconds or microseconds. <strong>&lt;reference time&gt;</strong> is the time
origin. <strong>months_since</strong> is allowed <em>only</em> for the <strong>360_day</strong> calendar.</p>
origin. <strong>months since</strong> is allowed <em>only</em> for the <strong>360_day</strong> calendar
and <strong>common_years since</strong> is allowed <em>only</em> for the <strong>365_day</strong> calendar.</p>
<p><strong>calendar</strong>: describes the calendar used in the time calculations.
All the values currently defined in the
<a class="reference external" href="http://cfconventions.org/cf-conventions/cf-conventions#calendar">CF metadata convention</a> are supported.
Expand Down Expand Up @@ -297,7 +303,7 @@
correspond to the closest times.</p>
</dd></dl>

</div>
</section>


</div>
Expand Down
19 changes: 10 additions & 9 deletions docs/_build/html/installing.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

<title>Installation &#8212; cftime 1.0 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
Expand Down Expand Up @@ -32,16 +33,16 @@

<div class="body" role="main">

<div class="section" id="installation">
<section id="installation">
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this headline"></a></h1>
<div class="section" id="required-dependencies">
<section id="required-dependencies">
<h2>Required dependencies<a class="headerlink" href="#required-dependencies" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li><p>Python: &gt;3.2</p></li>
<li><p><a class="reference external" href="http://www.numpy.org/">numpy</a> (1.7 or later)</p></li>
</ul>
</div>
<div class="section" id="instructions">
</section>
<section id="instructions">
<h2>Instructions<a class="headerlink" href="#instructions" title="Permalink to this headline"></a></h2>
<p>The easiest way to get everything installed is to use <a class="reference external" href="http://conda.io/">conda</a> command line tool:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ conda install cftime
Expand All @@ -58,16 +59,16 @@ <h2>Instructions<a class="headerlink" href="#instructions" title="Permalink to t
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ pip install cftime
</pre></div>
</div>
</div>
<div class="section" id="developing">
</section>
<section id="developing">
<h2>Developing<a class="headerlink" href="#developing" title="Permalink to this headline"></a></h2>
<p>When developing we recommend cloning the GitHub repository,
building the extension in-place with <a class="reference external" href="http://cython.org/">cython</a> 0.19 or later
<code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">build_ext</span> <span class="pre">--inplace</span></code></p>
<p>and running the test suite to check if the changes are passing the tests
<code class="docutils literal notranslate"><span class="pre">pytest</span> <span class="pre">--pyargs</span> <span class="pre">test</span></code></p>
</div>
</div>
</section>
</section>


</div>
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.

12 changes: 9 additions & 3 deletions src/cftime/_cftime.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ def date2num(dates,units,calendar=None,has_year_zero=None):
CF version 1.9 conventions (False for 'julian', 'gregorian'/'standard', True
for 'proleptic_gregorian' (ISO 8601) and True for the idealized
calendars 'noleap'/'365_day', '360_day', 366_day'/'all_leap')
Note that CF v1.9 does not specifically mention whether year zero
is allowed in the proleptic_gregorian calendar, but ISO-8601 has
a year zero so we have adopted this as the default.
The defaults can only be over-ridden for the real-world calendars,
for the the idealized calendars the year zero
always exists and the has_year_zero kwarg is ignored.
Expand Down Expand Up @@ -1029,9 +1032,12 @@ The default format of the string produced by strftime is controlled by self.form
has_year_zero=True
else:
has_year_zero = _year_zero_defaults(calendar)
# warn if requested date not allowed by CF.
if (calendar in ['julian','gregorian','standard'] and year <= 0) or\
(calendar == 'proleptic_gregorian' and not has_year_zero and year < 1):
# warn if requested date not allowed by CF
# (no years < 1 in mixed Julian/Gregorian calendar).
# CF version 1.9 does not specify whether a year zero should exist
# for the proleptic_gregorian calendar. IS0 8601 uses proleptic_gregorian
# and has a year zero, so for now this is the default in cftime.
if calendar in ['julian','gregorian','standard'] and year <= 0:
warnings.warn(cfwarnmsg,category=CFWarning)
# raise exception if year zero requested but has_year_zero set
# to False (issue #248).
Expand Down
Loading

0 comments on commit 334895d

Please sign in to comment.