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

x2sys_cross tests fail on macOS-14 #3194

Open
seisman opened this issue Apr 23, 2024 · 2 comments
Open

x2sys_cross tests fail on macOS-14 #3194

seisman opened this issue Apr 23, 2024 · 2 comments
Labels
maintenance Boring but important stuff for the core devs upstream Bug or missing feature of upstream core GMT

Comments

@seisman
Copy link
Member

seisman commented Apr 23, 2024

https://github.blog/changelog/2024-04-01-macos-14-sonoma-is-generally-available-and-the-latest-macos-runner-image/

macos-latest has migrated from macOS-12 to macOS-14 in a few hours ago. All tests are good except x2sys_cross tests.

The failures are:

=================================== FAILURES ===================================
_________________ test_x2sys_cross_input_file_output_dataframe _________________

    @pytest.mark.usefixtures("mock_x2sys_home")
    @pytest.mark.xfail(
        condition=Version(__gmt_version__) < Version("6.5.0"),
        reason="Upstream bug fixed in https://github.com/GenericMappingTools/gmt/pull/8188",
    )
    def test_x2sys_cross_input_file_output_dataframe():
        """
        Run x2sys_cross by passing in a filename, and output internal crossovers to a
        pandas.DataFrame.
        """
        with TemporaryDirectory(prefix="X2SYS", dir=Path.cwd()) as tmpdir:
            tag = Path(tmpdir).name
            x2sys_init(tag=tag, fmtfile="xyz", force=True)
            output = x2sys_cross(tracks=["@tut_ship.xyz"], tag=tag, coe="i")
    
            assert isinstance(output, pd.DataFrame)
>           assert output.shape == (14338, 12)
E           assert (14374, 12) == (14338, 12)
E             
E             At index 0 diff: 14374 != 14338
E             
E             Full diff:
E               (
E             -     14338,
E             ?        ^^
E             +     14374,
E             ?        ^^
E                   12,
E               )

../pygmt/tests/test_x2sys_cross.py:76: AssertionError
----------------------------- Captured stderr call -----------------------------
Warning: ss [WARNING]: No time column, use dummy times
_______________ test_x2sys_cross_region_interpolation_numpoints ________________

    @pytest.mark.usefixtures("mock_x2sys_home")
    @pytest.mark.xfail(
        condition=Version(__gmt_version__) < Version("6.5.0"),
        reason="Upstream bug fixed in https://github.com/GenericMappingTools/gmt/pull/8188",
    )
    def test_x2sys_cross_region_interpolation_numpoints():
        """
        Test that x2sys_cross's region (R), interpolation (l) and numpoints (W) arguments
        work.
        """
        with TemporaryDirectory(prefix="X2SYS", dir=Path.cwd()) as tmpdir:
            tag = Path(tmpdir).name
            x2sys_init(tag=tag, fmtfile="xyz", force=True)
            output = x2sys_cross(
                tracks=["@tut_ship.xyz"],
                tag=tag,
                coe="i",
                region=[245, 250, 20, 25],
                interpolation="a",  # Akima spline interpolation
                numpoints=5,  # Use up to 5 data points in interpolation
            )
    
            assert isinstance(output, pd.DataFrame)
>           assert output.shape == (3882, 12)
E           assert (3894, 12) == (3882, 12)
E             
E             At index 0 diff: 3894 != 3882
E             
E             Full diff:
E               (
E             -     3882,
E             ?       ^^
E             +     3894,
E             ?       ^^
E                   12,
E               )

../pygmt/tests/test_x2sys_cross.py:224: AssertionError
----------------------------- Captured stderr call -----------------------------
Warning: ss [WARNING]: No time column, use dummy times
_________________________ test_x2sys_cross_trackvalues _________________________

    @pytest.mark.usefixtures("mock_x2sys_home")
    @pytest.mark.xfail(
        condition=Version(__gmt_version__) < Version("6.5.0"),
        reason="Upstream bug fixed in https://github.com/GenericMappingTools/gmt/pull/8188",
    )
    def test_x2sys_cross_trackvalues():
        """
        Test that x2sys_cross's trackvalues (Z) argument work.
        """
        with TemporaryDirectory(prefix="X2SYS", dir=Path.cwd()) as tmpdir:
            tag = Path(tmpdir).name
            x2sys_init(tag=tag, fmtfile="xyz", force=True)
            output = x2sys_cross(tracks=["@tut_ship.xyz"], tag=tag, trackvalues=True)
    
            assert isinstance(output, pd.DataFrame)
>           assert output.shape == (14338, 12)
E           assert (14374, 12) == (14338, 12)
E             
E             At index 0 diff: 14374 != 14338
E             
E             Full diff:
E               (
E             -     14338,
E             ?        ^^
E             +     14374,
E             ?        ^^
E                   12,
E               )

For reference, the data shapes were updated in PR #2986 after the upstream fix GenericMappingTools/gmt#8188.

In GenericMappingTools/gmt#8188, if (tx_a < ta_stop && tx_b < tb_stop) was changed to if (tx_a < ta_stop && tx_b <= tb_stop). I guess the floating-point comparison may be tricky and depend on the C compiler.

@weiji14
Copy link
Member

weiji14 commented Apr 23, 2024

Yeah, seems like these same tests were failing in our GMT Dev Tests since we bumped to macos-14 as mentioned at #3024 (review), see https://github.com/GenericMappingTools/pygmt/actions/runs/7764289384/job/21177511396.

In GenericMappingTools/gmt#8188, if (tx_a < ta_stop && tx_b < tb_stop) was changed to if (tx_a < ta_stop && tx_b <= tb_stop). I guess the floating-point comparison may be tricky and depend on the C compiler.

Should we xfail this then on macOS, since the floating point comparison is consistent on Linux and Windows? Or pin to e.g. macos-13 for now (though this only delays the issue).

@weiji14 weiji14 added the maintenance Boring but important stuff for the core devs label Apr 23, 2024
@seisman
Copy link
Member Author

seisman commented Apr 23, 2024

Should we xfail this then on macOS,

i think yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs upstream Bug or missing feature of upstream core GMT
Projects
None yet
Development

No branches or pull requests

2 participants