-
Notifications
You must be signed in to change notification settings - Fork 365
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
Fix limits/threshold of projections with non-default Globe #1607
base: main
Are you sure you want to change the base?
Conversation
c09f1b9
to
c50d32c
Compare
Code changes look good in general. Looks like this broke the |
Weird, I thought I saw that failure before making this change and thought it was unrelated, but I guess not. |
It formerly did not scale with Globe radius, and so would produce a very very small result within a large boundary if using any smaller Globe radius.
Fixes SciTools#1572, testing the example in the other projections as well.
Using the example from SciTools#1572 shows that the lines are jagged and the threshold is too high.
c50d32c
to
82f9a8d
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me and will help folks when dealing with their moon/astro projections too. Just needs a rebase/update I think.
@@ -841,9 +841,17 @@ def __init__(self, central_longitude=0.0, central_latitude=0.0, | |||
proj4_params += [('approx', None)] | |||
super().__init__(proj4_params, globe=globe) | |||
|
|||
# TODO: Let the globe return the semimajor axis always. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this would be nice.
a = np.float(self.globe.semimajor_axis or WGS84_SEMIMAJOR_AXIS) | ||
b = np.float(self.globe.semiminor_axis or a) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for these to be np.float()
instead of just leaving them as the values that are returned?
@@ -21,16 +22,56 @@ def setup_class(self): | |||
self.point_b = (0.5, 50.5) | |||
self.src_crs = ccrs.PlateCarree() | |||
|
|||
def check_args(self, approx, proj, other_args): | |||
if ccrs.PROJ4_VERSION < (6, 0, 0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can get rid of this check now since we are dependent on pyproj's PROJ version and looks like we are at 8+
https://pyproj4.github.io/pyproj/3.3.1/
Rationale
Some limits and thresholds are hard-coded, but this causes incorrect projections when the Globe radius is much smaller than the default. Either the map is tiny in very large limits, or lines are not projected correctly.
Implications
TransverseMercator
is no longer tiny when using a small Globe radius; other projections do not cut projected lines randomly.