cftime
Time-handling functionality from netcdf4-python
Decision gist · record as of 2026-08-14
Yes. cftime is a stable, actively maintained library with no known vulnerabilities, permissive MIT licensing, and wide adoption in scientific computing (top 5000 PyPI packages). Install friction is moderate but well-mitigated by prebuilt wheels for all major platforms and Python versions. It is essential for anyone working with climate data, NetCDF files, or non-Gregorian calendars.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires numpy; Python 3.10 or later.
- Medium install friction due to compiled wheels; prebuilt binaries available for Python 3.10–3.14 on macOS, Linux, Windows, and ARM platforms.
- Last release 305 days ago; maintenance status is aging but the package is marked Production/Stable.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; no restrictions on commercial or private use, modification, or redistribution as long as the license and copyright notice are included.
last release 2025-10-13 (305 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,849,519 downloads/mo, #2,215 on PyPI
Alternatives
Verify before relying
pip install cftime
import cftime
import numpy
# Convert numeric time to datetime
times = cftime.num2date([0, 1, 2], units='days since reference', calendar='standard')
# Convert datetime back to numeric
nums = cftime.date2num(times, units='days since reference', calendar='standard')- Specific calendar systems supported beyond 'standard', 'gregorian', 'julian', 'proleptic_gregorian', '360_day', 'noleap', '365_day'.
- Whether performance improvements from earlier releases remain current in version 1.6.5.
What it is and what it does
cftime is a time-handling library extracted from netcdf4-python that specializes in converting between calendar dates and numeric time values for scientific data. It handles non-standard calendars like 360-day calendars used in climate models and real-world calendars with support for astronomical year numbering, including year zero. The package is built around two core functions: num2date converts numeric time values into cftime.datetime objects, and date2num does the reverse. It depends only on numpy.
The library is commonly used in climate science, weather modeling, and geophysical data processing where time must be represented in non-Gregorian or extended calendars. It provides a cftime.datetime class that mimics Python's standard datetime but extends it with calendar awareness and methods like toordinal, fromordinal, and change_calendar for switching between calendar systems. The package has been maintained since its first release in 2018, with recent versions adding support for modern Python versions.
Use it for
- Parse and convert NetCDF time coordinates in climate and weather datasets where non-standard calendars are used.
- Convert between 'days since' or 'seconds since' reference dates and human-readable dates for scientific data analysis.
- Handle astronomical year numbering and year-zero conventions in historical or extended-range climate simulations.
- Index and subset time-series data by converting date ranges to numeric time indices.
- Ensure consistent time representation across datasets with different calendar conventions in multi-model comparisons.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
cftime is a stable, actively maintained library with no known vulnerabilities, permissive MIT licensing, and wide adoption in scientific computing (top 5000 PyPI packages). Install friction is moderate but well-mitigated by prebuilt wheels for all major platforms and Python versions. It is essential for anyone working with climate data, NetCDF files, or non-Gregorian calendars.
Install
cftime on PyPI
Before you install
Medium install friction due to compiled wheels; prebuilt binaries available for Python 3.10–3.14 on macOS, Linux, Windows, and ARM platforms. Last release 305 days ago; maintenance status is aging but the package is marked Production/Stable.
Requires numpy; Python 3.10 or later.
License in practice
MIT license is permissive; no restrictions on commercial or private use, modification, or redistribution as long as the license and copyright notice are included.
Quickstart
pip install cftime
import cftime
import numpy
# Convert numeric time to datetime
times = cftime.num2date([0, 1, 2], units='days since reference', calendar='standard')
# Convert datetime back to numeric
nums = cftime.date2num(times, units='days since reference', calendar='standard')
Verify before relying
- Specific calendar systems supported beyond 'standard', 'gregorian', 'julian', 'proleptic_gregorian', '360_day', 'noleap', '365_day'.
- Whether performance improvements from earlier releases remain current in version 1.6.5.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 1 packagenumpy |
| Maintenance | Aging 305 days since the last release |
| First released | |
| Downloads | 4,849,519 / month, #2,215 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/Engineering |
Evidence: cftime-1.6.5-cp310-cp310-macosx_10_9_x86_64.whl; cftime-1.6.5-cp310-cp310-macosx_11_0_arm64.whl; cftime-1.6.5-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; cftime-1.6.5-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; cftime-1.6.5-cp310-cp310-musllinux_1_2_x86_64.whl; cftime-1.6.5-cp310-cp310-win_amd64.whl; cftime-1.6.5-cp311-cp311-macosx_10_9_x86_64.whl; cftime-1.6.5-cp311-cp311-macosx_11_0_arm64.whl; cftime-1.6.5-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; cftime-1.6.5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; cftime-1.6.5-cp311-cp311-musllinux_1_2_x86_64.whl; cftime-1.6.5-cp311-cp311-win_amd64.whl; cftime-1.6.5-cp311-cp311-win_arm64.whl; cftime-1.6.5-cp312-cp312-macosx_10_13_x86_64.whl; cftime-1.6.5-cp312-cp312-macosx_11_0_arm64.whl; cftime-1.6.5-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; cftime-1.6.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; cftime-1.6.5-cp312-cp312-musllinux_1_2_x86_64.whl; cftime-1.6.5-cp312-cp312-win_amd64.whl; cftime-1.6.5-cp312-cp312-win_arm64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “calendar date to numeric time conversion”
- cftimeConverts between calendar dates and numeric time values for…
- banglaConverts Gregorian dates to the Bengali calendar and translates…
- jdcalConverts between Julian dates and Gregorian or Julian calendar dates,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also nc-time-axis · netCDF4 · pyCalverter · jdcal · datetime-quarter · convertdate · fiscalyear · x-wr-timezone · zhdate · neotime