Skip to main content

Time-handling functionality from netcdf4-python

Project description

cftime

Time-handling functionality from netcdf4-python

Build status PyPI package Coverage Status Tag Status Release Status Commits Status DOI

News

For details on the latest updates, see the Changelog.

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, then python setup.py install (with sudo if necessary).

  • To run all the tests, execute py.test.

Documentation

See the online docs for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cftime-1.6.2.tar.gz (52.7 kB view details)

Uploaded Source

Built Distributions

cftime-1.6.2-cp311-cp311-win_amd64.whl (160.7 kB view details)

Uploaded CPython 3.11 Windows x86-64

cftime-1.6.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

cftime-1.6.2-cp311-cp311-macosx_11_0_arm64.whl (207.6 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

cftime-1.6.2-cp311-cp311-macosx_10_9_x86_64.whl (240.2 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

cftime-1.6.2-cp310-cp310-win_amd64.whl (162.7 kB view details)

Uploaded CPython 3.10 Windows x86-64

cftime-1.6.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

cftime-1.6.2-cp310-cp310-macosx_11_0_arm64.whl (212.6 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

cftime-1.6.2-cp310-cp310-macosx_10_9_x86_64.whl (246.1 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

cftime-1.6.2-cp39-cp39-win_amd64.whl (171.0 kB view details)

Uploaded CPython 3.9 Windows x86-64

cftime-1.6.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

cftime-1.6.2-cp39-cp39-macosx_11_0_arm64.whl (222.6 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

cftime-1.6.2-cp39-cp39-macosx_10_9_x86_64.whl (260.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

cftime-1.6.2-cp38-cp38-win_amd64.whl (171.3 kB view details)

Uploaded CPython 3.8 Windows x86-64

cftime-1.6.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

cftime-1.6.2-cp38-cp38-macosx_11_0_arm64.whl (215.7 kB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

cftime-1.6.2-cp38-cp38-macosx_10_9_x86_64.whl (251.8 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

cftime-1.6.2-cp37-none-win_amd64.whl (172.6 kB view details)

Uploaded CPython 3.7 Windows x86-64

cftime-1.6.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (257.7 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

cftime-1.6.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (263.3 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

cftime-1.6.2-cp37-cp37m-macosx_10_9_x86_64.whl (245.9 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file cftime-1.6.2.tar.gz.

File metadata

  • Download URL: cftime-1.6.2.tar.gz
  • Upload date:
  • Size: 52.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.25.0 setuptools/62.5.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.13

File hashes

Hashes for cftime-1.6.2.tar.gz
Algorithm Hash digest
SHA256 8614c00fb8a5046de304fdd86dbd224f99408185d7b245ac6628d0276596e6d2
MD5 1e80ad7c65ccfb717c26e04dc513fecb
BLAKE2b-256 cddbc528f26ee2dbac1dc348189386c2df745770bb22c02542e281d60212cb13

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: cftime-1.6.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 160.7 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for cftime-1.6.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 29c18601abea0fd160fbe423e05c7a56fe1d38dd250a6b010de499a132d3fe18
MD5 484ffabfbb0c116ec1906d43193bc0df
BLAKE2b-256 ea41f72df523dcf654bafd738657c11d81a44d2f4751b2951cdbbdcddc106d90

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cftime-1.6.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 455cec3627e6ca8694b0d9201da6581eb4381b58389f1fbcb51a14fa0e2b3d94
MD5 63be7ffd2a55cf7365e16be1eb3380b2
BLAKE2b-256 a30ec7b2fdd723b3c39a7146eebf55f870e1e39c02300be3dff653bad8392cb3

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cftime-1.6.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8d49d69c64cee2c175478eed84c3a57fce083da4ceebce16440f72be561a8489
MD5 47c1656bfef5d9e8ed7265c3f2778d89
BLAKE2b-256 22331b2ff517309fac61b0e35ac4bb41125588710bcf52bb292117a9948b7e9e

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for cftime-1.6.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 eb7f8cd0996640b83020133b5ef6b97fc9216c3129eaeeaca361abdff5d82166
MD5 7f7c879514c7381220bca3a61b868868
BLAKE2b-256 dbfdd14eb63dfe2fa008cd113e9fe4f6ff9546cece112ed1cdbf1ff161b03bb5

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: cftime-1.6.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 162.7 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for cftime-1.6.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2abdac6ca5b8b6102f319122546739dfc42406b816c16f2a98a8f0cd406d3bf0
MD5 218c03670a9587ad21b6389d132db232
BLAKE2b-256 354acfcc6ab75f374f6db32076a7cf1d3a7f693885398a5bbe59b716e53fda6e

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cftime-1.6.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 acb294fdb80e33545ae54b4421df35c4e578708a5ffce1c00408b2294e70ecef
MD5 33826a1abc8e52cb74fbf74d0d83a2cf
BLAKE2b-256 e117d8042d82f44c08549b535bf2e7d1e87aa1863df5ed6cf1cf773eb2dfdf67

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cftime-1.6.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2ba7909a0cd4adcb16797d8d6ab2767e7ddb980b2bf9dbabfc71b3bdd94f072b
MD5 d94f70cfe7d3a00d10a3b1ca358cd197
BLAKE2b-256 395a04f2150ab7fa76554bd92cab2afe7c20959f5b569b02014a414414054aa9

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for cftime-1.6.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b4d2a1920f0aad663f25700b30621ff64af373499e52b544da1148dd8c09409a
MD5 697bdcb0e07fc4204564defe2595b523
BLAKE2b-256 be32d91190495557f2efe55519fda9b12fe7f0cbd8355a28fa9475d6cf3df91f

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: cftime-1.6.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 171.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for cftime-1.6.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 86fe550b94525c327578a90b2e13418ca5ba6c636d5efe3edec310e631757eea
MD5 3df833897d6e61621808f3020bb67589
BLAKE2b-256 5fd65f59a5e5570c4414d94c6da4c97731deab832cbd14eaf23189d54a92d1e1

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cftime-1.6.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 892d5dc38f8b998c83a2a01f131e63896d020586de473e1878f9e85acc70ad44
MD5 e748e238a83ec5d832cff5ec3ec2af7c
BLAKE2b-256 a3843011fb0669c96db624e5984470296b07ce7098a3ba80f8afe4e4ac277e26

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cftime-1.6.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 07fdef2f75a0f0952b0376fa4cd08ef8a1dad3b963976ac07517811d434936b7
MD5 5c3639b6b68ed4a50da443191872bdb7
BLAKE2b-256 cc7673f3fb66faf324b836e5fc30ff1334128e388fc106d6adab2335464532b9

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for cftime-1.6.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0955e1f3e1c09a9e0296b50f135ff9719cb2466f81c8ad4a10ef06fa394de984
MD5 4e07a5f143e04a8fc1c72ed9b5109da4
BLAKE2b-256 cbebf9248e199edb9c7bed82a78bb37414c93bfe983be17027ae5409042fd747

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: cftime-1.6.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 171.3 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for cftime-1.6.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 055d5d60a756c6c1857cf84d77655bb707057bb6c4a4fbb104a550e76c40aad9
MD5 c4cb9cc587460882426f8c52469ec9d8
BLAKE2b-256 ffa9d901808b13e4e4f4dd31d44e30371f62669744b8bbb70739eae492ef0baf

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cftime-1.6.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 56d0242fc4990584b265622622b25bb262a178097711d2d95e53ef52a9d23e7e
MD5 43d72de8b3a90b035edc17d6f689b1ff
BLAKE2b-256 a82f86c12622d01c7f37466e70ffbf6af526c6ac0d2c1b5e1f91394db8fb7c51

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cftime-1.6.2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e83db2fdda900eb154a9f79dfb665ac6190781c61d2e18151996de5ee7ffd8a2
MD5 106d8ac6a88818f257a9790ae26545b9
BLAKE2b-256 14d858ca67658729801c18fcb34f02ef65dbc68f6e1a4a180951c57977c8305f

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for cftime-1.6.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 93f00f454329c1f2588ebca2650e8edf7607d6189dbdcc81b5f3be2080155cc4
MD5 b84413dc5054c54d95b18af32faabfd6
BLAKE2b-256 823d1dcd00d3b23abcb2e17520d12d2227d20e1b0e18642d83036691a2a4c426

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp37-none-win_amd64.whl.

File metadata

  • Download URL: cftime-1.6.2-cp37-none-win_amd64.whl
  • Upload date:
  • Size: 172.6 kB
  • Tags: CPython 3.7, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.25.0 setuptools/62.5.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.13

File hashes

Hashes for cftime-1.6.2-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 ee70fa069802652cf534de1dd3fc590b7d22d4127447bf96ac9849abcdadadf1
MD5 8e57becd5c2d8dfa22a900ef3b93d46f
BLAKE2b-256 778810730a1bb2d5e15b579c7aff8cd3b2e6e359988d66883210a4daf458db2f

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cftime-1.6.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aedfb7a783d19d7a30cb41951310f3bfe98f9f21fffc723c8af08a11962b0b17
MD5 8f5d27080bbe97af778ab252486b4523
BLAKE2b-256 79c67c0744fe4aa348bc5281f13c89e4b70e9dcfe62022403a092c970bdd99af

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for cftime-1.6.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 3042048324b4d6a1066c978ec78101effdd84320e8862bfdbf8122d7ad7588ec
MD5 2c264664011fae6338911478c83ebdab
BLAKE2b-256 7ac7565473b73aacfed6a7bb940e4839ae870387bd697097daecbcf9530e3a7a

See more details on using hashes here.

Provenance

File details

Details for the file cftime-1.6.2-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: cftime-1.6.2-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 245.9 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.25.0 setuptools/62.5.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.13

File hashes

Hashes for cftime-1.6.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 afb5b38b51b8bc02f1656a9f15c52b0b20a3999adbe1ab9ac57f926e0065b48a
MD5 ce400fc6d8dd81b4197e7fcba0147b74
BLAKE2b-256 469939fcc3697b37f1fcce8ce6c16d5a4d6a7647f3b08fd00a86cf4ecce051b6

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page