Skip to content

Change 12a43badc70bf5f4ea77b14b5044250c5ac16a76 from May 2 broke Julia #5384

Closed

Description

@joa-quim

This now crashes

julia> bar(rand(15), color=:rainbow, show=1, Vd=2)
"psxy  -JX14c/9.5c -Baf -BWSen -R0.4/15.6/0/0.94 -C -i0-1,1 -Sb0.8u+b0 -P -K > C:\\TMP\\GMTjl_tmp.ps"

Very likely it's because it can't handle the -i0-1,1 anymore. The crash is indeed caused when it tries to access a 3rd column in data that has only 2 columns

Activity

  1. added
    bug
    on Jun 25, 2021
  2. PaulWessel commented on Jun 25, 2021

    @PaulWessel
    Contributor

    OK, so a couple of things:

    1. We clearly need to improve how testing is done so that when we make any bug fixes on the API that there is either automatically or manually a run of the Julia and PyGMT tests (and of course ideally also GMT/MEX tests). Otherwise, time goes by and it is harder to get back in and rediscover what was learned. Maybe we should add a new label that can be used to flags API-related changes?
    2. Remind me if you are passing this as a matrix, sets of vectors, or a GMT dataset via reference.

    Thoughts on this, @seisman and @meghanrjones?

  3. joa-quim commented on Jun 25, 2021

    @joa-quim
    MemberAuthor

    The detection problem here was that I didn't have this test in my test suites, or only tested that the GMT syntax is well generated.

    The culprit was this in change in gmt_api.c/gmtapi_pick_in_col_number()

            col_pos = GMT->current.io.col[GMT_IN][col].col; /* Which data column to pick */
    to
            col_pos = GMT->current.io.col[GMT_IN][col].order; /* Which data column to pick */
    
  4. seisman commented on Jun 25, 2021

    @seisman
    Member
    1. We clearly need to improve how testing is done so that when we make any bug fixes on the API that there is either automatically or manually a run of the Julia and PyGMT tests (and of course ideally also GMT/MEX tests).

    PyGMT runs its full tests with GMT master branch nightly, so any GMT API problems should be detected by PyGMT tests (if there are covered) in a few days.

    The commit reverted in #5385 comes from PR #5289.

  5. PaulWessel commented on Jun 25, 2021

    @PaulWessel
    Contributor

    Please check if the revert (which was one line only) negatively affects the pyGMT examples.

  6. seisman commented on Jun 25, 2021

    @seisman
    Member

    Please check if the revert (which was one line only) negatively affects the pyGMT examples.

    Yes, scripts in GenericMappingTools/pygmt#1313 now break.

  7. PaulWessel commented on Jun 25, 2021

    @PaulWessel
    Contributor

    Remind me if you are passing this as a matrix, sets of vectors, or a GMT dataset via reference.

    @joa-quim let me know please.

  8. joa-quim commented on Jun 25, 2021

    @joa-quim
    MemberAuthor

    I am passing a GMTdataset. It works if I only pass the matrix.

    You can reproduce it in Matlab. This crashes Matlab (if using order instead of col)

    D = gmt('wrapseg', {[(1:15)' rand(15,1)]})
    gmt('info -C -i0-1,1', D)
    
  9. joa-quim commented on Jun 25, 2021

    @joa-quim
    MemberAuthor

    But even Matrices have problems. This should plot bars with error-bars and what is passed in is 5x3 matrix

    men_means, men_std = (20, 35, 30, 35, 27), (2, 3, 4, 1, 2);
    women_means, women_std = (25, 32, 34, 20, 25), (3, 5, 2, 3, 3);
    x = collect(1:length(men_means));
    width = 0.35;
    
    bar(x.-width/2, collect(men_means), width=width, color=:lightblue,
        limits=(0.5,5.5,0,40), axis=:none, error_bars=(y=men_std,))
    bar!(x.+width/2, collect(women_means), width=width, color=:brown,
        xaxis=(custom=(pos=1:5, label=[:G1 :G2 :G3 :G4 :G5]),), yaxis=(annot=5,label=:Scores),
        frame=(title="Scores by group and gender", axes=:WSrt), error_bars=(y=women_std,), savefig="genders.png")
    

    The generated command is

    cmd = " -R0.5/5.5/0/40 -JX14c/9.5c -Ey -C -i0-1,1,2-2 -Sb0.35u+b0"
    

    No crash but 0-error bars

    genders

  10. PaulWessel commented on Jun 25, 2021

    @PaulWessel
    Contributor

    I think I will make a test*.c example to do some more testing on -i and passing various things in.

  11. PaulWessel commented on Jun 25, 2021

    @PaulWessel
    Contributor

    And @seisman, I think PyGMT uses mostly GMT_VECTOR when passing in datasets and GMT_MATRIX when passing in grids, or do you mix it up?

  12. seisman commented on Jun 25, 2021

    @seisman
    Member

    And @seisman, I think PyGMT uses mostly GMT_VECTOR when passing in datasets and GMT_MATRIX when passing in grids, or do you mix it up?

    I think PyGMT doesn't use GMT_VECTOR and GMT_MATRIX together.

  13. PaulWessel commented on Jun 25, 2021

    @PaulWessel
    Contributor

    I meant across all PyGMT modules you do use both methods for passing data into GMT. not mixing, but one modules may use VECTOR and another may use MATRIX.

  14. seisman commented on Jun 25, 2021

    @seisman
    Member

    one modules may use VECTOR and another may use MATRIX.

    Yes.

  15. seisman commented on Jun 25, 2021

    @seisman
    Member

    one modules may use VECTOR and another may use MATRIX.

    Yes.

    Maybe I was wrong. For example, in PyGMT, the contour function can either pass vectors of x, y, z by calling GMT_Put_Vectors or pass a matrix of (x,y,z) by calling GMT_Put_Matrix.

  16. PaulWessel commented on Jun 29, 2021

    @PaulWessel
    Contributor

    Can you check this again - should work fine after the fix. if so please close.

  17. joa-quim commented on Jun 29, 2021

    @joa-quim
    MemberAuthor

    It's fine ... and closed.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions