Fix limits/threshold of projections with non-default Globe#1607
Fix limits/threshold of projections with non-default Globe#1607QuLogic wants to merge 3 commits intoSciTools:mainfrom
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
|
|
greglucas
left a comment
There was a problem hiding this comment.
This looks good to me and will help folks when dealing with their moon/astro projections too. Just needs a rebase/update I think.
| 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.
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.
Is there a reason for these to be np.float() instead of just leaving them as the values that are returned?
| 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.
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
TransverseMercatoris no longer tiny when using a small Globe radius; other projections do not cut projected lines randomly.