JiaweiZhuang / xESMF

Universal Regridder for Geospatial Data
http://xesmf.readthedocs.io/
MIT License
269 stars 49 forks source link

xESMF python2 support? #12

Closed markcollier closed 6 years ago

markcollier commented 6 years ago

Looks like a great interface for a daunting package, esmf. I'm working towards migrating to python3 but is it possible to support both python2/3 with this package? I tried pip installing but it stopped as expected from your documentation. Thanks,

JiaweiZhuang commented 6 years ago

Thanks for asking. I am hesitant to support python2 because the entire scientific Python ecosystem is going to drop Python2 support. xESMF explicitly depends on Scipy, so that matters a lot for xESMF.

I'll keep this issue open. If too many people asking I might rethink about it.

markcollier commented 6 years ago

Yes fair enough. I'm now trying to move some of my code across to python3 as i really need your package, I have been working on a python approach myself for ESMFpy but nothing as sophisticated as yours. There are still quite a few things that are only possible to do currently under python2 but I will just separate these tasks. On another topic, with your curvilinear example, is it possible to provide an output mask and apply conservative weighting? At the moment it presumably tries to work out its own output land/sea mask which might not be as good as a explicitly defined one? This might be more reliable especially if interpolating from a range of differently defined curvilinear grids and analysis is wanting to be done on a consistent output grid. This is certainly possible under NCL ESMF. Thanks for your efforts, I suspect xESMF will become a popular package.

JiaweiZhuang commented 6 years ago

On another topic, with your curvilinear example, is it possible to provide an output mask and apply conservative weighting? At the moment it presumably tries to work out its own output land/sea mask which might not be as good as a explicitly defined one?

xESMF has no idea about land/sea mask. It just maps nan in the input data to nan in the output data. Say a destination point receives contributions from 4 source points, as long as 1 out of the 4 source points is nan, the total contributions will add up to nan (because any_number + nan = nan). If you don't want the contributions from the other 3 points to be corrupted bynan, you may set the 4th point to 0 instead of nan

I am not sure if I understand "provide an output mask and apply conservative weighting". Any concrete example? The 'conservative' method is area-weighted.

JiaweiZhuang commented 6 years ago

Since xarray is going to drop Python2 support (pydata/xarray#1830), I am not going to add Python2 support for xESMF.