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

Broken test test_globcurrent_time_extrapolation_error #1737

Open
VeckoTheGecko opened this issue Oct 22, 2024 · 2 comments
Open

Broken test test_globcurrent_time_extrapolation_error #1737

VeckoTheGecko opened this issue Oct 22, 2024 · 2 comments

Comments

@VeckoTheGecko
Copy link
Contributor

I'm working on removing xfail from some tests so that we can use pytest.raises instead so that we're more specific. The following test

@pytest.mark.xfail(reason="Time extrapolation error expected to be thrown", strict=True)
@pytest.mark.parametrize("mode", ["scipy", "jit"])
@pytest.mark.parametrize("use_xarray", [True, False])
def test_globcurrent_time_extrapolation_error(mode, use_xarray):
fieldset = set_globcurrent_fieldset(use_xarray=use_xarray)
pset = parcels.ParticleSet(
fieldset,
pclass=ptype[mode],
lon=[25],
lat=[-35],
time=fieldset.U.time[0] - timedelta(days=1).total_seconds(),
)
pset.execute(
parcels.AdvectionRK4, runtime=timedelta(days=1), dt=timedelta(minutes=5)
)

errors with

    @pytest.mark.parametrize("mode", ["scipy", "jit"])
    @pytest.mark.parametrize("use_xarray", [True, False])
    def test_globcurrent_time_extrapolation_error(mode, use_xarray):
        fieldset = set_globcurrent_fieldset(use_xarray=use_xarray)
    
        pset = parcels.ParticleSet(
            fieldset,
            pclass=ptype[mode],
            lon=[25],
            lat=[-35],
>           time=fieldset.U.time[0] - timedelta(days=1).total_seconds(),
        )
E       AttributeError: 'Field' object has no attribute 'time'

docs/examples/example_globcurrent.py:233: AttributeError
________________________________________ test_globcurrent_time_extrapolation_error[False-jit] _____

This is a broken test

(imo, xfail should be reserved for features that are not yet implemented, or platform incompatability, etc)

@erikvansebille
Copy link
Member

Is this a matter of simply changing fieldset.U.time[0] to fieldset.U.grid.time[0]?

@VeckoTheGecko
Copy link
Contributor Author

Oh yes. I thought we had a property Field.time but it looks like its just lon and lat. I'll put up a patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

2 participants