Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After pip upgrade to satpy 0.12 and pyproj 2.0.1 got pyproj.exceptions.CRSError #641

Closed
TAlonglong opened this issue Mar 11, 2019 · 11 comments
Labels
Milestone

Comments

@TAlonglong
Copy link
Collaborator

TAlonglong commented Mar 11, 2019

After pip upgrade to satpy 0.12 and pyproj 2.0.1 I get the following:

Traceback (most recent call last):
  File "process-modis-products.py", line 121, in <module>
    bb_area = sd.compute_optimal_bb_area()
  File "/software/pytroll/lib/python3.5/site-packages/pyresample/geometry.py", line 625, in compute_optimal_bb_area
    proj_dict = self.compute_bb_proj_params(proj_dict)
  File "/software/pytroll/lib/python3.5/site-packages/pyresample/geometry.py", line 602, in compute_bb_proj_params
    return self._compute_omerc_parameters(ellipsoid)
  File "/software/pytroll/lib/python3.5/site-packages/pyresample/geometry.py", line 560, in _compute_omerc_parameters
    lonc, lat0 = Proj(**proj_dict2points)(0, 0, inverse=True)
  File "/software/pytroll/lib/python3.5/site-packages/pyproj/__init__.py", line 322, in __init__
    self.crs = CRS.from_user_input(projparams if projparams is not None else kwargs)
  File "/software/pytroll/lib/python3.5/site-packages/pyproj/crs.py", line 218, in from_user_input
    return cls(**value)
  File "/software/pytroll/lib/python3.5/site-packages/pyproj/crs.py", line 140, in __init__
    super(CRS, self).__init__(projstring)
  File "pyproj/_crs.pyx", line 322, in pyproj._crs._CRS.__init__
pyproj.exceptions.CRSError: Invalid projection: +proj=omerc +no_rot=True +lat_0=58.2871 +ellps=WGS84 +lon_1=57.045227 +lat_1=75.71283 +lat_2=39.717655 +lon_2=26.961946 +type=crs

I downgraded to pyproj 1.9.6 to make it work again.

To me it looks like the bounding box computation sent to Proj does not work anymore. So maybe there are a bug in pyproj or the satpy bounding box needs to be updated.

@djhoese
Copy link
Member

djhoese commented Mar 11, 2019

There is either a bug in Proj (not supporting a parameter it used to) or we are using a parameter that isn't supported anymore. This is probably/technically a pyresample bug. We'll have to look at the pyproj/proj release notes.

@djhoese djhoese added the bug label Mar 11, 2019
@TAlonglong
Copy link
Collaborator Author

I wonder if the +no_rot=True is correct. I guess +no_rot is a flag?

@djhoese
Copy link
Member

djhoese commented Mar 11, 2019

Good call. @TAlonglong what version of pyresample are you using? @mraspaud does this ring a bell at all?

@djhoese djhoese added this to the v0.13 milestone Mar 11, 2019
@TAlonglong
Copy link
Collaborator Author

So if I remove the =True this works

#!/usr/bin/python

import pyproj

pyproj.Proj("+proj=omerc +lat_2=80.27942 +lat_0=62.87671 +lat_1=42.751232 +ellps=WGS84 +no_rot +lon_1=33.793186 +lon_2=-18.374414 +type=crs")

@TAlonglong
Copy link
Collaborator Author

So the problem is here:
https://github.com/pytroll/pyresample/blob/master/pyresample/geometry.py#L578

But thats pyresample.

How to you add in the dict a flag?

@djhoese
Copy link
Member

djhoese commented Mar 11, 2019

@TAlonglong can you find anything in pyproj release notes about turning this functionality off? I believe @mraspaud has always included logic like this because it has always worked in pyproj in the past (passing an argument with True).

@TAlonglong
Copy link
Collaborator Author

Nothing directly: https://jswhit.github.io/pyproj/html/history.html

Maybe I should ask there.

@mraspaud
Copy link
Member

Iirc I'm passing these as a dict of arguments, the python way, so it wasn't clear how to pass valueless arguments. hence my using True. And it worked so far.

@mraspaud
Copy link
Member

Should we limit the pyproj version to <2.0.0 while we figure this out ?

@djhoese
Copy link
Member

djhoese commented Mar 11, 2019

I think the fix would be to pass this particular case in as a string (unless we find another workaround). Fixing this and specifying the version both require commits/PRs/re-releases. I'd rather have a fix/workaround that doesn't limit versions if possible.

@TAlonglong
Copy link
Collaborator Author

There will be a pyproj 2.0.2 release to address this issue: pyproj4/pyproj#184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants