larsbuntemeyer / xcmor

In-memory cmorization with xarray.

Home Page:https://xcmor.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

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.

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.

https://xcmor.readthedocs.io

License:Apache License 2.0


Languages

Language:Python 100.0%