Skip to content

larsbuntemeyer/xcmor

Repository files navigation

xcmor

! 🚧 UNDER CONSTRUCTION !

CI https://codecov.io/gh/larsbuntemeyer/xcmor/branch/main/graph/badge.svg?token=YW7PBUTMZ6 pre-commit.ci status Documentation Status binder

Lazy in-memory cmorization with xarray.

Motivation

This package aims at implementing a climate model output rewriter (cmor) tool based on xarray. Actually, the process of cmorization mostly deals with making climate model output data compliant with the Climate and Weather Forecast meta data conventions (CF-conventions) and, in most cases, does not really touch the data itself. This makes it ideal for handling cmorization with xarray data structures since they allow easy manipulation of meta data using python dictionaries. Furthermore, xcmor heavily relies on cf_xarray under the hood to try to make cmorization as easy as possible.

While the original cmor library offers a wide variety of APIs for different programming languages (including python) to rewrite climate model output to NetCDF files, xcmor focuses more on lazy cmorization in memory without neccessarily having to actually rewrite the dataset to a filesystem. However, this is, of course, also possible using xarrays versatile IO features.

Features

  • Handling of bounds variables if neccessary.
  • Easy handling of cmor tables and its interpretation.
  • Handling of auxilliary coordinates and grid mappings.

Example

from xcmor import Cmorizer
from xcmor.datasets import reg_ds

cmor = Cmorizer()
ds_out = cmor.cmorize(
    reg_ds.rename(temperature="tas").tas, "Amon", cmor.tables["input_example"]
)

About

In-memory cmorization with xarray.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages