benbovy / PyGChem

A Python interface to the GEOS-Chem Model, a global 3-D chemical transport model (CTM) for atmospheric composition
GNU General Public License v3.0
10 stars 4 forks source link

WIP: xarray backend for BPCH files #4

Open darothen opened 7 years ago

darothen commented 7 years ago

I'm writing an xarray backend for reading BPCH files leveraging the machinery in PyGChem. I started out on a separate, standalone project, but I was ending up duplicating a good chunk of the tools already built into PyGChem for reading the binary Fortran output. So it made the most sense just to contribute to this package.

A working prototype can be found here. It efficiently creates DataStores, even from binary output with multiple timestamps. However, it can take a very long time to read the data into memory... I'm working on ways to defer that reading for a larger set of the default operations (e.g. inspecting the resulting Dataset you get when you open a file). Also, this has only been tested so far on sample output data.

Wishlist

benbovy commented 7 years ago

This is great! I've been thinking about an xarray backend for BPCH files for quite a while but I still haven't managed to find enough time to do that.

Feel free to open a PR if you wish, I'd be happy to help if needed!

Please note, however, that I left this package unmaintained and unreleased (the API is not yet fixed and some features are not yet functional). Much work should be done on cleaning some parts of the code, adding Python 3 compatibility (see your PR #3), checking the compatibility with the last versions of Iris, adding proper tests and CI, packaging, documentation, etc. IMO before considering adding new features.

darothen commented 7 years ago

I'd consider an xarray backend a core feature, since that completes the package's integration into a modern scientific Python stack. But I'll limit the backend work to just basic functionality for now.