Skip to content

Error while using the DEM.grd as a numpy variable #717

Closed

Description

@vivigb

Description of the problem

import pygmt
region=[77, 79, 29.5, 30.5]
fig= pygmt.Figure()
ctopo=pygmt.makecpt(cmap="himalaya.cpt")
grid = pygmt.datasets.load_earth_relief(resolution='01s', region=region)
KWARGS = dict(grid=grid,region=region, projection='M4i',frame=True, E=300)
fig.grdimage(**KWARGS,cmap=ctopo,shading=True)
fig.show()

Giving me the following error

Traceback (most recent call last):
  File "<ipython-input-11-78e4c4e19ed9>", line 1, in <module>
    fig.grdimage(**KWARGS,cmap=ctopo,shading=True)
  File "C:\ProgramData\Anaconda3\envs\roses\lib\site-packages\pygmt\helpers\decorators.py", line 270, in new_module
    return module_func(*args, **kwargs)
  File "C:\ProgramData\Anaconda3\envs\roses\lib\site-packages\pygmt\helpers\decorators.py", line 411, in new_module
    return module_func(*args, **kwargs)
  File "C:\ProgramData\Anaconda3\envs\roses\lib\site-packages\pygmt\base_plotting.py", line 485, in grdimage
    lib.call_module("grdimage", arg_str)
  File "C:\ProgramData\Anaconda3\envs\roses\lib\site-packages\pygmt\clib\session.py", line 503, in call_module
    self.session_pointer, module.encode(), mode, args.encode()
OSError: exception: access violation reading 0x000001E880146FBC

I am using conda environment in Windows

PyGMT information:
  version: v0.2.1
System information:
  python: 3.7.8 | packaged by conda-forge | (default, Nov 17 2020, 23:02:53) [MSC v.1916 64 bit (AMD64)]
  executable: C:\ProgramData\Anaconda3\envs\roses\python.exe
  machine: Windows-10-10.0.19041-SP0
Dependency information:
  numpy: 1.19.4
  pandas: 1.1.4
  xarray: 0.16.1
  netCDF4: 1.5.4
  packaging: 20.4
  ghostscript: 9.53.3
  gmt: 6.1.1
GMT library information:
  binary dir: C:/ProgramData/Anaconda3/envs/roses
  cores: 4
  grid layout: rows
  library path: C:/ProgramData/Anaconda3/envs/roses/Library/bin/gmt.dll
  padding: 2
  plugin dir: C:/ProgramData/Anaconda3/envs/roses/Library/bin/gmt_plugins
  share dir: c:/programs/gmt5/share
  version: 6.1.1

Activity

  1. welcome commented on Dec 7, 2020

    @welcome

    👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.

  2. seisman commented on Dec 7, 2020

    @seisman
    Member

    Yes, we notice similar crashes in our CI testings. It's still unclear to us why and where it happens, as none of us is developing PyGMT under Windows.

    You have two options:

    1. Re-run the script again. Sometimes it crashes, but sometimes it works well
    2. Directly use the GMT remote file, i.e., KWARGS = dict(grid="@earth_relief_01s",region=region, projection='M4i',frame=True, E=300), instead of using the pygmt.datasets.load_earth_relief, which loads the grid into memory.
  3. added
    bug
    help wanted
    on Dec 7, 2020
  4. seisman commented on Mar 18, 2021

    @seisman
    Member

    I'd like to close the issue, because:

    1. We already know that PyGMT sometimes crashes on Windows
    2. We don't have any Windows developers to track the crashes
    3. There are most likely issues of GMT, not PyGMT.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions