Skip to content

Geographic xarray.DataArray grid is plotted as Cartesian grid #1172

@seisman

Description

@seisman

Description of the problem

Originally found in #1154 (comment)

Full code that generated the error

import pygmt

pygmt.show_versions()

xrgrid = pygmt.grdcut("@earth_relief_01d", region=[-116, -109, -47, -44])
print(xrgrid.gmt.gtype)

fig = pygmt.Figure()
fig.grdview(grid=xrgrid, frame=True)
fig.savefig("grdview.png")

fig = pygmt.Figure()
fig.grdimage(grid=xrgrid, frame=True)
fig.savefig("grdimage.png")

xrgrid.gmt.gtype is 1, so the grid is a geographic grid. However, the grid is still plotted as a Cartesian grid.

grdview grdimage
image image

System information

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

PyGMT information:
  version: v0.3.2.dev65+g9b57cc97.d20210404
System information:
  python: 3.9.2 | packaged by conda-forge | (default, Feb 21 2021, 05:02:20)  [Clang 11.0.1 ]
  executable: /Users/user/.miniconda/envs/pygmt/bin/python
  machine: macOS-11.2.3-x86_64-i386-64bit
Dependency information:
  numpy: 1.20.1
  pandas: 1.2.3
  xarray: 0.17.0
  netCDF4: 1.5.6
  packaging: 20.9
  ghostscript: 9.53.3
  gmt: 6.1.1
GMT library information:
  binary dir: /Users/user/.miniconda/envs/pygmt/bin
  cores: 8
  grid layout: rows
  library path: /Users/user/.miniconda/envs/pygmt/lib/libgmt.dylib
  padding: 2
  plugin dir: /Users/user/.miniconda/envs/pygmt/lib/gmt/plugins
  share dir: /Users/user/.miniconda/envs/pygmt/share/gmt
  version: 6.1.1

Metadata

Metadata

Assignees

No one assigned

    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