GenericMappingTools / gmt

The Generic Mapping Tools
https://www.generic-mapping-tools.org
Other
843 stars 352 forks source link

MAP_GRID_CROSS_SIZE parameter not being applied #3062

Closed weiji14 closed 4 years ago

weiji14 commented 4 years ago

Description of the problem

The MAP_GRID_CROSS_SIZE doesn't seem to be applied properly (to simultaneously change MAP_GRID_CROSS_SIZE_PRIMARY and MAP_GRID_CROSS_SIZE_SECONDARY). Realized this when trying to write some unit tests to handle issue at https://github.com/GenericMappingTools/pygmt/issues/409.

Full script that generated the error

gmt begin map_grid_cross_size png
    gmt set MAP_GRID_CROSS_SIZE=3p
    gmt basemap -R2020-1-24T21:00/2020-1-25T00:00/0/1 -JX6c/2c -Bpa1Hg -Bsa45mfg45m -BNWse
gmt end show

Full error message

``` gmt [DEBUG]: Obtained the ppid from parent: 27655 gmt [DEBUG]: Enter: gmtinit_new_GMT_ctrl gmt [DEBUG]: GMT->session.SHAREDIR = /home/user/miniconda3/envs/pygmt/share/gmt gmt [DEBUG]: GMT->session.HOMEDIR = /home/user gmt [DEBUG]: GMT->session.USERDIR = /home/user/.gmt [created] gmt [DEBUG]: GMT->session.CACHEDIR = /home/user/.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/user/.gmt gmt [DEBUG]: GMT: 3. gmt_getsharepath trying USERDIR subdir /home/user/.gmt/postscriptlight gmt [DEBUG]: GMT: 4. gmt_getsharepath trying SHAREDIR subdir /home/user/miniconda3/envs/pygmt/share/gmt/postscriptlight gmt [DEBUG]: GMT: 5. 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 = 27655] 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]: The PROJ_GEODESIC set to Vincenty gmt [DEBUG]: Enter: gmt_getdefaults gmt [DEBUG]: Reading GMT Default parameters from file: /home/user/.gmt/sessions/gmt6.27655/gmt.conf gmt [DEBUG]: Exit: gmt_getdefaults gmt [DEBUG]: Enter: gmtlib_plot_C_format gmt [DEBUG]: Exit: gmtlib_plot_C_format gmt [DEBUG]: Enter: gmt_get_history gmt [DEBUG]: Initialize FFTW with 2 threads. gmt [DEBUG]: GMT_Create_Session initialized GMT structure gmt [DEBUG]: Shared Library # 0 (core). Path = libgmt.so gmt [DEBUG]: Loading core GMT shared library: libgmt.so gmt [DEBUG]: Loading GMT plugins from: /home/user/miniconda3/envs/pygmt/lib/gmt/plugins gmt [DEBUG]: Shared Library # 1 (supplements). Path = /home/user/miniconda3/envs/pygmt/lib/gmt/plugins/supplements.so gmt [DEBUG]: GMT now running in modern mode [Session ID = 27655] gmt [DEBUG]: Use PS filename /home/user/.gmt/sessions/gmt6.27655/gmt_0.ps- gmt [DEBUG]: get_current_panel: No current panel selected so not in subplot mode basemap [DEBUG]: History: Process -R2020-1-24T21:00/2020-1-25T00:00/0/1 basemap [DEBUG]: History: Process -JX6c/2c basemap [DEBUG]: parse_B_arg_inspector: GMT4 = 0 vs. GMT = 0 basemap [DEBUG]: parse_B_arg_inspector: Assume new GMT style format in -B option basemap [DEBUG]: parse_B_arg_inspector: GMT4 = 0 vs. GMT = 0 basemap [DEBUG]: parse_B_arg_inspector: Assume new GMT style format in -B option basemap [DEBUG]: Look for file 2020-1-24T21:00/2020-1-25T00:00/0/1 in /home/user/.gmt basemap [DEBUG]: Look for file 2020-1-24T21:00/2020-1-25T00:00/0/1 in /home/user/.gmt/cache basemap [DEBUG]: Look for file 2020-1-24T21:00/2020-1-25T00:00/0/1 in /home/user/.gmt/server basemap [DEBUG]: Look for file 2020-1-24T21:00/2020-1-25T00:00/0/1 in /home/user/.gmt/server/srtm1 basemap [DEBUG]: Look for file 2020-1-24T21:00/2020-1-25T00:00/0/1 in /home/user/.gmt/server/srtm3 basemap [DEBUG]: Got regular w/e/s/n for region (2020-1-24T21:00/2020-1-25T00:00/0/1) basemap [INFORMATION]: Constructing the basemap basemap [DEBUG]: Projected values in meters: 1.5799e+09 1.57991e+09 0 1 basemap [DEBUG]: Auto-frame interval for axis 0 item 0: d = 2 f = 1 basemap [INFORMATION]: Auto-frame interval for x-axis (item 0): g1H�xyz --FORMAT_CLOCK_MAP=hh:mm basemap [DEBUG]: Auto-frame interval for axis 1 item 0: d = 0.2 f = 0.1 basemap [INFORMATION]: Auto-frame interval for y-axis (item 0): g0.1 basemap [DEBUG]: Auto-frame interval for axis 0 item 1: d = 2 f = 1 basemap [INFORMATION]: Auto-frame interval for x-axis (item 1): f1H�xyz basemap [DEBUG]: Auto-frame interval for axis 1 item 1: d = 0.2 f = 0.1 basemap [INFORMATION]: Auto-frame interval for y-axis (item 1): f0.1 basemap [INFORMATION]: Map scale is 1.8 km per cm or 1:180000. basemap [DEBUG]: Running in PS mode modern basemap [DEBUG]: Use PS filename /home/user/.gmt/sessions/gmt6.27655/gmt_0.ps- basemap [DEBUG]: Create hidden PS file /home/user/.gmt/sessions/gmt6.27655/gmt_0.ps- basemap [DEBUG]: No figure file /home/user/.gmt/sessions/gmt6.27655/gmt.figures - nothing to do basemap [DEBUG]: Got session name as map_grid_cross_size and default graphics formats as png basemap [DEBUG]: Entering plot_map_gridlines basemap [DEBUG]: Draw y = 0 from 1.5799e+09 to 1.57991e+09 basemap [DEBUG]: Draw y = 0.1 from 1.5799e+09 to 1.57991e+09 basemap [DEBUG]: Draw y = 0.2 from 1.5799e+09 to 1.57991e+09 basemap [DEBUG]: Draw y = 0.3 from 1.5799e+09 to 1.57991e+09 basemap [DEBUG]: Draw y = 0.4 from 1.5799e+09 to 1.57991e+09 basemap [DEBUG]: Draw y = 0.5 from 1.5799e+09 to 1.57991e+09 basemap [DEBUG]: Draw y = 0.6 from 1.5799e+09 to 1.57991e+09 basemap [DEBUG]: Draw y = 0.7 from 1.5799e+09 to 1.57991e+09 basemap [DEBUG]: Draw y = 0.8 from 1.5799e+09 to 1.57991e+09 basemap [DEBUG]: Draw y = 0.9 from 1.5799e+09 to 1.57991e+09 basemap [DEBUG]: Draw y = 1 from 1.5799e+09 to 1.57991e+09 basemap [DEBUG]: Draw y = 0 from 1.5799e+09 to 1.57991e+09 basemap [DEBUG]: Draw y = 0.75 from 1.5799e+09 to 1.57991e+09 basemap [DEBUG]: Exiting plot_map_gridlines basemap [DEBUG]: Current size of half-baked PS file /home/user/.gmt/sessions/gmt6.27655/gmt_0.ps- = 22857. psbasemap (Free_Ctrl): tried to free unallocated memory psbasemap (Free_Ctrl): tried to free unallocated memory psbasemap (Free_Ctrl): tried to free unallocated memory psbasemap (gmtlib_free_tmp_arrays): tried to free unallocated memory gmt [DEBUG]: Entering GMT_Destroy_Session ```

Actual outcome

MAP_GRID_CROSS_SIZE not properly set

Expected outcome

MAP_GRID_CROSS_SIZE properly set

System information

joa-quim commented 4 years ago

Current master works and says

gmt basemap -R2020-1-24T21:00/2020-1-25T00:00/0/1 -JX6c/2c -Bpa1Hg -Bsa45mfg45m -BNWse --MAP_GRID_CROSS_SIZE=3p -png lixo
basemap [WARNING]: Your primary y annotation interval exceeds the secondary interval.
basemap [WARNING]: GMT expects it to be the other way around (primary annotations are closest to axis, secondary are further away)
basemap [WARNING]: Consider correcting your command - proceeding with your selections
basemap [WARNING]: Your primary y tick interval exceeds the secondary interval.
basemap [WARNING]: GMT expects it to be the other way around (primary annotations are closest to axis, secondary are further away)
basemap [WARNING]: Consider correcting your command - proceeding with your selections

lixo

seisman commented 4 years ago

@joa-quim's one-liner works but @weiji14's modern mode script doesn't work.

weiji14 commented 4 years ago

I've tested the other parameters (FONT_ANNOT, FORMAT_TIME_MAP, MAP_ANNOT_OFFSET, MAP_GRID_CROSS_SIZE, MAP_TICK_LENGTH, MAP_TICK_PEN) which also set _PRIMARY and _SECONDARY settings at https://github.com/GenericMappingTools/pygmt/pull/411, and it seems to be only MAP_GRID_CROSS_SIZE that doesn't work.

Edit: Can confirm that one-liner version works properly on 6.0.0 too.

PaulWessel commented 4 years ago

gmt set MAP_GRID_CROSS_SIZE=3p

results in no change to gmt.conf. That is why using --gmt set MAP_GRID_CROSS_SIZE=3p works while the script fails. Will look at this.