Commit c844f704 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixed wrong output of transform_any_prj() in case of EPSG 4326. Updated...


Fixed wrong output of transform_any_prj() in case of EPSG 4326. Updated minimal version of pyproj to 2.2.0.
Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 75b7bd30
Pipeline #12129 failed with stages
in 18 minutes and 57 seconds
...@@ -24,7 +24,7 @@ test_py_tools_ds: ...@@ -24,7 +24,7 @@ test_py_tools_ds:
- source activate ci_env - source activate ci_env
- export GDAL_DATA=/root/miniconda3/envs/ci_env/share/gdal - export GDAL_DATA=/root/miniconda3/envs/ci_env/share/gdal
- export PYTHONPATH=$PYTHONPATH:/root # /root <- directory needed later - export PYTHONPATH=$PYTHONPATH:/root # /root <- directory needed later
- conda install -c conda-forge 'pyproj>=2.1' # FIXME remove as soon as docker container is rebuilt - conda install -c conda-forge 'pyproj>=2.2' # FIXME remove as soon as docker container is rebuilt
- make nosetests - make nosetests
- make docs - make docs
artifacts: artifacts:
......
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
History History
======= =======
0.15.3 (2020-09-21)
-------------------
* Fixed wrong output of transform_any_prj() in case of EPSG 4326.
* Updated minimal version of pyproj to 2.2.0.
0.15.2 (2020-08-27) 0.15.2 (2020-08-27)
------------------- -------------------
......
...@@ -70,7 +70,8 @@ def transform_any_prj(prj_src, prj_tgt, x, y): ...@@ -70,7 +70,8 @@ def transform_any_prj(prj_src, prj_tgt, x, y):
:return: :return:
""" """
transformer = pyproj.Transformer.from_crs(pyproj.CRS.from_user_input(prj_src), transformer = pyproj.Transformer.from_crs(pyproj.CRS.from_user_input(prj_src),
pyproj.CRS.from_user_input(prj_tgt)) pyproj.CRS.from_user_input(prj_tgt),
always_xy=True)
return transformer.transform(x, y) return transformer.transform(x, y)
......
...@@ -19,5 +19,5 @@ ...@@ -19,5 +19,5 @@
# You should have received a copy of the GNU Lesser General Public License along # You should have received a copy of the GNU Lesser General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>. # with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = '0.15.2' __version__ = '0.15.3'
__versionalias__ = '20200827_02' __versionalias__ = '20200901_01'
...@@ -37,7 +37,7 @@ with open("py_tools_ds/version.py") as version_file: ...@@ -37,7 +37,7 @@ with open("py_tools_ds/version.py") as version_file:
exec(version_file.read(), version) exec(version_file.read(), version)
requirements = ['gdal>=2.1.0', 'numpy', 'shapely', 'six', 'pandas', 'scikit-image>=0.16.0', 'geopandas', requirements = ['gdal>=2.1.0', 'numpy', 'shapely', 'six', 'pandas', 'scikit-image>=0.16.0', 'geopandas',
'pyproj>=2.1.0', 'spectral'] 'pyproj>=2.2.0', 'spectral']
setup_requirements = [] # TODO(danschef): put setup requirements (distutils extensions, etc.) here setup_requirements = [] # TODO(danschef): put setup requirements (distutils extensions, etc.) here
test_requirements = requirements + ["coverage", "nose", "nose2", "nose-htmloutput", "rednose"] test_requirements = requirements + ["coverage", "nose", "nose2", "nose-htmloutput", "rednose"]
......
...@@ -8,7 +8,7 @@ dependencies: ...@@ -8,7 +8,7 @@ dependencies:
- pip # avoids that conda uses the wrong pip - pip # avoids that conda uses the wrong pip
- numpy - numpy
- gdal>=2.1.0 - gdal>=2.1.0
- pyproj>=2.1.0 - pyproj>=2.2.0
- scikit-image>=0.16.0 - scikit-image>=0.16.0
- geopandas - geopandas
- pip: - pip:
......
...@@ -30,17 +30,29 @@ test_coord_trafo ...@@ -30,17 +30,29 @@ test_coord_trafo
Tests for `py_tools_ds.geo.coord_trafo` module. Tests for `py_tools_ds.geo.coord_trafo` module.
""" """
import unittest from unittest import TestCase
from shapely.geometry import Polygon from shapely.geometry import Polygon
from py_tools_ds.geo.coord_trafo import reproject_shapelyGeometry from py_tools_ds.geo.coord_trafo import reproject_shapelyGeometry, transform_any_prj
poly_local = Polygon([(5708.2, -3006), (5708, -3262), (5452, -3262), (5452, -3006), (5708, -3006)]) poly_local = Polygon([(5708.2, -3006), (5708, -3262), (5452, -3262), (5452, -3006), (5708, -3006)])
ll_x, ll_y = (10.701359, 47.54536)
utm_x, utm_y = (628023.1302739962, 5267173.503313034)
class Test_reproject_shapelyGeometry(unittest.TestCase):
class Test_reproject_shapelyGeometry(TestCase):
def test_reproject_shapelyGeometry(self): def test_reproject_shapelyGeometry(self):
poly_lonlat = reproject_shapelyGeometry(poly_local, 32636, 4326) poly_lonlat = reproject_shapelyGeometry(poly_local, 32636, 4326)
self.assertTrue(isinstance(poly_lonlat, Polygon)) self.assertTrue(isinstance(poly_lonlat, Polygon))
class Test_transform_any_prj(TestCase):
def test_lonlat_to_utm(self):
out_x, out_y = transform_any_prj(4326, 32632, ll_x, ll_y)
self.assertTrue(isinstance(out_x, float))
self.assertTrue(isinstance(out_y, float))
self.assertEqual((out_x, out_y), (utm_x, utm_y))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment