-
Notifications
You must be signed in to change notification settings - Fork 225
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
Remove xfail on grdtrack tests for GMT 6.2.0 #1304
Conversation
Weird. These two tests are "xpass" on master branch. |
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 |
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.
🚀
* Remove xfail on grdtrack tests for GMT 6.2.0 * Update the grdtrack tests so that it pass for GMT 6.2.0
* Remove xfail on grdtrack tests for GMT 6.2.0 * Update the grdtrack tests so that it pass for GMT 6.2.0
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 format
andmake check
to 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