Skip to content
Snippets Groups Projects

Maintenance/fix warnings

Merged Daniel Scheffler requested to merge maintenance/fix_warnings into main
3 files
+ 25
4
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -24,11 +24,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Union, Sequence, List
from warnings import catch_warnings, filterwarnings
import pyproj
import numpy as np
from shapely.ops import transform
from shapely.geometry.base import BaseGeometry
from typing import Union, Sequence, List
from osgeo import gdal, osr
__author__ = "Daniel Scheffler"
@@ -87,7 +89,12 @@ def transform_any_prj(prj_src: Union[str, int],
transformer = pyproj.Transformer.from_crs(pyproj.CRS.from_user_input(prj_src),
pyproj.CRS.from_user_input(prj_tgt),
always_xy=True)
return transformer.transform(x, y)
with catch_warnings():
# DeprecationWarning in pyproj 3.6.1 (future pyproj releases will fix this)
filterwarnings(
"ignore", category=DeprecationWarning, message=".*Conversion of an array with ndim > 0 to a scalar.*")
return transformer.transform(x, y)
def transform_coordArray(prj_src: str,
@@ -312,4 +319,9 @@ def reproject_shapelyGeometry(shapelyGeometry: BaseGeometry,
pyproj.CRS.from_user_input(prj_tgt),
always_xy=True)
return transform(project.transform, shapelyGeometry) # apply projection
with catch_warnings():
# DeprecationWarning in pyproj 3.6.1 (future pyproj releases will fix this)
filterwarnings(
"ignore", category=DeprecationWarning, message=".*Conversion of an array with ndim > 0 to a scalar.*")
return transform(project.transform, shapelyGeometry) # apply projection
Loading