Skip to content

Figure.grdcontour crashes for GMT dev (the upcoming v6.2.0) #1177

Closed

Description

@seisman

Full code that generated the error

The following script is modified from a crashing test test_grdcontour_interval_file_full_opts:

import pygmt

grid = pygmt.datasets.load_earth_relief(registration="gridline")

fig = pygmt.Figure()
fig.grdcontour(
    region=[-161.5, -154, 18.5, 23],
    interval="contours.txt",
    grid=grid,
    resample=100,
    projection="M10c",
    cut=10,
    limit=(-25000, -1),
    pen=["a1p,blue", "c0.5p,blue"]
)
fig.savefig("map.pdf")

Full error message

The script works for GMT 6.1.1, but gives a lot of warnings and crashes for GMT 6.2.0:

...
grdcontour [WARNING]: Latitude (2960.5) at line # 178 exceeds -|+ 90! - set to NaN
grdcontour [WARNING]: Latitude (3141.5) at line # 179 exceeds -|+ 90! - set to NaN
grdcontour [WARNING]: Latitude (3072.5) at line # 180 exceeds -|+ 90! - set to NaN
grdcontour [WARNING]: Latitude (2862) at line # 181 exceeds -|+ 90! - set to NaN
[1]    29831 segmentation fault  python test.py

The above Python script is equivalent to:

gmt grdcontour @earth_relief_01d_g -Ccontours.txt -JM10c -L-25000/-1 -Q10 -R-161.5/-154/18.5/23 -S100 -Wa1p,blue -Wc0.5p,blue -pdf map

The only difference is that the Python script passes a xarray.DataArray grid instead of the @earth_relief_01d_g file.

Activity

  1. added
    bug
    on Apr 5, 2021
  2. seisman commented on Apr 5, 2021

    @seisman
    MemberAuthor

    @PaulWessel This seems like another GMT bug.

  3. added
    upstream
    on Apr 5, 2021
  4. added this to the 0.4.0 milestone on Apr 5, 2021
  5. changed the title [-]Figure.grdcontour crashes for GMT 6.2.0[/-] [+]Figure.grdcontour crashes for GMT dev (the upcoming v6.2.0)[/+] on Apr 5, 2021
  6. PaulWessel commented on Apr 5, 2021

    @PaulWessel

    OK, will tackle tomorrow morning.

  7. PaulWessel commented on Apr 5, 2021

    @PaulWessel

    COuld you please post contours.txt

  8. weiji14 commented on Apr 5, 2021

    @weiji14
    Member

    Here you go Paul:

    -6000 C
    -5000 C
    -4000 A
    -3000 C
    -2000 C
    -1000 C
    0 A
    1000 C
    2000 A
    3000 C

  9. PaulWessel commented on Apr 5, 2021

    @PaulWessel

    Thanks, looking forward to Xcode session tomorrow. The messages are coming form table i/o code despite this being a grid module... wonder how that can happen.

  10. PaulWessel commented on Apr 5, 2021

    @PaulWessel

    So the virtual file says it is a DATASET passed as a MATRIX, not a GRID passed as a MATRIX. Could you possibly tell me how the virtual file was created, i.e., how GMT_Create_Data and GMT_Put_Matrix was called? Is it different than the grdview case eariler, since in that case it was a GRID as MATRIX.

  11. seisman commented on Apr 5, 2021

    @seisman
    MemberAuthor

    I believe the virtual file is created in the same way,

    Arguments for GMT_Create_Data:

    • GMT_IS_GRID|GMT_VIA_MATRIX
    • GMT_IS_SURFACE
    • GMT_CONTAINER_ONLY|GMT_GRID_IS_GEO

    Arguments for GMT_Open_VirtualFile:

    • GMT_IS_GRID|GMT_VIA_MATRIX
    • GMT_IS_SURFACE
    • GMT_IN|GMT_IS_REFERENCE
  12. seisman commented on Apr 6, 2021

    @seisman
    MemberAuthor

    The issue has been fixed by GenericMappingTools/gmt#5100.

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

    bugupstream

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions