Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a failing test due to GMT API change #556

Merged
merged 2 commits into from
Aug 7, 2020
Merged

Conversation

seisman
Copy link
Member

@seisman seisman commented Aug 6, 2020

Description of proposed changes

The test test_put_matrix_grid fails with GMT latest due to recent changes of GMT API
in GenericMappingTools/gmt#3848.

Before this PR, for a matrix grid, calling GMT_Write_Data always writes
the matrix grid as a matrix, no matter the geometry is GMT_IS_POINT or
GMT_IS_SURFACE.

This PR declares it as a bug (or an improvement). With that PR merged,
geometry=GMT_IS_POINT writes the matrix as a table, geometry=GMT_IS_SURFACE
writes the matrix grid as a netCDF file.

This test expects a matrix, but the new API writes a netCDF grid.
That's why it fails.

This PR fixes the issue by simply changing GMT_IS_SURFACE to
GMT_IS_POINT, so that the test can pass for GMT 6.1.0, 6.1 and master
branches.

Fixes #

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

The test `test_put_matrix_grid` fails due to recent changes of GMT API
in GenericMappingTools/gmt#3848.

Before this PR, for a matrix grid, calling GMT_Write_Data always writes
the matrix grid as a matrix, no matter the geometry is `GMT_IS_POINT` or
`GMT_IS_SURFACE`.

This PR declares it as a bug (or an improvement). With that PR merged,
`geometry=GMT_IS_POINT` writes a matrix, `geometry=GMT_IS_SURFACE`
writes a the matrix grid as a netCDF file.

This test expects a matrix, but the new API writes a netCDF grid.
That's why it fails.

This PR fixes the issue by simply changing `GMT_IS_SURFACE` to
`GMT_IS_POINT`, so that the test can pass for GMT 6.1.0, 6.1 and master
branches.
@vercel vercel bot temporarily deployed to Preview August 6, 2020 21:25 Inactive
@seisman seisman requested a review from weiji14 August 6, 2020 21:26
@seisman seisman added bug Something isn't working upstream Bug or missing feature of upstream core GMT maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog labels Aug 6, 2020
@seisman seisman added this to the 0.2.x milestone Aug 6, 2020
@@ -76,7 +76,7 @@ def test_put_matrix_grid():
with GMTTempFile() as tmp_file:
lib.write_data(
"GMT_IS_MATRIX",
"GMT_IS_SURFACE",
"GMT_IS_POINT",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem like we use lib.write_data on any user-facing code, or very much in the clib. I know GMT can write an ASCII grid, but maybe we should also test with "GMT_IS_SURFACE" to ensure that:

  1. lib.write_data can write to a NetCDF properly; and
  2. We can use xarray to read from that NetCDF file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds a good idea, but it needs 6.1.1, so better to add the test in a new pr and only merge that pr after we bump to gmt 6.1.1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok (forgot that we're still on GMT 6.1.0). Leave it until end of the month then.

@seisman seisman merged commit b9ca682 into master Aug 7, 2020
@seisman seisman deleted the point-or-surface branch August 7, 2020 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog upstream Bug or missing feature of upstream core GMT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants