Skip to main content

Tool to homogenize netCDF files to CF standard

Project description

Homogenize NetCDF files to CF standard: pyhomogenize


Python Package Index Build

Documentation and Support

Documentation Status Supported Python Versions

Open Source

License DOI

Coding Standards

Python Black status

Development Status

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Build Status Coveralls

Tool to homogenize netCDF to CF standard files using xarray



The official documentation is at


  • some useful functions to read and write large netCDF files

  • basics: This class creates a fixed frequency CFTimeIndex from user-given start and end dates. You can manipulate the CFTimeIndex and crop it to user-specific conditions.

  • netcdf_basics: This class opens one or multiple netCDF files by calling the class. You can manipulate the netCDF attributes and write it to a new file.

  • time_control: This class is a time checker for NetCDF files following CF Metadata Conventions. It is based on pyhomogenize’s netcdf_basics class. Thus it opens the netCDF files by calling the class.

  • time_compare: This class compares the time axes of list entires of multiple xr.datasets, netCDF files and/or time_control objects.


You can install the package directly with pip:

pip install pyhomogenize

If you want to contribute, I recommend cloning the repository and installing the package in development mode, e.g.

git clone
cd pyhomogenize
pip install -e .

This will install the package but you can still edit it and you don’t need the package in your PYTHONPATH


  • python3.6 or higher

  • cftime

  • dask

  • iteration_utilities

  • xarray


In cases of any problems, needs or wishes do not hesitate to contact:


This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.


0.1.0 (2020-11-12)

  • First release on PyPI.

0.1.1 (2022-06-24)

  • Fixed bug in version number

0.1.2 (2022-06-24)

  • bug fixed

0.1.3 (2022-06-24)

  • Read version number from __init__

0.1.4 (2022-06-24)

  • Expand HISTORY.rst

0.2.0 (2022-06-30)

  • Outsource useful functions for reading and writing large netCDF files.

  • Use those functiosn directly from pyhomogenize.

  • Calling pyhomogenize classes is not needed.

0.2.1 (2022-07-01)

  • rename save_to_netcdf to save_xrdataset

  • write input files to ds attributes

0.2.2 (2022-07-05)

  • create chunks if not already existing

0.2.3 (2022-07-11)

  • write CF variables to dataset while calling open_xrdataset

0.2.4 (2022-07-12)

  • add data via pip install

0.2.5 (2023-01-04)

  • precise mid of time range

  • add more dependencies (cftime, netcdf4, h5netcdf)

0.2.6 (2023-01-24)

  • add decode_times and combine as keyword argumnets to open_xrdataset

  • set default value of parallel in open_xrdataset to False

0.2.7 (2023-02-03)

  • save_xrdataset is now working if Dataset does not include time

0.2.8 (2023-02-13)

  • convert time axis to CFTimeIndex

0.2.9 (2023-02-16)

  • set proleptic_gregorian to standard calendar

0.3.0 (2023-02-22)

  • calculate time_bnds and add them to dataset

0.3.1 (2023-03-16)

  • get CF_variables

0.3.2 (2023-03-22)

  • read and write data with length of time axis is 1

  • add time bounds with length of time axis is 1

  • drop coordinates from non CF variables

0.3.3 (2023-03-23)

  • testing for python version 3.8, 3.9 and 3.10

0.4.0 (2023-03-23)

  • published on zenodo

0.5.0 (2023-06-13)

  • add time bounds if length of time axis is 1

  • convert np.datetime64 object to CFTimeIndex

0.5.1 (2023-06-14

  • fixing v0.5.1

0.5.2 (2023-06-30)

  • convert time axis to cftime.datetime object

  • open_xrdataset: set decode_cf to parameters

0.5.3 (2023-07-19)

  • some restructuring in _convert_time

0.5.4 (2023-08-02)

  • use unlimied_dims only if dimension name in ds.coords when saving dataset as netcdf file

0.6.0 (2023-09-14)

  • remove Sphinx from requirements_dev.txt

  • new frequency time2: YY1-07-01 - YY2-06-30

  • convert time_ranges to CFTimeIndex

  • make time_control more flexible

  • new frequency: yearAC (yyyy1-07-01 to yyyy2-06-30)

  • new_frequency: yearHydro (yyyy1-09-01 to yyyy2-08-31)

0.6.1 (2023-10-04)

  • add time bounds for daily data

  • testing python versions 3.9 to 3.11

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

pyhomogenize-0.6.1.tar.gz (34.6 MB view hashes)

Uploaded source

Built Distribution

pyhomogenize-0.6.1-py3-none-any.whl (34.7 MB view hashes)

Uploaded py3

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