Open philippkraft opened 1 year ago
@mdbartos I would suggest the following refactoring:
Move all duplicated pyproj helper code (_OLD_PYPROJ and _pyproj_init) in a seperated python module (projection.py). In that file, the default projection is defined as well as a function for transformation, which is called instead of pyproj.transform and has the same interface. For old pyproj (<2.6.1), the function just calls pyproj.transform (as now) for newer pyproj the function first creates an transformer object and calls it with the provided data.
Another question: is support for pyproj<2.2 (relase 04/2019) still necessary?
Hi,
thank you for the great package. When running pysheds 0.3.3 with pyproj 3.4.1 I get a warning:
According to the documentation of
pyproj.transform
calling this function is deprecated since pyproj 2.6.1. To fix it one need to change pysheds/sview.py:971 and all other occurences to something like:I have not tested it yet. This is also necessary for all other occurences of pyproj.transform:
https://github.com/mdbartos/pysheds/blob/9d960962bfe742c534da6577c3353169e6b6a501/pysheds/io.py#L117-L119
https://github.com/mdbartos/pysheds/blob/3b977e87f6c728c6b6b564c224aab3d448816967/pysheds/pgrid.py#L292-L294
https://github.com/mdbartos/pysheds/blob/1951f63f0a8971971ff98d2ea9d8b1d6a34cb266/pysheds/sview.py#L237-L238
And of course the original one:
https://github.com/mdbartos/pysheds/blob/1951f63f0a8971971ff98d2ea9d8b1d6a34cb266/pysheds/sview.py#L971-L972
I can submit a PR, if it helps.
Regards, Philipp