Commit 9fe3cbef authored by Daniel Scheffler's avatar Daniel Scheffler

Replaced deprecated code in reproject_shapelyGeometry(). Fixed linting. Use...

Replaced deprecated code in reproject_shapelyGeometry(). Fixed linting. Use pyproj>2.1 for test_py_tools_ds CI job.
Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent b934a84f
Pipeline #11902 failed with stage
in 12 minutes and 45 seconds
......@@ -24,7 +24,7 @@ test_py_tools_ds:
- source activate ci_env
- export GDAL_DATA=/root/miniconda3/envs/ci_env/share/gdal
- export PYTHONPATH=$PYTHONPATH:/root # /root <- directory needed later
- conda update pyproj # FIXME remove as soon as docker container is rebuilt
- conda install -c conda-forge 'pyproj>=2.1' # FIXME remove as soon as docker container is rebuilt
- make nosetests
- make docs
artifacts:
......@@ -67,7 +67,7 @@ test_py_tools_ds_install:
# - conda config --set channel_priority strict # otherwise gdal or libgdal may be installed from defaults channel
# resolve some requirements with conda
- conda install --yes -q -c conda-forge numpy gdal pyproj>2.1.0 shapely geopandas
- conda install --yes -q -c conda-forge numpy gdal 'pyproj>=2.1.0' shapely geopandas
# run installer
- python setup.py install
......
......@@ -62,7 +62,7 @@ Using conda_, the recommended approach is:
# create virtual environment for py_tools_ds, this is optional
conda create -y -q -c conda-forge --name py_tools_ds python=3
source activate py_tools_ds
conda install -c conda-forge numpy gdal pyproj>2.1.0 shapely scikit-image pandas
conda install -c conda-forge numpy gdal 'pyproj>=2.1.0' shapely scikit-image pandas
Then install py_tools_ds using the pip installer:
......
......@@ -21,8 +21,6 @@
# 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/>.
from functools import partial
import pyproj
import numpy as np
from shapely.ops import transform
......@@ -35,8 +33,6 @@ except ImportError:
import osr
import gdal
from .projection import get_proj4info
__author__ = "Daniel Scheffler"
......@@ -306,8 +302,8 @@ def reproject_shapelyGeometry(shapelyGeometry, prj_src, prj_tgt):
:param prj_src: GDAL projection as WKT string or EPSG code ('epsg:1234' or <EPSG_int>)
:param prj_tgt: GDAL projection as WKT string or EPSG code ('epsg:1234' or <EPSG_int>)
"""
project = partial(pyproj.transform,
pyproj.CRS.from_user_input(prj_src),
pyproj.CRS.from_user_input(prj_tgt))
project = pyproj.Transformer.from_proj(
pyproj.CRS.from_user_input(prj_src),
pyproj.CRS.from_user_input(prj_tgt))
return transform(project, shapelyGeometry) # apply projection
return transform(project.transform, shapelyGeometry) # apply projection
......@@ -28,10 +28,8 @@ from typing import Union # noqa F401 # flake8 issue
# custom
try:
from osgeo import osr
from osgeo import gdal
except ImportError:
import osr
import gdal
from ..environment import gdal_env
......
......@@ -36,8 +36,8 @@ version = {}
with open("py_tools_ds/version.py") as version_file:
exec(version_file.read(), version)
requirements = ['gdal>=2.1.0', 'numpy', 'shapely', 'six', 'pandas', 'scikit-image>=0.16.0', 'geopandas', 'pyproj>2.1.0',
'spectral']
requirements = ['gdal>=2.1.0', 'numpy', 'shapely', 'six', 'pandas', 'scikit-image>=0.16.0', 'geopandas',
'pyproj>=2.1.0', 'spectral']
setup_requirements = [] # TODO(danschef): put setup requirements (distutils extensions, etc.) here
test_requirements = requirements + ["coverage", "nose", "nose2", "nose-htmloutput", "rednose"]
......
......@@ -10,7 +10,7 @@ dependencies:
- gdal>=2.1.0
- conda-forge::libgdal # force to use conda-forge for libgdal to avoid package version incompatiblies due to mixed channels (libkea.so.1.4.7: cannot open shared object file: No such file or directory)
# - kealib # fix for libkea.so.1.4.7: cannot open shared object file: No such file or directory (not needed as long as libgdal and gdal are conda-forge packages)
- pyproj>2.1.0
- pyproj>=2.1.0
- scikit-image>=0.16.0
- geopandas
- pip:
......
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