@@ -173,14 +173,6 @@ def test_globcurrent_time_extrapolation_error(mode, use_xarray):
173173 pset .execute (AdvectionRK4 , runtime = delta (days = 1 ), dt = delta (minutes = 5 ))
174174
175175
176- @pytest .mark .parametrize ('mode' , ['scipy' , 'jit' ])
177- @pytest .mark .parametrize ('use_xarray' , [True , False ])
178- def test_globcurrent_dt0 (mode , use_xarray ):
179- fieldset = set_globcurrent_fieldset (use_xarray = use_xarray )
180- pset = ParticleSet (fieldset , pclass = ptype [mode ], lon = [25 ], lat = [- 35 ])
181- pset .execute (AdvectionRK4 , dt = 0. )
182-
183-
184176@pytest .mark .parametrize ('mode' , ['scipy' , 'jit' ])
185177@pytest .mark .parametrize ('dt' , [- 300 , 300 ])
186178@pytest .mark .parametrize ('with_starttime' , [True , False ])
@@ -260,3 +252,22 @@ def test_globcurrent_pset_fromfile(mode, dt, pid_offset, tmpdir):
260252
261253 for var in ['lon' , 'lat' , 'depth' , 'time' , 'id' ]:
262254 assert np .allclose ([getattr (p , var ) for p in pset ], [getattr (p , var ) for p in pset_new ])
255+
256+
257+ @pytest .mark .parametrize ('mode' , ['scipy' , 'jit' ])
258+ def test_error_outputdt_not_multiple_dt (mode , tmpdir ):
259+ # Test that outputdt is a multiple of dt
260+ fieldset = set_globcurrent_fieldset ()
261+
262+ filepath = tmpdir .join ("pfile_error_outputdt_not_multiple_dt.zarr" )
263+
264+ dt = 81.2584344538292 # number for which output writing fails
265+
266+ pset = ParticleSet (fieldset , pclass = ptype [mode ], lon = [0 ], lat = [0 ])
267+ ofile = pset .ParticleFile (name = filepath , outputdt = delta (days = 1 ))
268+
269+ def DoNothing (particle , fieldset , time ):
270+ pass
271+
272+ with pytest .raises (ValueError ):
273+ pset .execute (DoNothing , runtime = delta (days = 10 ), dt = dt , output_file = ofile )
0 commit comments