Keyword arguments to Proj() are silently ignored when projparams are specified
See original GitHub issueI 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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Looks good. Mind adding a test for the CRS class as well?
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…