cartopy icon indicating copy to clipboard operation
cartopy copied to clipboard

Buffer exterior rings when creating polygons.

Open QuLogic opened this issue 7 years ago • 11 comments

Rationale

This is already done for interior rings, and prevents invalid geometries from crashing things later.

Fixes #956.

Implications

WIP, since I need to write a test and I might try some benchmarking.

QuLogic avatar Sep 27 '18 23:09 QuLogic

I've added a test, pared down from the oceans feature to the limit of what's needed to trigger the error.

I tried running the tests a few times on master vs this branch and don't see any appreciable change in runtimes.

QuLogic avatar Oct 24 '18 03:10 QuLogic

Test failure looks real, but I can't readily tell if it's because of your change or upstream.

dopplershift avatar Oct 24 '18 17:10 dopplershift

Well, it didn't fail for me in testing, but I didn't try the older versions...

QuLogic avatar Oct 24 '18 21:10 QuLogic

OK, it does fail with 2.7 locally, so I will try and investigate.

QuLogic avatar Oct 24 '18 22:10 QuLogic

Well, I'm a bit confused; the values of the points are going in the same, and the init strings going into proj are the same, but somehow pj_transform in CartesianInterpolator::project is returning slightly different values that makes a broken exterior which buffer deletes entirely.

QuLogic avatar Oct 25 '18 08:10 QuLogic

Oops, apparently I missed the obvious that I was not running the same versions of Proj!

QuLogic avatar Oct 25 '18 09:10 QuLogic

Just a reminder that if you want this for 0.17, there's just a few days left.

dopplershift avatar Nov 12 '18 22:11 dopplershift

IIRC, this is difficult to get working for both versions of Proj, since they return different values. I think this can't move forward until we bump minimum Proj requirements.

QuLogic avatar Nov 12 '18 22:11 QuLogic

TBH, I'm not really sure about this; as you can see tests fail and I'm not sure whether this can be corrected.

QuLogic avatar Jan 11 '19 04:01 QuLogic

This looks like it passes all tests, and I do not see a speed regression. Seems good to go after a rebase?

This commit

[ 50.00%] ··· ============================ ============= ============
              --                                   resolution        
              ---------------------------- --------------------------
                       projection               110m         50m     
              ============================ ============= ============
                      PlateCarree            24.5±0.3ms   2.96±0.02s 
                    NorthPolarStereo        24.6±0.08ms    3.12±0s   
                        Robinson             10.9±0.1ms   3.43±0.02s 
               InterruptedGoodeHomolosine   11.1±0.07ms   3.72±0.01s 
              ============================ ============= ============

Current master

[100.00%] ··· ============================ ============= ============
              --                                   resolution        
              ---------------------------- --------------------------
                       projection               110m         50m     
              ============================ ============= ============
                      PlateCarree            25.8±0.6ms   2.90±0.01s 
                    NorthPolarStereo         25.4±0.4ms   3.07±0.01s 
                        Robinson             11.1±0.2ms   3.34±0.01s 
               InterruptedGoodeHomolosine   11.1±0.06ms   3.61±0.01s 
              ============================ ============= ============

greglucas avatar Nov 14 '21 03:11 greglucas

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Apr 08 '24 16:04 CLAassistant