Remove xfail on grdtrack tests for GMT 6.2.0#1304
Merged
Conversation
Member
Author
|
Weird. These two tests are "xpass" on master branch. |
Member
These two tests pass only on Linux. If you want, you can set a condition to xfail only on macOS/Windows. Or debug to see what's going on (the diff is only on the z/elevation value). Edit: For reference, this is the error on macOS Python 3.9/NumPy 1.20 (https://github.com/GenericMappingTools/pygmt/pull/1304/checks?check_run_id=2686875657#step:11:481) _________________ test_grdtrack_input_dataframe_and_dataarray __________________
dataarray = <xarray.DataArray 'elevation' (lat: 8, lon: 12)>
array([[-3385. , -3201.5, -3104. , -2953. , -2754. , -2782. , -2957.5...elevation relative to the geoid
units: meters
vertical_datum: EMG96
horizontal_datum: WGS84
def test_grdtrack_input_dataframe_and_dataarray(dataarray):
"""
Run grdtrack by passing in a pandas.DataFrame and xarray.DataArray as
inputs.
"""
dataframe = load_ocean_ridge_points()
output = grdtrack(points=dataframe, grid=dataarray, newcolname="bathymetry")
assert isinstance(output, pd.DataFrame)
assert output.columns.to_list() == ["longitude", "latitude", "bathymetry"]
> npt.assert_allclose(output.iloc[0], [-110.9536, -42.2489, -2974.656296])
E AssertionError:
E Not equal to tolerance rtol=1e-07, atol=0
E
E Mismatched elements: 1 / 3 (33.3%)
E Max absolute difference: 3.70371641e+28
E Max relative difference: 1.24509054e+25
E x: array([-1.109536e+02, -4.224890e+01, -3.703716e+28])
E y: array([ -110.9536 , -42.2489 , -2974.656296])
../../../../miniconda3/envs/pygmt/lib/python3.9/site-packages/pygmt/tests/test_grdtrack.py:38: AssertionError
----------------------------- Captured stderr call -----------------------------
Warning: [WARNING]: Some input points were outside the grid domain(s).
__________________ test_grdtrack_input_csvfile_and_dataarray ___________________
dataarray = <xarray.DataArray 'elevation' (lat: 8, lon: 12)>
array([[-3385. , -3201.5, -3104. , -2953. , -2754. , -2782. , -2957.5...elevation relative to the geoid
units: meters
vertical_datum: EMG96
horizontal_datum: WGS84
def test_grdtrack_input_csvfile_and_dataarray(dataarray):
"""
Run grdtrack by passing in a csvfile and xarray.DataArray as inputs.
"""
csvfile = which("@ridge.txt", download="c")
try:
output = grdtrack(points=csvfile, grid=dataarray, outfile=TEMP_TRACK)
assert output is None # check that output is None since outfile is set
assert os.path.exists(path=TEMP_TRACK) # check that outfile exists at path
track = pd.read_csv(TEMP_TRACK, sep="\t", header=None, comment=">")
> npt.assert_allclose(track.iloc[0], [-110.9536, -42.2489, -2974.656296])
E AssertionError:
E Not equal to tolerance rtol=1e-07, atol=0
E
E Mismatched elements: 1 / 3 (33.3%)
E Max absolute difference: 2.50459628e+26
E Max relative difference: 8.41978376e+22
E x: array([-1.109536e+02, -4.224890e+01, 2.504596e+26])
E y: array([ -110.9536 , -42.2489 , -2974.656296])
../../../../miniconda3/envs/pygmt/lib/python3.9/site-packages/pygmt/tests/test_grdtrack.py:55: AssertionError |
seisman
added a commit
that referenced
this pull request
Jun 8, 2021
* Remove xfail on grdtrack tests for GMT 6.2.0 * Update the grdtrack tests so that it pass for GMT 6.2.0
6 tasks
sixy6e
pushed a commit
to sixy6e/pygmt
that referenced
this pull request
Dec 21, 2022
* Remove xfail on grdtrack tests for GMT 6.2.0 * Update the grdtrack tests so that it pass for GMT 6.2.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
See #1309 for the issue report of an upstream bug. The bug was partially fixed in GenericMappingTools/gmt#5283, by restricting bilinear interpolation when grdtrack is applied to an xarray.DataArray.
Now the two tests pass for GMT 6.2.0.
Fixes #1309
Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash commands are:
/format: automatically format and lint the code/test-gmt-dev: run full tests on the latest GMT development version