-
Notifications
You must be signed in to change notification settings - Fork 362
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
WIP Improve detection of closed but split contours #6083
base: master
Are you sure you want to change the base?
Conversation
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.
Now it works.
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. |
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. |
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. |
Ping |
Will try to look tomorrow... |
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.