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

Conversion to Python 2/3 inter-compatibility #3

Open darothen opened 7 years ago

darothen commented 7 years ago

These changes are the result of running the automatic 2to3 conversion scripts to the base PyGChem package. I had to tweak a few additional things, most notably the the inheritance behind FortranFile. But, this seems to work for most things! There are lot of ungainly imports that could be cleaned up and some hand-optimization (e.g. convert all the old_div function calls to //), but they're mostly cosmetic.

Needs testing and commentary / code review from someone more familiar with this package. This work is a base for the xarray backend WIP I'm about to register on the Issues board.

TODO

benbovy commented 7 years ago

Many thanks for opening this PR @darothen. Python 3 compatibility is definitely needed!

I will review this asap. Unfortunately, I'm not familiar with Python-Future, and there is no automated tests yet. But for now I think we just need to ensure that we can read GEOS-Chem bpch (and netcdf) files with the existing backends (iris and bpch) using both Python 2.7 and 3.4+.

darothen commented 7 years ago

Reading bpch seems to work okay - only a few tweaks were needed. I haven't yet tested compatibility with iris; it's been quite some time since I used that package (I'm fully on an xarray/cartopy stack these days) but this may be an excuse to do so. I'm going to edit the top-level comment of the Pull Request with some additional TODO items based on our e-mail thread.