Skip to content

Let -JV take optional meridian without failure#7291

Merged
Esteban82 merged 1 commit intomasterfrom
grinten-central-long
Mar 3, 2023
Merged

Let -JV take optional meridian without failure#7291
Esteban82 merged 1 commit intomasterfrom
grinten-central-long

Conversation

@PaulWessel
Copy link
Member

Well, at least the original troubles reported in #7282 are fixed. The final issue appreas to have been that when the region was negative we shifted it in coast by 360 but unfortunately the check for doing the same to the central meridian had < instead of <= so it was left behind to cause chaos, I added another test pscoast_JV_set.sh which uses a fixed Greenwich as the central meridian and those quadrants and hemispheres now work:

pscoast_JV_set

Well, at least the original troubles reported in #7282 are fixed.  The final issue appreas to have been that when the region was negative we shifted it in coast by 360 but unfortunately the check for doing th4 same to the central meridian nad < instead of <= so it was left behind to cause chaos,
I added another test pscoast_JV_set.sh which uses a fixed Greenwhich as the central meridian and those quadrants and hemispheres now work.
@PaulWessel PaulWessel added the bug Something isn't working label Mar 3, 2023
@PaulWessel PaulWessel added this to the 6.5.0 milestone Mar 3, 2023
@PaulWessel PaulWessel self-assigned this Mar 3, 2023
@PaulWessel
Copy link
Member Author

If I change the projection from V to R, N, K, H, W etc they all work it seems

@Esteban82 Esteban82 merged commit 8805157 into master Mar 3, 2023
@Esteban82 Esteban82 deleted the grinten-central-long branch March 3, 2023 11:38
@joa-quim
Copy link
Member

joa-quim commented Mar 3, 2023

But we still have more problems of this kind

gmt coast -R-180/2/-90/90 -JR1/12c -Bg -W0.5 -png lixo

lixo

@PaulWessel
Copy link
Member Author

Yep. Nothing is foolproof yet but let me know if basemap does the same or if it is a coast thing.

@joa-quim
Copy link
Member

joa-quim commented Mar 3, 2023

Yes, basemap does the same.

@PaulWessel
Copy link
Member Author

PaulWessel commented Mar 5, 2023

So, what is happening here is that if you set a central meridian at lon = 1, then the most western longitude on a global map is lon = -179 since then the distance from central meridian to west is 180 degrees. Setting it to -180 is actually a point on the east end and GMT goes nuts. For instance, if I modify your example slightly along these lines:

gmt coast -R-179/2/-90/90 -JR1/12c -Bg -W0.5 -png lixo

then we get

lixo

So I think these failures should be caught with a check that says

basemap [ERROR]: Western boundary is > 180 degrees from central meridian and thus invalid.

@PaulWessel
Copy link
Member Author

Just noticing that for most of the cylindrical projections, we have a check that override bogus things like this and recenter the central longitude in the middle. If I add the same call (gmtmap_cyl_validate_clon) to gmtmap_init_winkel then you sample yields

lixo

with central longitude forced to be half-way from w to e. Given this has been the default action in Mercator, Cylindrical Equal-Area, Cylindrical Equidistance, Miller, Cylindrical Stereographic, I guess some options are:

  1. Impose the same on similar projections (Winkel, Robinson, Grinten, etc etc which have the same issue)
  2. Decide that if user specified a central longitude and it is > 180 degrees from west or east we yield a (new) error message

Thoughts?

anbj pushed a commit that referenced this pull request Mar 7, 2023
Well, at least the original troubles reported in #7282 are fixed.  The final issue appreas to have been that when the region was negative we shifted it in coast by 360 but unfortunately the check for doing th4 same to the central meridian nad < instead of <= so it was left behind to cause chaos,
I added another test pscoast_JV_set.sh which uses a fixed Greenwhich as the central meridian and those quadrants and hemispheres now work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants