You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Matrix grid doesn't always work with different central meridians #4335
The issue was first reported in GenericMappingTools/pygmt#390, but was thought to be fixed by GMT PRs #3813 and #3829. The GMT master branch works for some projection parameters but doesn't always work.
And just to be absolutely clear, the plot on the bottom is what you expect? That rougher plot is what I get with long=0 which you said works, so just checking.
So what happens is this: We have a read-only grid and it has a certain central meridian. This kicks in:
if (got_z_grid && (gmt_whole_earth (GMT, Grid_orig->header->wesn, wesn) == 1))
need_to_project = true; /* This can only happen if reading a remote global geographic grid and the central meridian differs from that of the projection */
So now we go the way of resampling the images - hence the smoother apparance. The other image is not resampled, just plotted, but handles the change in longitude. I will see if I can make it work the same. You would think that should be doable, but the big difference is that the file is read in and the matrix is rotated to fit the -R while in the xarray case the pixels are still -180/180. So not the same case.
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.
Activity
PaulWessel commentedon Oct 16, 2020
Is this a gridline registration issue only or is it the same for pixel as well?
seisman commentedon Oct 16, 2020
Same issue for pixel-registered grids (just tried
Q123/0/15c).PaulWessel commentedon Oct 16, 2020
And just to be absolutely clear, the plot on the bottom is what you expect? That rougher plot is what I get with long=0 which you said works, so just checking.
seisman commentedon Oct 16, 2020
Yes, the bottom one uses the earth relief grid file, which gives the same plot as GMT CLI.
PaulWessel commentedon Oct 16, 2020
So what happens is this: We have a read-only grid and it has a certain central meridian. This kicks in:
So now we go the way of resampling the images - hence the smoother apparance. The other image is not resampled, just plotted, but handles the change in longitude. I will see if I can make it work the same. You would think that should be doable, but the big difference is that the file is read in and the matrix is rotated to fit the -R while in the xarray case the pixels are still -180/180. So not the same case.
stale commentedon Jan 16, 2021
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.
stale commentedon Jun 2, 2021
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.
joa-quim commentedon Apr 6, 2024
What is the status of this? Mane related changes have been committed meanwhile.
seisman commentedon Apr 6, 2024
I'll find some time to check it.
joa-quim commentedon Jun 9, 2025
Ping?
joa-quim commentedon May 8, 2026
Another ping
seisman commentedon May 8, 2026
Still fail with the master branch, for
Q123/0/15candQ180/0/15cjoa-quim commentedon May 8, 2026
A CLI example?
seisman commentedon May 9, 2026
The bug only exists when passing virtual files from wrappers.