Skip to content

Round-trip Albers fails with "point not within available datum shift grids" #704

@allencnm

Description

@allencnm

Code Sample, a copy-pastable example if possible

from pyproj import Transformer, CRS
from pyproj.enums import TransformDirection

lonlat = -74.9, 39.9
to_crs = CRS("esri:102003")
print(repr(to_crs))
tr = Transformer.from_crs("epsg:4326", to_crs, always_xy=True)
print(repr(tr))
albers_pt = tr.transform(*lonlat, errcheck=True)
print(f"Albers: {albers_pt}")
lonlat_rt = tr.transform(*albers_pt, errcheck=False, direction=TransformDirection.INVERSE)
print(f"Round trip: {lonlat} -> {lonlat_rt}")
lonlat_rt2 = tr.transform(*albers_pt, errcheck=True, direction=TransformDirection.INVERSE)

Problem description

When trying to do a round-trip from epsg:4326 to esri:102003 with errcheck=True, I get the following exception:

Traceback (most recent call last):
  File "gis_tst5.py", line 13, in <module>
    lonlat_rt2 = tr.transform(*albers_pt, errcheck=True, direction=TransformDirection.INVERSE)
  File "/opt/conda/lib/python3.8/site-packages/pyproj/transformer.py", line 430, in transform
    self._transformer._transform(
  File "pyproj/_transformer.pyx", line 487, in pyproj._transformer._Transformer._transform
pyproj.exceptions.ProjError: transform error: point not within available datum shift grids

The problem only occurs when using local proj-data or PROJ_NETWORK=ON. I also seem to get correct results when errcheck=False.
I'm guessing it's a PROJ problem, but I didn't know how to properly test it.

Expected Output

Something like the following, without throwing:

...
Round trip: (-74.9, 39.9) -> (-74.9, 39.900000000000006)

Environment Information

python -m pyproj -v
pyproj info:
    pyproj: 2.6.1.post1
      PROJ: 7.0.0
  data dir: /opt/conda/share/proj

System:
    python: 3.8.5 | packaged by conda-forge | (default, Jul 31 2020, 02:39:48)  [GCC 7.5.0]
executable: /opt/conda/bin/python
   machine: Linux-4.19.76-linuxkit-x86_64-with-glibc2.10

Python deps:
       pip: 20.2.2
setuptools: 49.6.0.post20200814
    Cython: 0.29.21

Installation method

conda

Conda environment information (if you installed with conda):


Environment (conda list):
$ conda list proj
# packages in environment at /opt/conda:
#
# Name                    Version                   Build  Channel
proj                      7.0.0                h966b41f_5    conda-forge
proj-data                 1.0                           1    conda-forge
pyproj                    2.6.1.post1      py38h7521cb9_0    conda-forge

Details about conda and system ( conda info ):
$ conda info

     active environment : base
    active env location : /opt/conda
            shell level : 1
       user config file : /home/jovyan/.condarc
 populated config files : /opt/conda/.condarc
                          /home/jovyan/.condarc
          conda version : 4.8.3
    conda-build version : 3.20.0
         python version : 3.8.5.final.0
       virtual packages : __glibc=2.31
       base environment : /opt/conda  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /opt/conda/pkgs
                          /home/jovyan/.conda/pkgs
       envs directories : /opt/conda/envs
                          /home/jovyan/.conda/envs
               platform : linux-64
             user-agent : conda/4.8.3 requests/2.24.0 CPython/3.8.5 Linux/4.19.76-linuxkit ubuntu/20.04.1 glibc/2.31
                UID:GID : 1000:100
             netrc file : None
           offline mode : False

Metadata

Metadata

Assignees

No one assigned

    Labels

    projBug or issue related to PROJ

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions