Bug #1180

grdview: incorrect 3D display with southern hemisphere pole

Added by Viktor 9 months ago. Updated 7 months ago.

Status:ClosedStart date:2018-01-04
Priority:NormalDue date:
Assignee:Paul% Done:

100%

Category:-
Target version:Candidate for next bugfix release
Affected version:6.x-svn Platform:

Description

The order of what is displayed in front vs behind is incorrect with 3D elevation.
A mountain behind another would appear in front it with a southern hemisphere pole.

Script attached that creates 4 figures (only changing azimuth in -JOA).
The last one (where the top of the map is in a south direction) has order of what is displayed in front/back wrong.

angle_0.jpg - good, x azimuth = 90 (49.9 KB) Viktor, 2018-01-04 17:53

angle_1.jpg - good, x azimuth = 135 (51.6 KB) Viktor, 2018-01-04 17:53

angle_2.jpg - good, x azimuth = 180 (53.8 KB) Viktor, 2018-01-04 17:54

angle_3.jpg - bad, x azimuth = 225 (50.1 KB) Viktor, 2018-01-04 17:54

test.sh Magnifier - script for sample figures (575 Bytes) Viktor, 2018-01-04 17:55

ts0674.nc - resource for sample script (354 KB) Viktor, 2018-01-04 17:55

viewN.mp4 - Northern hemisphere spin (2.56 MB) Paul, 2018-02-24 12:17

viewS.mp4 - Southern hemisphere spin (2.59 MB) Paul, 2018-02-24 12:18

Associated revisions

Revision 19547
Added by Paul 9 months ago

Fix typos mentioned in issue #1180

History

#1 Updated by Viktor 9 months ago

I also noticed the following (grammar) in the documentation from:
http://gmt.soest.hawaii.edu/doc/latest/gmt.html#j-full

The upper-case A|B|C to removes enforcement of a northern hemisphere pole.

#2 Updated by Paul 9 months ago

  • Status changed from New to In Progress
  • Assignee set to Paul
  • Target version set to Candidate for next bugfix release
  • % Done changed from 0 to 10

Fixed the typo in r19547; more after returning from vacation.

#3 Updated by Paul 8 months ago

Looking at this now and I am confused. You are using the -JA projection with the optional horizon argument. This is not an azimuth, but distance to the horizon from the pole (which remains at 173.5/-42). So I am not sure what it means to change the horizon but it certainly seems to give a changed vantage point somehow. I've made a movie over 360 and of course a 360 horizon cannot mean anything (max 180 degrees from a point to a horizon). Perhaps you can tell me what you are trying to do? I don't think southern hemisphere has anything to do with it because if I doctor your grid to be in the north I see the same effect you mention. I wonder if you are trying to achieve an effect that you normally should use the -p option modifiers +v for?

#4 Updated by Viktor 8 months ago

-Jo[a|A]lon0/lat0/azimuth/scale or -JO[a|A]lon0/lat0/azimuth/width
Set projection center lon0/lat0, azimuth of oblique equator, and scale.

I am using -JOA projection, not -JA.
When you view the images I have uploaded in sequence, 0 to 2 make sense but 3 is completely wrong. The large hill (in front) appears behind the smaller (darker) hills in the back.

What I am trying to do is rotate the view around a point but the display is incorrect when the top of the map points more towards the south direction (x axis passes 180 degrees). Normally the north on a map points up. but when it points down +- 90 degrees, it screws up the order of the 3D hills.

I think the images 0-3 tell the story better. I'm sure you will understand angle_3.jpg is wrong.
If you start with angle_0.jpg, go next and you reach angle_1.jpg. You will notice the view angle around the same object has changed by a little.
Go to the next image angle_2.jpg and you will see that the progression is the same.
Now think of what you expect angle_3.jpg to show before checking it given the progression (change of angle around the object) is the same.
Go to the next image angle_3.jpg and you will see that it does not make sense.

#5 Updated by Paul 8 months ago

Sorry, brain freeze, of course you are doing -JO. Will look again but still true that I got the same error if flipping your data to N hemisphere.

#6 Updated by Paul 8 months ago

I've played with this a bit to determine the extend of the problem. It affects both hemispheres. Attached are animations of your grid both in the south and in the north (flipping the latitude in your grid). For both animations things look good for azimuths in the ~2-178 degree range and bad in the 182-361 degree range, with odd transitions at around 1 and 181. I assume this has to do with -p179 and we would find other ranges with a different view point. So I agree there is some confusion in grdview as to from which end of the grid it should start plotting (back towards front). Will see where that decision fails.

#7 Updated by Paul 8 months ago

  • Status changed from In Progress to Resolved
  • % Done changed from 10 to 100

Fixed in r19819. I rewrote how the loop ordering is decided and executed.

#8 Updated by Viktor 8 months ago

Thank you for all the help Paul!

#9 Updated by Paul 7 months ago

  • Status changed from Resolved to Closed

Closed as fixed.

Also available in: Atom PDF