question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Keyword arguments to Proj() are silently ignored when projparams are specified

See original GitHub issue

I came across this when trying to initialize a Proj() and include geoidgrids:

proj = pyproj.Proj('EPSG:3162', geoidgrids='CGG2013an83.gtx')
proj.crs.is_vertical
>>> False

This is confusing. Why is it not taking my geoidgrids? Did I get the file name/path wrong?

Turns out the positional argument projparams is mutually exclusive with any passed **kwargs:

https://github.com/pyproj4/pyproj/blob/632c39818e77f8226bbec0db2a3fbe7fc02f7d33/pyproj/proj.py#L143

Yet there is no indication that this is not a valid way to initialize it.

In my opinion it should throw an exception, and it could perhaps be made clearer in the documentation as well. It’s a minor user experience thing, but still something I had to spend time troubleshooting. Happy to attempt a PR if others agree.

(stackexchange thread that spawned this)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
snowman2commented, Mar 9, 2020

Looks good. Mind adding a test for the CRS class as well?

0reactions
gberardinellicommented, Mar 9, 2020

I gave it a shot but I’m not really sure what I’m doing at this point, feels a bit kludgey. Tests in test_proj all pass…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change Log — pyproj 2.6.0 documentation - GitHub Pages
BUG: Don't silently ignore kwargs when projparams are specified (Proj & CRS) (issue #565) ... CoordinateSystem.from_json_dict() , and pyproj.crs.
Read more >
Including geoidgrids when initializing projection via EPSG
Proj() object with both an EPSG code and geoidgrids. For my specific use case with the grid file downloaded from here: epsg =...
Read more >
Unexpected kwargs error · Issue #3151 · dask/distributed
It appears that #3117 introduced a check for whether certain kwargs were used when initializing a Client. Previously, this sort of pattern ...
Read more >
How does one ignore unexpected keyword arguments passed ...
As an extension to the answer posted by @Bas, I would suggest to add the kwargs arguments (variable length keyword arguments) as the...
Read more >
map_proj_init.pro
MAP system variable is not affected by MAP_PROJ_INIT. ; ; KEYWORDS: ; DATUM: ... and parameters. for i=0,np-1 do begin projParams = STRSPLIT(projections[i], ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found