-
Notifications
You must be signed in to change notification settings - Fork 224
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
Conversation
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.
@@ -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", |
There was a problem hiding this comment.
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:
lib.write_data
can write to a NetCDF properly; and- We can use
xarray
to read from that NetCDF file
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Description of proposed changes
The test
test_put_matrix_grid
fails with GMT latest due to recent changes of GMT APIin 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
orGMT_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
toGMT_IS_POINT
, so that the test can pass for GMT 6.1.0, 6.1 and masterbranches.
Fixes #
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.