-
Notifications
You must be signed in to change notification settings - Fork 367
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
Add special check for non-rotated global grids #3849
Conversation
We usually read global grids from file and they get rotated depending on the wesn selection. However, when a global grid is passed from another environment, as GMT_IS_REFERENCE, we may be projeting that image in gmt_grd_project and if the repeated meridians fall inside the map (since no rotation has happened) they are counted twice, yielding a slightly different result. Only applies to gridline-registrered grids. This fix detects this special situation and skips one of the repeated meridians.
Not sure. It was relatively clear what to do for when the repeated meridian lands inside. While I am not sure why there is nothing on the west border, I would suspect this has to do with BCs. When the grid is read in and we know it is global, we use actual data values from the other side to set the two extra rows/cols in the grid data. THe matrix has no padding, so when it is passed into gmt_grd_project, this happens:
So we end up duplicating the non-padded matrix so we can project. So assuming the grid/matrix is flagged as geographic, it should end up applying periodic boundary conditions at west and east and it should be the same for the grid as well as the matrix. But clearly the east boundary differs. Will see if I can find any inconsistencies. |
Think I have the answer: It is the opposite of the fix I added. For this projection and a gridline-registered grid, the longitude that corresponds to the map west and east will be plotted twice. Since the rotated grid (read from file) has a min/max that equal east/west, it is plotted twice and all is well. |
So I would like to debug my new algorithm but now I cannot get the python script to pass control to Xcode when it calls
but it just completes. Plot is made, but I am unable to debug. Any ideas? |
Do you mean "gmt_api.c"? |
Hm, perhaps that is the problem. I am still in my CLI module being called by gmt but I need to think GMT_Call_Module and put a stop point inside Call_Module. |
All is well. Another lesson learned on debugging. 99% of my debugging has been via gmt calling GMT_Call_Modules so that has been my entry point into the library... |
Please give this another shot. My gm compare show zero difference between the two gridline plots and all tests pass (well minus the gdalnn and the imagepluscpt). |
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.
Great!
* Add special check for non-rotated global grids We usually read global grids from file and they get rotated depending on the wesn selection. However, when a global grid is passed from another environment, as GMT_IS_REFERENCE, we may be projeting that image in gmt_grd_project and if the repeated meridians fall inside the map (since no rotation has happened) they are counted twice, yielding a slightly different result. Only applies to gridline-registrered grids. This fix detects this special situation and skips one of the repeated meridians. * Handle meridian to be duplicated * Update gmt_map.c * Update gmt_project.h
* Add special check for non-rotated global grids We usually read global grids from file and they get rotated depending on the wesn selection. However, when a global grid is passed from another environment, as GMT_IS_REFERENCE, we may be projeting that image in gmt_grd_project and if the repeated meridians fall inside the map (since no rotation has happened) they are counted twice, yielding a slightly different result. Only applies to gridline-registrered grids. This fix detects this special situation and skips one of the repeated meridians. * Handle meridian to be duplicated * Update gmt_map.c * Update gmt_project.h Co-authored-by: Paul Wessel <[email protected]>
We usually read global grids from file and they get rotated depending on the wesn selection. However, when a global grid is passed from another environment, as GMT_IS_REFERENCE, we may be projecting that image in gmt_grd_project and if the repeated meridians fall inside the map (since no rotation has happened) they are counted twice, yielding a slightly different result. Only applies to gridline-registrered grids. This fix detects this special situation and skips one of the repeated meridians. Addresses the initial issue raised in #3844.
Note sure about backport. Was the gmt_whole_earth backported?