grdfill fails, probably in situation where holes extend to the edge of the grid domain

Open
#7,736 6 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@PaulWessel is already working on this.

Since Aug 18, 2023.

Assessment

This issue has not been assessed yet.

Description

bug

I have found that grdfill is failing, running into a segmentation fault. I am running gmt 6.4.0 on MacOS. It fails when trying to do certain operations on a grid which has lots of nans running up against the edge of the grid. It fails when using -L and -Ac but not -An. (I have not tried other options)

Command that creates failure: (the file D20191226.nc can be found here: https://drive.google.com/file/d/1rDbvuEidaeIdsuik0O7kSReNcsjzoVt2/view?usp=sharing)

gmt grdfill D20191226.nc -Ac -GD20191226_HOLESFILLED.nc -Vd

Full error message

gmt [DEBUG]: GMT_Create_Session: Terminal width = 122
gmt [DEBUG]: Obtained the ppid from parent: 36863
gmt [DEBUG]: Enter: gmtinit_new_GMT_ctrl
gmt [DEBUG]: GMT->session.SHAREDIR = /Users/mlees/.conda/envs/general_science/share/gmt
gmt [DEBUG]: GMT->session.HOMEDIR = /Users/mlees
gmt [DEBUG]: GMT->session.USERDIR = /Users/mlees/.gmt [created]
gmt [DEBUG]: GMT->session.CACHEDIR = /Users/mlees/.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 /Users/mlees/.gmt
gmt [DEBUG]: GMT: 3. gmt_getsharepath trying USERDIR subdir /Users/mlees/.gmt/postscriptlight
gmt [DEBUG]: GMT: 4. gmt_getsharepath trying SHAREDIR subdir /Users/mlees/.conda/envs/general_science/share/gmt/postscriptlight
gmt [DEBUG]: GMT: 5. gmt_getsharepath trying SHAREDIR /Users/mlees/.conda/envs/general_science/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]: 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]: Look for file /Users/mlees/gmt.conf
gmt [DEBUG]: Look for file /Users/mlees/.gmt/gmt.conf
gmt [DEBUG]: Look for file /Users/mlees/.gmt/server/gmt.conf
gmt [DEBUG]: Look for file /Users/mlees/.gmt/cache/gmt.conf
gmt [DEBUG]: Could not find file 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]: Enter: gmt_hash_init
gmt [DEBUG]: Exit: gmt_hash_init
gmt [DEBUG]: Exit: gmtinit_get_history
gmt [DEBUG]: Initialize FFTW with 8 threads.
gmt [DEBUG]: GMT_Create_Session initialized GMT structure
gmt [DEBUG]: Loading core GMT shared library: libgmt.dylib
gmt [DEBUG]: Shared Library # 0 (core). Path = libgmt.dylib
gmt [DEBUG]: Loading GMT plugins from: /Users/mlees/.conda/envs/general_science/lib/gmt/plugins
gmt [DEBUG]: Shared Library # 1 (supplements). Path = /Users/mlees/.conda/envs/general_science/lib/gmt/plugins/supplements.so
gmt [DEBUG]: Revised options: D20191226.nc -Ac0.0 -GD20191226_HOLESFILLED.nc -Vd
grdfill [DEBUG]: Found readable file D20191226.nc
grdfill [DEBUG]: Replace file D20191226.nc with path D20191226.nc
grdfill [DEBUG]: Replace file D20191226.nc with D20191226.nc
grdfill [DEBUG]: Found readable file D20191226.nc
grdfill [DEBUG]: Replace file D20191226.nc with path D20191226.nc
grdfill [DEBUG]: Found readable file D20191226.nc
grdfill [DEBUG]: Replace file D20191226.nc with path D20191226.nc
grdfill [DEBUG]: Found readable file D20191226.nc
grdfill [DEBUG]: Object ID 0 : Registered Grid File D20191226.nc as an Input resource with geometry Surface [n_objects = 1]
grdfill [DEBUG]: gmtapi_begin_io: Input resource access is now enabled [container]
grdfill [DEBUG]: gmtapi_import_grid: Passed ID = 0 and mode = 1
grdfill [DEBUG]: Found readable file D20191226.nc
grdfill [DEBUG]: Calling nc_open on D20191226.nc, ncid = 65536, err = 0
grdfill [DEBUG]: Calling nc_close on ncid 65536, err = 0
grdfill [DEBUG]: Calling nc_open on D20191226.nc, ncid = 65536, err = 0
grdfill [DEBUG]: Calling nc_close on ncid 65536, err = 0
grdfill [DEBUG]: Call gmtgrdio_doctor_geo_increments on a geographic grid
grdfill [DEBUG]: Geographic input grid, longitudes span less than 360
grdfill [DEBUG]: GMT_End_IO: Input resource access is now disabled
grdfill [DEBUG]: gmtapi_begin_io: Input resource access is now enabled [container]
grdfill [DEBUG]: gmtapi_import_grid: Passed ID = 0 and mode = 2
grdfill [INFORMATION]: Reading grid from file D20191226.nc
grdfill [DEBUG]: Calling nc_open on D20191226.nc, ncid = 65536, err = 0
grdfill [DEBUG]: packed z-range: [-0.179119,0.0716667]
grdfill [DEBUG]: Calling nc_close on ncid 65536, err = 0
grdfill [DEBUG]: Geographic input grid, longitudes span less than 360
grdfill [DEBUG]: Chosen boundary condition for all edges: geographic
grdfill [INFORMATION]: gmt_grd_BC_set: Set boundary condition for all edges: natural
grdfill [INFORMATION]: gmt_grd_BC_set: Set boundary condition for left edge: natural
grdfill [INFORMATION]: gmt_grd_BC_set: Set boundary condition for right edge: natural
grdfill [INFORMATION]: gmt_grd_BC_set: Set boundary condition for bottom edge: natural
grdfill [INFORMATION]: gmt_grd_BC_set: Set boundary condition for top edge: natural
grdfill [DEBUG]: GMT_End_IO: Input resource access is now disabled
Segmentation fault: 11

Dominant language
C
Stars
997
Forks
420
Avg merge
13h 27m
Merged PRs (30d)
47

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GenericMappingTools/gmt

All issues in GenericMappingTools/gmt

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.