Repository navigation
Closed
Labels
bugSomething isn't working
Description
Description of the problem
There appears to be a double-frame on the x and y-axis when making a perspective plot using grdview with the -Jz flag. Originally detected at GenericMappingTools/pygmt#589 (comment).
| Actual (incorrect) plot | Expected (correct) plot |
|---|---|
![]() |
![]() |
Full script that generated the error
gmt begin doubleframe png
gmt grdcut @earth_relief_01d_g -R-116/-109/-47/-44 -Gtempgrid.nc
gmt grdview tempgrid.nc -p225/30 -Jz0.005 -Bzaf -Vd
gmt end
Full error message
Details
gmt [DEBUG]: Obtained the ppid from parent: 176
gmt [DEBUG]: Enter: gmtinit_new_GMT_ctrl
gmt [DEBUG]: GMT->session.SHAREDIR = /srv/conda/envs/notebook/share/gmt
gmt [DEBUG]: GMT->session.HOMEDIR = /home/jovyan
gmt [DEBUG]: GMT->session.USERDIR = /home/jovyan/.gmt [created]
gmt [DEBUG]: GMT->session.CACHEDIR = /home/jovyan/.gmt/cache [created]
gmt [DEBUG]: GMT: 0. Will try to find subdir=postscriptlight stem = PSL_custom_fonts suffix=.txt
gmt [DEBUG]: GMT: 1. gmt_getsharepath trying current dir
gmt [DEBUG]: GMT: 2. gmt_getsharepath trying USERDIR /home/jovyan/.gmt
gmt [DEBUG]: GMT: 3. gmt_getsharepath trying USERDIR subdir /home/jovyan/.gmt/postscriptlight
gmt [DEBUG]: GMT: 4. gmt_getsharepath trying SHAREDIR subdir /srv/conda/envs/notebook/share/gmt/postscriptlight
gmt [DEBUG]: GMT: 5. gmt_getsharepath trying SHAREDIR /srv/conda/envs/notebook/share/gmt
gmt [DEBUG]: GMT: 6. gmt_getsharepath failed
gmt [DEBUG]: Map distance calculation will be Cartesian
gmt [DEBUG]: Exit: gmtinit_new_GMT_ctrl
gmt [DEBUG]: Enter: New_PSL_Ctrl
gmt [DEBUG]: Exit: New_PSL_Ctrl
gmt [DEBUG]: Enter: gmt_manage_workflow
gmt [DEBUG]: GMT now running in modern mode [Session ID = 176]
gmt [DEBUG]: Exit : gmt_manage_workflow
gmt [DEBUG]: Enter: PSL_beginsession
gmt [DEBUG]: Exit : PSL_beginsession
gmt [DEBUG]: Enter: PSL_setdefaults
gmt [DEBUG]: Exit : PSL_setdefaults
gmt [DEBUG]: Enter: gmtlib_io_init
gmt [DEBUG]: Exit : gmtlib_io_init
gmt [DEBUG]: Enter: gmt_hash_init
gmt [DEBUG]: Exit: gmt_hash_init
gmt [DEBUG]: Enter: gmt_hash_init
gmt [DEBUG]: Exit: gmt_hash_init
gmt [DEBUG]: Enter: gmt_reload_settings
gmt [DEBUG]: The PROJ_GEODESIC set to Vincenty
gmt [DEBUG]: gmtlib_get_graphics_item: Fig: 0 Subplot: 2 Panel: () Inset: 0
gmt [DEBUG]: Reading GMT Default parameters from file: /home/jovyan/.gmt/sessions/gmt_session.176/gmt.conf
gmt [DEBUG]: Exit: gmt_reload_settings
gmt [DEBUG]: Enter: gmtlib_plot_C_format
gmt [DEBUG]: Exit: gmtlib_plot_C_format
gmt [DEBUG]: Enter: gmtinit_get_history
gmt [DEBUG]: gmtlib_get_graphics_item: Fig: 0 Subplot: 2 Panel: () Inset: 0
gmt [DEBUG]: Enter: gmt_hash_init
gmt [DEBUG]: Exit: gmt_hash_init
gmt [DEBUG]: Exit: gmtinit_get_history
gmt [DEBUG]: Initialize FFTW with 6 threads.
gmt [DEBUG]: GMT_Create_Session initialized GMT structure
gmt [DEBUG]: Loading core GMT shared library: libgmt.so
gmt [DEBUG]: Shared Library # 0 (core). Path = libgmt.so
gmt [DEBUG]: Loading GMT plugins from: /srv/conda/envs/notebook/lib/gmt/plugins
gmt [DEBUG]: Shared Library # 1 (supplements). Path = /srv/conda/envs/notebook/lib/gmt/plugins/supplements.so
gmt [DEBUG]: GMT now running in modern mode [Session ID = 176]
gmt [DEBUG]: Use PS filename /home/jovyan/.gmt/sessions/gmt_session.176/gmt_0.ps-
gmt [DEBUG]: gmtinit_get_current_panel: No current panel selected so not in subplot mode
gmt [DEBUG]: Modern mode: Added -R to options since history is available.
gmt [DEBUG]: Modern: Adding -JX15c to options since there is no history available.
gmt [DEBUG]: Revised options: tempgrid.nc -p225/30 -Jz0.005 -Bzaf -Vd -R -JX15c
grdview [DEBUG]: History: Process -p225/30
grdview [DEBUG]: History: Process -Jz0.005
grdview [DEBUG]: History: Process -R
grdview [DEBUG]: History: Process -JX15c
grdview [DEBUG]: gmt_get_filename: In: -116/-109/-47/-44 Out: -116/-109/-47/-44
grdview [DEBUG]: Look for file -116/-109/-47/-44 in /home/jovyan/.gmt
grdview [DEBUG]: Look for file -116/-109/-47/-44 in /home/jovyan/.gmt/cache
grdview [DEBUG]: Look for file -116/-109/-47/-44 in /home/jovyan/.gmt/server
grdview [DEBUG]: Got regular w/e/s/n for region (-116/-109/-47/-44)
grdview [DEBUG]: gmt_get_filename: In: tempgrid.nc Out: tempgrid.nc
grdview [DEBUG]: Found readable file tempgrid.nc
grdview [DEBUG]: Replace file tempgrid.nc with path tempgrid.nc
grdview [DEBUG]: Replace file tempgrid.nc with tempgrid.nc
grdview [DEBUG]: Local file /home/jovyan/.gmt/server/gmt_data_server.txt found
grdview [DEBUG]: File /home/jovyan/.gmt/server/gmt_data_server.txt less than 24 hours old, refresh is premature.
grdview [DEBUG]: Load contents from /home/jovyan/.gmt/server/gmt_data_server.txt
grdview [DEBUG]: Local file /home/jovyan/.gmt/server/gmt_hash_server.txt found
grdview [DEBUG]: File /home/jovyan/.gmt/server/gmt_hash_server.txt less than 24 hours old, refresh is premature.
grdview [DEBUG]: gmt_get_filename: In: tempgrid.nc Out: tempgrid.nc
grdview [DEBUG]: Found readable file tempgrid.nc
grdview [DEBUG]: Replace file tempgrid.nc with path tempgrid.nc
grdview [DEBUG]: gmt_get_filename: In: tempgrid.nc Out: tempgrid.nc
grdview [DEBUG]: Found readable file tempgrid.nc
grdview [DEBUG]: Replace file tempgrid.nc with path tempgrid.nc
grdview [DEBUG]: gmt_get_filename: In: tempgrid.nc Out: tempgrid.nc
grdview [DEBUG]: gmt_get_filename: In: tempgrid.nc Out: tempgrid.nc
grdview [DEBUG]: Found readable file tempgrid.nc
grdview [DEBUG]: Object ID 0 : Registered Grid File tempgrid.nc as an Input resource with geometry Surface [n_objects = 1]
grdview [DEBUG]: gmtapi_begin_io: Input resource access is now enabled [container]
grdview [DEBUG]: gmtapi_import_grid: Passed ID = 0 and mode = 1
grdview [DEBUG]: Found readable file tempgrid.nc
grdview [DEBUG]: gmt_get_filename: In: tempgrid.nc Out: tempgrid.nc
grdview [DEBUG]: Call gmtgrdio_doctor_geo_increments on a geographic grid
grdview [DEBUG]: Geographic input grid, longitudes span less than 360
grdview [DEBUG]: GMT_End_IO: Input resource access is now disabled
grdview [DEBUG]: Projected values in meters: -3.5 3.5 -47 -44
grdview [DEBUG]: Auto-frame interval for axis 2 item 0: d = 200 f = 100
grdview [INFORMATION]: Auto-frame interval for z-axis (item 0): a200f100
grdview [INFORMATION]: Map scale is 0.000466667 km per cm or 1:46.6667.
grdview [INFORMATION]: Processing shape grid
grdview [DEBUG]: gmtapi_begin_io: Input resource access is now enabled [container]
grdview [DEBUG]: gmtapi_import_grid: Passed ID = 0 and mode = 2
grdview [INFORMATION]: Reading grid from file tempgrid.nc
grdview [DEBUG]: packed z-range: [-3606.5,-2614.5]
grdview [DEBUG]: Geographic input grid, longitudes span less than 360
grdview [DEBUG]: Chosen boundary condition for all edges: geographic
grdview [INFORMATION]: Set boundary condition for all edges: natural
grdview [INFORMATION]: Set boundary condition for left edge: natural
grdview [INFORMATION]: Set boundary condition for right edge: natural
grdview [INFORMATION]: Set boundary condition for bottom edge: natural
grdview [INFORMATION]: Set boundary condition for top edge: natural
grdview [DEBUG]: GMT_End_IO: Input resource access is now disabled
grdview [DEBUG]: Octant 4 (az = 153.435) one = 1
grdview [DEBUG]: Outer loop over x doing 6:-1:-1
grdview [DEBUG]: Inner loop over y doing 1:1:4
grdview [INFORMATION]: Start creating PostScript plot
grdview [DEBUG]: Running in PS mode modern
grdview [DEBUG]: Use PS filename /home/jovyan/.gmt/sessions/gmt_session.176/gmt_0.ps-
grdview [DEBUG]: Create hidden PS file /home/jovyan/.gmt/sessions/gmt_session.176/gmt_0.ps-
grdview [DEBUG]: No figure file /home/jovyan/.gmt/sessions/gmt_session.176/gmt.figures - nothing to do
grdview [DEBUG]: Got session name as doubleframe and default graphics formats as png
grdview [INFORMATION]: Do mesh plot with mesh color white
grdview [DEBUG]: Current size of half-baked PS file /home/jovyan/.gmt/sessions/gmt_session.176/gmt_0.ps- = 22543.
grdview [DEBUG]: gmtlib_garbage_collection: Destroying object: C=0 A=0 ID=0 W=Input F=Grid M=File S=Used P=56499f4a5350 N=tempgrid.nc
grdview [DEBUG]: GMTAPI_Garbage_Collection freed 1 memory objects
grdview [DEBUG]: gmtlib_unregister_io: Unregistering object no 0 [n_objects = 0]
grdview (gmtlib_free_tmp_arrays): tried to free unallocated memory
gmt [DEBUG]: Entering GMT_Destroy_Session
gmt [DEBUG]: gmtlib_get_graphics_item: Fig: 0 Subplot: 2 Panel: () Inset: 0
System information
I've reproduced this both on my personal computer and on the try-gmt.
- Operating system: Linux-4.19.112+-x86_64-with-glibc2.10
- GMT version (
gmt --version): 6.1.1
Metadata
Metadata
Assignees
Labels
bugSomething isn't working


Activity
joa-quim commentedon Sep 7, 2020
You can avoid it with
seisman commentedon Sep 7, 2020
The "double frame" is actually the frame for geographic projections (i.e., the fancy frame). If you add -Bxaf -Byaf to the command, it would be more clear:
The debug message from @weiji14 says:
it's unclear to me why GMT chooses -JX15c for a geographic grid.
joa-quim commentedon Sep 7, 2020
It's the poor man's choice. Alternative would be to give the right projection for the given region. Doable but never done.
weiji14 commentedon Sep 7, 2020
Ok, put it down as user error for now (setting a projection like
-JT-112.5/45.5works). Still think the zebra stripes should show up properly though instead of having a double lined frame, or that we just plot a single lined frame.joa-quim commentedon Sep 7, 2020
Agree. It's a mild bug
PaulWessel commentedon Sep 9, 2020
Not sure what you expect here. There is only -Bzaf given, right? So nothing for x-y. It cannot draw checker-board without knowing or setting increments, but no -B was given. So what it did was basically -B0. When that happens I totally agree that the double lines are not helpful, so it could switch to a plain frame in that case when no increments are set.
seisman commentedon Sep 9, 2020
I actually expect no X and Y frames here, because not -Bxaf and -Byaf are given.
BTW, adding -B0 to the grdview command gives me a plain frame.
PaulWessel commentedon Sep 9, 2020
Yes, I can go with that, I was just assuming we have to do some backwards compatibility here by drawing that -B0. But I would be fine and happier with just the z-axis as requested.
seisman commentedon Sep 9, 2020
Ping @weiji14.
weiji14 commentedon Sep 9, 2020
I think it would look weird with just the z-axis plotted and no x and y frames (maybe someone would plot it that way?), but happy to go with it (just z-axis plotted). Anything is better than the strange double frame really.
joa-quim commentedon Sep 9, 2020
Remember that we have MAP_FRAME_AXES defaulting to
WSENso this case has to plot those axes but in plain. In the unlikely case the user won't them, he can always do--MAP_FRAME_AXES=ZPaulWessel commentedon Sep 9, 2020
Or -B+n I think.
seisman commentedon Sep 9, 2020
No, -Bzaf -B+n doesn't plot the Z axis.
For 2D maps, the frames are not plotted unless -B, -Bx or -By is given. However, for the 3D case, giving -Bz only also plots the X and Y axes seems weird to me.
PaulWessel commentedon Sep 10, 2020
Yes, it breaks the logic. -Bz should not magically also turn on horizontal frames I think. That is the error here.
Do not let -Bz trigger x-y basemap
7 remaining items
PaulWessel commentedon Oct 6, 2020
I am totally confident in that is what we meant, yes. But
gmt basemap -R0/5/0/5/0/1 -JX3i -JZ1i -B0 -p170/35 -pdf mapgives that z-stick.
PaulWessel commentedon Oct 6, 2020
I am learning that if I turn the z-axis off then the map title is plotted as 2-D instead of in-plane 3-D. So while the above command no longer has a stick. Compare these:
In master, running
gmt basemap -R0/5/0/5/0/1 -JX3i -JZ1i -B0 -B+tTITLE -p170/35 -png mastergiveswhile in my branch that lets -B0 only set x/y frame the same command looks like this:
In that branch, I can get the first plot by adding -Bz0. As you can see, a true 3-D plot places a 2-D title while a perspective 2-D plot gets a title in the same perspective. Might also want to document taht, but I think the branch is better, no? What does @seisman think? I should add that perhaps the real problem is that -JZ is being used but nothing is plotted in z. So perhaps master is correct in that sense. Yet, if I take out -JZ and run master I get a 2-D title:
joa-quim commentedon Oct 6, 2020
Having the z stick with
-JZ1i -B0seems correct because there is a -JZ. The title is more confuse. Middle plot seems more correct.PaulWessel commentedon Oct 6, 2020
I agree. So we have these rules:
joa-quim commentedon Oct 7, 2020
Yes, seems to cover all cases.
seisman commentedon Oct 7, 2020
#4293 still doesn't fix the issue, right?
seisman commentedon Oct 7, 2020
Trying the latest master branch.
The following result doesn't make sense. Here I give -Bx -By, but the Y annotations and ticks are not shown.
PaulWessel commentedon Oct 7, 2020
So in the highest level of parsing I know we look (in modern mode only) for options like plain -B and we append to make it -Baf. I probably did not check for them all individually so will do that later today).
PaulWessel commentedon Oct 7, 2020
No, I have checks for those cases and they should all end up as -Bxaf -Byaf and -Bzaf. So then the question is what happens next in the auto-interval section.
PaulWessel commentedon Oct 7, 2020
After -Bx is parsed, GMT->current.map.frame.set is true and -By is not processed, only -Bz. I think set needs to be set[GMT_X|Y|Z] so we have more control here.
PaulWessel commentedon Oct 12, 2020
Note: This has been fixed in PR #4274 and will go away once that branch is merged.
PaulWessel commentedon Oct 13, 2020
Branched merged so closing this issue.