Repository navigation
Symbols are sized in unit inches instead of centimetres when using -i #4386
Copy link
Copy link
Open
Labels
staleThis will not be worked onThis will not be worked on
Description
Description of the problem
There appears to be a bug (or feature?) when using i="0,1,2,2" with -Suc, as it doesn't change the unit to centimetres, but keeps on using inches as the default unit. The documentation at https://docs.generic-mapping-tools.org/latest/plot3d.html#s confuses me, especially with the mention of PROJ_LENGTH_UNIT.
Originally posted by @weiji14 in GenericMappingTools/pygmt#471 (comment)
Full script that generated the error
Data file from https://github.com/GenericMappingTools/pygmt/blob/v0.2.0/pygmt/tests/data/points.txt
gmt begin temp png
gmt plot3d pygmt/tests/data/points.txt -Jz5 -p225/30 -i0,1,2,2 -R10/70/-5/10/0/1 -JX4i -Suc -Gblue -Baf -Bzaf
gmt end show
Full error message
Details
gmt [DEBUG]: Obtained the ppid from parent: 23207
gmt [DEBUG]: Enter: gmtinit_new_GMT_ctrl
gmt [DEBUG]: GMT->session.SHAREDIR = ~/miniconda3/envs/pygmt/share/gmt
gmt [DEBUG]: GMT->session.HOMEDIR = ~
gmt [DEBUG]: GMT->session.USERDIR = ~/.gmt [created]
gmt [DEBUG]: GMT->session.CACHEDIR = ~/.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 ~/.gmt
gmt [DEBUG]: GMT: 3. gmt_getsharepath trying USERDIR subdir ~/.gmt/postscriptlight
gmt [DEBUG]: GMT: 4. gmt_getsharepath trying SHAREDIR subdir ~/miniconda3/envs/pygmt/share/gmt/postscriptlight
gmt [DEBUG]: GMT: 5. gmt_getsharepath trying SHAREDIR ~/miniconda3/envs/pygmt/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 = 23207]
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: ~/.gmt/sessions/gmt_session.23207/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]: Initialize FFTW with 2 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: ~/miniconda3/envs/pygmt/lib/gmt/plugins
gmt [DEBUG]: Shared Library # 1 (supplements). Path = ~/miniconda3/envs/pygmt/lib/gmt/plugins/supplements.so
gmt [DEBUG]: GMT now running in modern mode [Session ID = 23207]
gmt [DEBUG]: Use PS filename ~/.gmt/sessions/gmt_session.23207/gmt_0.ps-
gmt [DEBUG]: gmtinit_get_current_panel: No current panel selected so not in subplot mode
gmt [DEBUG]: Revised options: pygmt/tests/data/points.txt -Jz5 -p225/30 -i0,1,2,2 -R10/70/-5/10/0/1 -JX4i -Suc -Gblue -Baf -Bzaf -Vd
plot3d [DEBUG]: History: Process -Jz5
plot3d [DEBUG]: History: Process -p225/30
plot3d [DEBUG]: History: Process -R10/70/-5/10/0/1
plot3d [DEBUG]: History: Process -JX4i
plot3d [DEBUG]: gmt_get_filename: In: 10/70/-5/10/0/1 Out: 10/70/-5/10/0/1
plot3d [DEBUG]: Look for file 10/70/-5/10/0/1 in ~/.gmt
plot3d [DEBUG]: Look for file 10/70/-5/10/0/1 in ~/.gmt/cache
plot3d [DEBUG]: Look for file 10/70/-5/10/0/1 in ~/.gmt/server
plot3d [DEBUG]: Got regular w/e/s/n for region (10/70/-5/10/0/1)
plot3d [DEBUG]: gmt_get_filename: In: pygmt/tests/data/points.txt Out: pygmt/tests/data/points.txt
plot3d [DEBUG]: Found readable file pygmt/tests/data/points.txt
plot3d [DEBUG]: Replace file pygmt/tests/data/points.txt with path pygmt/tests/data/points.txt
plot3d [DEBUG]: Replace file pygmt/tests/data/points.txt with pygmt/tests/data/points.txt
plot3d [INFORMATION]: Processing input table data
plot3d [DEBUG]: Projected values in meters: 10 70 -5 10
plot3d [DEBUG]: Auto-frame interval for axis 0 item 0: d = 20 f = 10
plot3d [INFORMATION]: Auto-frame interval for x-axis (item 0): a20f10
plot3d [DEBUG]: Auto-frame interval for axis 1 item 0: d = 5 f = 1
plot3d [INFORMATION]: Auto-frame interval for y-axis (item 0): a5f1
plot3d [DEBUG]: Auto-frame interval for axis 2 item 0: d = 0.2 f = 0.1
plot3d [INFORMATION]: Auto-frame interval for z-axis (item 0): a0.2f0.1
plot3d [INFORMATION]: Map scale is 0.00590551 km per cm or 1:590.551.
plot3d [DEBUG]: 3-D shading illusion: lux[k] = 0.5
plot3d [DEBUG]: 3-D shading illusion: lux[k] = 0.5
plot3d [DEBUG]: 3-D shading illusion: lux[k] = 0.316497
plot3d [DEBUG]: Running in PS mode modern
plot3d [DEBUG]: Use PS filename ~/.gmt/sessions/gmt_session.23207/gmt_0.ps-
plot3d [DEBUG]: Create hidden PS file ~/.gmt/sessions/gmt_session.23207/gmt_0.ps-
plot3d [DEBUG]: No figure file ~/.gmt/sessions/gmt_session.23207/gmt.figures - nothing to do
plot3d [DEBUG]: Got session name as temp and default graphics formats as png
plot3d [DEBUG]: gmtapi_init_import: Passed family = Data Table and geometry = Point
plot3d [DEBUG]: gmt_get_filename: In: pygmt/tests/data/points.txt Out: pygmt/tests/data/points.txt
plot3d [DEBUG]: Found readable file pygmt/tests/data/points.txt
plot3d [DEBUG]: Replace file pygmt/tests/data/points.txt with path pygmt/tests/data/points.txt
plot3d [DEBUG]: gmt_get_filename: In: pygmt/tests/data/points.txt Out: pygmt/tests/data/points.txt
plot3d [DEBUG]: gmt_get_filename: In: pygmt/tests/data/points.txt Out: pygmt/tests/data/points.txt
plot3d [DEBUG]: Found readable file pygmt/tests/data/points.txt
plot3d [DEBUG]: Object ID 0 : Registered Data Table File pygmt/tests/data/points.txt as an Input resource with geometry Point [n_objects = 1]
plot3d (gmtapi_init_import): tried to free unallocated memory
plot3d [DEBUG]: gmtapi_init_import: Added 1 new sources
plot3d [DEBUG]: GMT_Init_IO: Returned first Input object ID = 0
plot3d [DEBUG]: GMT_Begin_IO: Mode value 1 not considered (ignored)
plot3d [DEBUG]: GMT_Begin_IO: Initialize record-by-record access for Input
plot3d [DEBUG]: gmtapi_next_io_source: Selected object 0
plot3d [DEBUG]: gmt_get_filename: In: pygmt/tests/data/points.txt Out: pygmt/tests/data/points.txt
plot3d [DEBUG]: Found readable file pygmt/tests/data/points.txt
plot3d [DEBUG]: Replace file pygmt/tests/data/points.txt with path pygmt/tests/data/points.txt
plot3d [DEBUG]: Found readable file pygmt/tests/data/points.txt
plot3d [DEBUG]: Found readable file pygmt/tests/data/points.txt
plot3d [INFORMATION]: Reading Data Table from file pygmt/tests/data/points.txt
plot3d [DEBUG]: GMT_Begin_IO: Input resource access is now enabled [record-by-record]
plot3d [DEBUG]: Source col types: (Number,Number,Number)
plot3d [DEBUG]: ASCII source scanned: Numerical columns: 3, Trailing text: N, Record type: Numerical only
plot3d [DEBUG]: Selected col types: (Number,Number,Number,Dimension)
plot3d [DEBUG]: dist[0] = -2.63871 dist[1] = 0.522539
plot3d [DEBUG]: dist[0] = -2.23226 dist[1] = 0.375689
plot3d [DEBUG]: dist[0] = -3.44896 dist[1] = 0.764173
plot3d [DEBUG]: dist[0] = -3.04301 dist[1] = 0.907677
plot3d [DEBUG]: dist[0] = -2.89292 dist[1] = 0.330512
plot3d [DEBUG]: dist[0] = -3.26392 dist[1] = 0.864173
plot3d [DEBUG]: dist[0] = -3.30405 dist[1] = 0.138976
plot3d [DEBUG]: dist[0] = -2.60377 dist[1] = 0.457382
plot3d [DEBUG]: dist[0] = -1.52854 dist[1] = 0.36811
plot3d [DEBUG]: dist[0] = -2.73579 dist[1] = 0.315354
plot3d [DEBUG]: dist[0] = -0.861251 dist[1] = 0.891043
plot3d [DEBUG]: dist[0] = -2.41184 dist[1] = 0.44439
plot3d [DEBUG]: dist[0] = -3.69802 dist[1] = 0.871752
plot3d [DEBUG]: dist[0] = -3.67568 dist[1] = 0.463287
plot3d [DEBUG]: dist[0] = -1.42263 dist[1] = 0.365551
plot3d [DEBUG]: dist[0] = -2.7133 dist[1] = 0.907972
plot3d [DEBUG]: dist[0] = -1.89403 dist[1] = 0.750197
plot3d [DEBUG]: dist[0] = -3.65232 dist[1] = 0.42372
plot3d [DEBUG]: dist[0] = -2.52177 dist[1] = 0.919094
plot3d [DEBUG]: dist[0] = -2.59005 dist[1] = 0.5875
plot3d [DEBUG]: GMT_End_IO: Input resource access is now disabled
plot3d [DEBUG]: Current size of half-baked PS file ~/.gmt/sessions/gmt_session.23207/gmt_0.ps- = 32322.
plot3d [DEBUG]: gmtlib_unregister_io: Unregistering object no 0 [n_objects = 0]
plot3d (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
Actual outcome
Cubes sized in inches are produced instead of in centimetres
Expected outcome
Cubes sized in centimetres (note smaller, as 1 inch = ~2.5 cm)
System information
- Operating system: Linux, but appears to be more sensitive on Windows as discovered in Wrap plot3d pygmt#471 (comment)
- GMT version (
gmt --version): 6.1.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
staleThis will not be worked onThis will not be worked on


Activity
PaulWessel commentedon Oct 27, 2020
Can confirm this problem. This works:
echo 0 0 2 2 | gmt plot3d -R-2/2/-2/2/0/2 -JX15c -JZ5c -Suc -Gred -Baf -Bzaf -pdf map -p135/35but this does not:
echo 0 0 2 | gmt plot3d -R-2/2/-2/2/0/2 -JX15c -JZ5c -Suc -Gred -Baf -Bzaf -pdf map -p135/35 -i0-2,2[-]Symbols are sized in unit inches instead of centimetres[/-][+]Symbols are sized in unit inches instead of centimetres when using -i[/+]PaulWessel commentedon Oct 27, 2020
BTW, the same is true for plot:
echo 0 1 | gmt plot -R-2/2/-2/2 -Scc -Gred -B -i0,1,1 -pdf mapSo these cases happen when -i is used to recycle a map coordinate as a plot dimension. To be specific, you may in fact be saying that a latitude of 1 degree North shall also be duplicated into the z-column but now we want that "1" to mean 1c or 1i. I am not sure if this is good style or reasoning. A 1 degree north latitude should not become the same as 1 cm symbol size. Thus I question whether this should be considered a bug.
weiji14 commentedon Oct 27, 2020
Well, I'm more interested in the 3D xyz Cartesian sense. The 'bug' is that there is a hardcoded 'inches' setting somewhere, and that trying to set the scaling to 'cm' units doesn't work.
PaulWessel commentedon Oct 27, 2020
Sure, but your Cartesian z is the same, e.g., it could be number of people in Ohio or the weight of typical hamburgers, i.e., there is a unit associated with these things, even if not spelled out. Taking that weight of 0.43 pounds of hamburger and saying that it is now 0.43 cm for symbol size is the problem. However, if you decide to say "Lets scale those 0.43 pounds by a multiplier of one and now use it as a dimension" then it works:
weiji14 commentedon Oct 27, 2020
Yes, the
+s1works on Linux/macOS, but it somehow gets ignored in Windows as reported in GenericMappingTools/pygmt#471 (comment) and GenericMappingTools/pygmt#471 (comment). I was going to figure why Windows didn't work but some ghostscript not found error prevented that.Oh, and to be honest, this is a fairly minor bug. Just thought I'd report this inconsistency.
stale commentedon Feb 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.