Time-handling functionality from netcdf4-python
Project description
cftime
Time-handling functionality from netcdf4-python
News
For details on the latest updates, see the Changelog.
6/7/2024: Version 1.6.4 release. Wheels for muslinux and aarch64, numpy 2.0 compatibility.
10/20/2023: Version 1.6.3 released. Support for python 3.12, cython 3.0, strptime formats without separators.
9/18/2022: Version 1.6.2 released. strptime method added, fix for num2date failure on empty integer array, date2num 'longdouble' keyword added. New wheel building workflow.
6/30/2022: Version 1.6.1 released. Fixes for numpy 1.23.0, updated CI/CD.
3/4/2022: Version 1.6.0 released. Big speed-ups for num2date, date2index bugfix for select != 'exact' when select='exact' works, fix for date2num with masked array inputs.
1/22/2022: Version 1.5.2 released (wheels for Apple M1 available on pypi for python 3.8,3.9 and 3.10). is_leap_year function added (issue #259).
10/31/2021: Version 1.5.1.1 released (new binary wheels for python 3.10).
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.
Added a 'change_calendar' cftime.datetime
method to switch to another
'real-world' calendar to enable comparison of instances with different calendars.
Some legacy classes and functions removed (utime
, JulianDayFromDate
and
DateFromJulianDay
). The functionality of JulianDayFromDate
and
DateFromJulianDay
is now available from the methods cftime.datetime.toordinal
and cftime.datetime.fromordinal
.
2/2/2021: Version 1.4.1 released. Restore use of calendar-specific subclasses
in cftime.num2date
, cftime.datetime.__add__
, and cftime.datetime.__sub__
.
The use of this will be removed in a later release.
Add 'fromordinal' static method to create a cftime.datetime instance
from a julian day ordinal and calendar (inverse of 'toordinal').
2/1/2021: Version 1.4.0 released. License changed to MIT (GPL'ed code replaced). Roundtrip accuracy improved for units other than microseconds. Added cftime.datetime.toordinal method, returns integer julian day number.
1/17/2021: Version 1.3.1 released.
11/16/2020: Version 1.3.0 released. API change: The cftime.datetime
constructor now creates
'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)
See discussion for 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__
.
The default calendar in cftime.date2num
has been changed from 'standard'
to None
(the calendar associated with first input datetime object is used to define the calendar).
07/20/2020: Version 1.2.1 released. Fixes a couple of regressions introduced in 1.2.0. See Changelog for details.
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).
4/20/2020: version 1.1.2 released. Code optimization, fix logic so only_use_cftime_datetimes=False
works as
expected (issues #158 and #165).
3/16/2020: version 1.1.1 released. Fix bug in microsecond formatting, ensure identical num2date results if input is an array of times, or a single scalar (issue #143).
2/12/2020: version 1.1.0 released. cftime.datetime
instances are returned by default from num2date
(instead of returning python datetime instances where possible (issue #136)). num2pydate
convenience function added (always returns python datetime instances, issue #134). Fix for
fraction seconds in reference date string (issue #140). Added daysinmonth
attribute
(issue #137).
10/25/2019: version 1.0.4.2 released (fix for issue #126).
10/21/2019: version 1.0.4 released.
12/05/2018: version 1.0.3.4 released (just to fix a problem with the source tarball on pypi).
12/05/2018: version 1.0.3.1 released. Bugfix release (fixed issue with installation when cython not installed, regression on 32-bit platforms, workaround for pandas compatibility).
12/01/2018: version 1.0.3 released. Test coverage with coveralls.io, improved round-tripping accuracy for non-real world calendars (like 360_day
).
10/27/2018: version 1.0.2 released. Improved accuracy (from approximately 1000 microseconds to 10 microseconds on x86
platforms). Refactored calendar calculations now allow for negative reference years. num2date function now more than an
order of magnitude faster. months since
units now allowed, but only for 360_day
calendar.
08/15/2018: version 1.0.1 released.
11/8/2016: cftime
was split out of the netcdf4-python package.
Quick Start
-
Clone GitHub repository (
git clone https://github.com/Unidata/cftime.git
), or get source tarball from PyPI. Links to Windows and OS X precompiled binary packages are also available on PyPI. -
Make sure numpy and Cython are installed and you have Python 2.7 or newer.
-
Run
python setup.py build
, thenpython setup.py install
(withsudo
if necessary). -
To run all the tests, execute
py.test
.
Documentation
See the online docs for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for cftime-1.6.4-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b5ad7559a16bedadb66af8e417b6805f758acb57aa38d2730844dfc63a1e667 |
|
MD5 | a0cd641c397003a6456fae951e202f41 |
|
BLAKE2b-256 | 1798ba5b4a2f37c6c88454b696dd5c7a4e76fc8bfd014364b47ddd7e2cec0fcd |
Hashes for cftime-1.6.4-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 567574df94d0de1101bb5da76e7fbc6eabfddeeb2eb8cf83286b3599a136bbf7 |
|
MD5 | d25022759919ddfa462d6c2a0654c0b4 |
|
BLAKE2b-256 | d824f83ad4c120cbf5aa0768be22f1e276edf2b6557a955cb0e04812f37fd075 |
Hashes for cftime-1.6.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f92f2e405eeda47b30ab6231d8b7d136a55f21034d394f93ade322d356948654 |
|
MD5 | db243485e8677ffe0c6d8c14ee3cc777 |
|
BLAKE2b-256 | 0456233d817ef571d778281f3d639049b342f6ff0bb4de4c5ee630befbd55319 |
Hashes for cftime-1.6.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e07b91b488570573bbeb6f815656a8974d13d15b2279c82de2927f4f692bbcd |
|
MD5 | c2b0f21b96da23f88178f268c689260e |
|
BLAKE2b-256 | 06933f730e0402034746b39d202a18abe72eb3d092dec882fb6e07df7703ac30 |
Hashes for cftime-1.6.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 588d073400798adc24ece759cd1cb24ef730f55d1f70e31a898e7686f9d763d8 |
|
MD5 | 6c5b2d5d520d892cb80563bbfa983877 |
|
BLAKE2b-256 | d9b71a9773d903a57946e29d878f1d2b0ddd6ddab81d59fc6d9913b8cadd099e |
Hashes for cftime-1.6.4-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c349a91fa7ac9ec50118b04a8746bdea967bd2fc525d87c776003040b8d3392 |
|
MD5 | 316b5757ee7c6ce398cc55be39ba0828 |
|
BLAKE2b-256 | 3e32ad5e2c596aec41caaec9cfa5e109f8db70f5489a69bd30d76d8b96de27c8 |
Hashes for cftime-1.6.4-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76b8f1e5d1e424accdf760a43e0a1793a7b640bab83cb067273d5c9dbb336c44 |
|
MD5 | 8af912ffcecb6b0cec476e421f680469 |
|
BLAKE2b-256 | 3aa891d5cad40336f74a9eb92dabdc3aa59f3ccf13864ddbc71080b024808d7b |
Hashes for cftime-1.6.4-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4f2cc0d5c6ffba9c5b0fd1ecd0c7c1c426d0be7b8de1480e2a9fb857c1905e9 |
|
MD5 | 956a260e1aa1984ad2d709e29f1ea506 |
|
BLAKE2b-256 | f2c9ec07fdb44a9f25cc46b75f4e7f73d8806abde4c632076f5971817d14dcb2 |
Hashes for cftime-1.6.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b47bf25195fb3889bbae34df0e80957eb69c48f66902f5d538c7a8ec34253f6 |
|
MD5 | bf4fc891d7105f84b109ffe34c07068f |
|
BLAKE2b-256 | 16fa68ce3e1cdc785739ce53f9659201768179f8ea6e912519c890aedcd794ff |
Hashes for cftime-1.6.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4dcb2a01d4e614437582af33b36db4fb441b7666758482864827a1f037d2b639 |
|
MD5 | 3f175a984158424f9c8b60107ed0400b |
|
BLAKE2b-256 | a80e274db35df3dec9cd033bce2b1921eb1287ea1273b1c512be15d53ecd554c |
Hashes for cftime-1.6.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03494e7b66a2fbb6b04e364ab67185130dee0ced660abac5c1559070571d143d |
|
MD5 | dcc15af18f7d910bb2c9e5b9665ee26c |
|
BLAKE2b-256 | 7fec8333fb2229a3efd17f59a7fcc295c09cce8db3dd956de58c20f55926b533 |
Hashes for cftime-1.6.4-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1558d9b477bd29626cd8bfc89e736635f72887d1a993e2834ab579bba7abb8c |
|
MD5 | e2deb15a34e6cd0be2fea7b875b558df |
|
BLAKE2b-256 | 727658f3ca717bcbd669dca114256e5376298de20932ece46ee2c846ceef4f13 |
Hashes for cftime-1.6.4-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fc82928cbf477bebf233f41914e64bff7b9e894c7f0c34170784a48250f8da7 |
|
MD5 | 0ebb3f141d64117163c390c4181c0f70 |
|
BLAKE2b-256 | 4863e6bb7e9b127d2d88a08dd18225ba7816a373e00e85d221563db9f9baf005 |
Hashes for cftime-1.6.4-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca1a264570e68fbb611bba251641b8efd0cf88c0ad2dcab5fa784df264232b75 |
|
MD5 | dc53714ddd9faf8bdf7ea074db5ae55c |
|
BLAKE2b-256 | 61b04a260ef28d4928cd15f63786e0f779dbf185ac4c9c93d6cd174f87a6cd3f |
Hashes for cftime-1.6.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18b132d9225b4a109929866200846c72302316db9069e2de3ec8d8ec377f567f |
|
MD5 | bc213afb9bd03c65ce486dc5cb9480ad |
|
BLAKE2b-256 | 569bb020a7fac001782d9a71e25b4702084c3a5d5bdaa73ca3e4f3516e196746 |
Hashes for cftime-1.6.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1289e08617be350a6b26c6e4352a0cb088625ac33d25e95110df549c26d6ab8e |
|
MD5 | dfa13265caa8895734a411ae750153a6 |
|
BLAKE2b-256 | 29545b80f25f36a31981871bf5c29a8bb176f9cad9e13571400b97e1156d55d3 |
Hashes for cftime-1.6.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5456fd58d4cc6b8d7b4932b749617ee142b62a52bc5d8e3c282ce69ce3a20ba |
|
MD5 | 0961740c2d4e69de94e32b3070b701b7 |
|
BLAKE2b-256 | d950781f3480d92e88e3934bf243968afecdd61c26cb76d21cde4c8857b562a5 |
Hashes for cftime-1.6.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee70074df4bae0d9ee98f201cf5f11fd302791cf1cdeb73c34f685d6b632e17d |
|
MD5 | fec6ffd6db3126c60af80c87f505fa8b |
|
BLAKE2b-256 | 39ea4b7b2d3bf9474627875f63eca37aa94622881adc68e75f5acf107571e8e2 |
Hashes for cftime-1.6.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8467b6fbf8dbfe0be8c04d61180765fdd3b9ab0fe51313a0bbf87e63634a3d8 |
|
MD5 | 6a20c228d622ff388f8e41e07be724f7 |
|
BLAKE2b-256 | 851abb71b93d83524b7a829a04c99736ec1a93d03d1f931207c1d9eeaf5833be |
Hashes for cftime-1.6.4-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9acc272df1022f24fe7dbe9de43fa5d8271985161df14549e4d8d28c90dc9ea |
|
MD5 | 1c663e1d6e2ccf71b3c92ef8f690474b |
|
BLAKE2b-256 | 1a3eaab712c3b240248f01df46a5dbc5c6298953f529a5dd658734e9068c123f |
Hashes for cftime-1.6.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25f043703e785de0bd7cd8222c0a53317e9aeb3dfc062588b05e6f3ebb007468 |
|
MD5 | 365bb2d8e8ba155eeb9b69cc13c2b8eb |
|
BLAKE2b-256 | e73dbf2d058e272828338f40be26ab262e19a67264e687fde9327b87fbe52900 |
Hashes for cftime-1.6.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbe11ad73b2a0ddc79995da21459fc2a3fd6b1593ca73f00a60e4d81c3e230f3 |
|
MD5 | dc0af3b8fb88f7713fee2d98d647ee16 |
|
BLAKE2b-256 | e19ec6de11b037c7c1928bfdd71e96033854854bd51c18a40cd7cc273b2aedb4 |
Hashes for cftime-1.6.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90609b3c1a31a756a68ecdbc961a4ce0b22c1620f166c8dabfa3a4c337ac8b9e |
|
MD5 | d088e37ce39bdb1a84f2690d3ff15c30 |
|
BLAKE2b-256 | a137ee4a8ea2d853e4163be7c05271c563d7db97053044fca190a1e0f379513c |
Hashes for cftime-1.6.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c20f03e12af39534c3450bba376272803bfb850b5ce6433c839bfaa99f8d835a |
|
MD5 | f3679176f3b453c2004651eeb72f09a5 |
|
BLAKE2b-256 | 9307f276b1d9afc627e0a171615a9052eef38fde1e884ed6700246d98db24941 |
Hashes for cftime-1.6.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b32ac1278a2a111b066d5a1e6e5ce6f38c4c505993a6a3130873b56f99d7b56f |
|
MD5 | a312be4780bcb14b54fa7dd918d1adb8 |
|
BLAKE2b-256 | 6adf2c418f10f78ada789e2bcbcd309dd9ffa3e2e5563efc500655d6642abd97 |
Hashes for cftime-1.6.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8f05d5d6bb4137f9783fa61ad330030fcea8dcc6946dea69a27774edbe480e7 |
|
MD5 | 9e94f1b6c10df40087bef5eda1f496f0 |
|
BLAKE2b-256 | 0ca13f5474de3b5a6cf0bcd65e12acd348649dfbb16f02b1fe8cb82103907af9 |
Hashes for cftime-1.6.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0edeb1cb019d8155b2513cffb96749c0d7d459370e69bdf03077e0bee214aed8 |
|
MD5 | 437b3061597b59e43bb7443778293eb6 |
|
BLAKE2b-256 | c0ab0ffcfb9b8d44ef120cf72b5ec490bd2002b7be9fd11dba2ce5b71dcd7781 |
Hashes for cftime-1.6.4-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c05a71389f53d6340cb365b60f028c08268c72401660b9ef76108dee9f1cb5b2 |
|
MD5 | 622f5e3daaef551a7815b7190f384fa8 |
|
BLAKE2b-256 | 261914edb30f2ffedbb363663efc8c9c36abc16f0878330c0a01c49ba09f4c84 |
Hashes for cftime-1.6.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c072fe9e09925af66a9473edf5752ca1890ba752e7c1935d1f0245ad48f0977c |
|
MD5 | 8b596e6d97afb39d5668c74e343049b4 |
|
BLAKE2b-256 | 9daa7c5168a7a36af60822aa2c8facfd5d95f2fc15bfd539b53f6c572a76d46f |