[PROJ] Wrong geoidgrids no longer causing error

Szekeres István szekeres at iii.hu
Wed Feb 15 09:07:19 PST 2023


Hi,

could you pls help deciding if this is a bug or feature?

I want to move a piece of code from Python 3.10 to 3.11 and updating the
pyproj version made a unit test that tests for a failure not to work
anymore, as what was a failure before no longer seems to be it.

The code - note that geoidgrids egm96_25.gtx is intentionally wrong and
doesn't exist:

from pyproj import Transformer,CRS

crs_current = CRS.from_proj4('+proj=tmerc +lat_0=51 +lon_0=0 +k=1 +x_0=0
+y_0=0 +datum=WGS84 +units=m +geoidgrids=egm96_25.gtx +vunits=m +no_defs')
crs_4326 = CRS.from_epsg(4326)
transformer = Transformer.from_crs(crs_current, crs_4326, always_xy=True)

When running this piece of code in Python 3.10 + pyproj 3.3.1 (=proj 8.2.0)
results in an exception:

>>> transformer = Transformer.from_crs(crs_current, crs_4326,
always_xy=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/home/istvan/.local/lib/python3.10/site-packages/pyproj/transformer.py",
line 573, in from_crs
    return Transformer(
  File
"/home/istvan/.local/lib/python3.10/site-packages/pyproj/transformer.py",
line 310, in __init__
    self._local.transformer = transformer_maker()
  File
"/home/istvan/.local/lib/python3.10/site-packages/pyproj/transformer.py",
line 97, in __call__
    return _Transformer.from_crs(
  File "pyproj/_transformer.pyx", line 1003, in
pyproj._transformer._Transformer.from_crs
  File "pyproj/_transformer.pyx", line 1073, in
pyproj._transformer._Transformer._init_from_crs
  File "pyproj/_transformer.pyx", line 809, in
pyproj._transformer._Transformer._initialize_from_projobj
pyproj.exceptions.ProjError: Input is not a transformation.: (Internal Proj
Error: pipeline: Pipeline: Bad step definition: proj=vgridshift (File not
found or invalid))

Which is IMHO the right behaviour, as the given geoidgrids is wrong.

But when running with Python 3.11 and pyproj 3.4.1 (=proj 9.1.0) this
doesn't cause any exception and the returned transformer is happily
transforming coordinates.

Is this a bug or a feature? Shall I create a new issue in the tracker to
"restore" the old behavior - to make a wrong input result in an error?

Thanks,
Istvan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20230215/99234190/attachment.htm>


More information about the PROJ mailing list