WIP Improve detection of closed but split contours#6083
Open
PaulWessel wants to merge 14 commits intomasterfrom
Open
WIP Improve detection of closed but split contours#6083PaulWessel wants to merge 14 commits intomasterfrom
PaulWessel wants to merge 14 commits intomasterfrom
Conversation
Member
Author
|
Not out of the woods yet. Feel free to try this script and run it repeatedly for random locations of the center of the grid: In general, it looks better but once in a while we have contours (very close to a pole?) and it comes out the wrong way. |
Member
Author
|
I added annotations so we can report bad cases and know which contour it was. Some observations so far:
Hi @Esteban82 and @meghanrjones please post if you find other systematic issues. |
Member
Member
Author
|
That one is OK but if you run the script with random lon/lat you will quickly get cases that still fail and give the wrong direction. |
Member
|
Ping |
Member
Author
|
Will try to look tomorrow... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description of proposed changes
See #6080 for background. After much forensics I learned that the failing contour reported a clockwise (CW) polygon whereas all others are counter-clockwise (CCW). Due to how the contour-trace algorithm and later clipping and projection works, I believe they are all counter-clockwise or should be CCW. Adding a sanity check to converts CW to CCW and prints a warning was added to both grdcontour and pscontour. The correction fixes the problem reported in #6080 and all tests pass in master, except grdcontour/closed.sh gave a slightly different plot (as the change affected what is considered beginning and end. Instead of updating the PS I just upped the RMS limit to 0.02 so the test passes.
Here are all the changes in this PR:
While I am pretty sure this fix is robust (the combined tests found something like ~80 CCW situations for closed contours that were to be ticked and just 1 (in grdcontour/closed.sh) plus the case in #6080 were CW, I am flagging this PR as WIP until we run some more contours with -T+a on more grids.