Skip to content

Segmentation fault if a grid has zero increments #1483

@yohaimagen

Description

@yohaimagen

grdimage throwing a segmentation fault insted of some proper error when mistakenly swapping xarray y and x coordination.

Full code that generated the error

X, Y = np.meshgrid(np.arange(10), np.arange(10))
Z = X ** 2 + Y ** 2
da = xr.DataArray(
    data=Z,
    dims=['y', 'x'],
    coords=dict(
        x=(['x'], Y[0, :]),
        y=(['y'], X[:, 0])
    )
)

fig = pygmt.Figure()
fig.basemap(
    frame='a',
    projection=f"X10",
    region=[0, 10, 0, 10]
)
fig.grdimage(da)
fig.show()

Full error message

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

System information

Please paste the output of python -c "import pygmt; pygmt.show_versions()":

PyGMT information:
  version: v0.4.1
System information:
  python: 3.7.10 | packaged by conda-forge | (default, Feb 19 2021, 15:59:12)  [Clang 11.0.1 ]
  executable: /Users/yohai/anaconda3/envs/faultSlip/bin/python
  machine: Darwin-18.7.0-x86_64-i386-64bit
Dependency information:
  numpy: 1.19.1
  pandas: 1.1.1
  xarray: 0.18.2
  netCDF4: 1.5.7
  packaging: 21.0
  ghostscript: 9.50
  gmt: 6.2.0
GMT library information:
  binary dir: /Users/yohai/anaconda3/envs/faultSlip/bin
  cores: 12
  grid layout: rows
  library path: /Users/yohai/anaconda3/envs/faultSlip/lib/libgmt.dylib
  padding: 2
  plugin dir: /Users/yohai/anaconda3/envs/faultSlip/lib/gmt/plugins
  share dir: /Users/yohai/anaconda3/envs/faultSlip/share/gmt
  version: 6.2.0

Metadata

Metadata

Labels

bugSomething isn't workingupstreamBug or missing feature of upstream core GMT

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions