What version of Parcels are you running?
v4
Is your feature request related to a problem?
Running pytest tests/ now throws a lot of warnings (see list below for 481decc). Although a few of these are upstream (so we can't solve them), most of these are in our own code. It would be good to fix these
Once the list is empty, we can implement #2413 to fail on warnings
src/parcels/_datasets/remote.py:195
tests/test_advection.py::test_nemo_curvilinear_fieldset
tests/test_convert.py::test_convert_nemo_offsets
tests/test_index_search.py::test_indexing_nemo_curvilinear
/Users/erik/Codes/parcels/src/parcels/_datasets/remote.py:195: FutureWarning: dropping variables using `drop` is deprecated; use drop_vars.
return ds.isel(time=0).drop(["time"])
tests/sgrid/test_accessor.py: 214 warnings
tests/test_advection.py: 12 warnings
/Users/erik/Codes/parcels/src/parcels/_sgrid/accessor.py:101: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
n_nodes = ds.dims[node]
tests/sgrid/test_accessor.py: 214 warnings
tests/test_advection.py: 12 warnings
/Users/erik/Codes/parcels/src/parcels/_sgrid/accessor.py:105: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
n_faces = ds.dims[face]
tests/sgrid/test_accessor.py::test_isel[node_dimension1-face_dimension1-indexer0-ds_2d_padded_high]
tests/sgrid/test_accessor.py::test_isel[node_dimension1-face_dimension1-indexer0-ds_2d_padded_low]
tests/sgrid/test_accessor.py::test_isel[node_dimension1-face_dimension1-indexer1-ds_2d_padded_high]
tests/sgrid/test_accessor.py::test_isel[node_dimension1-face_dimension1-indexer1-ds_2d_padded_low]
tests/sgrid/test_accessor.py::test_isel[node_dimension2-face_dimension2-indexer0-ds_2d_padded_high]
tests/sgrid/test_accessor.py::test_isel[node_dimension2-face_dimension2-indexer0-ds_2d_padded_low]
tests/sgrid/test_accessor.py::test_isel[node_dimension2-face_dimension2-indexer1-ds_2d_padded_high]
tests/sgrid/test_accessor.py::test_isel[node_dimension2-face_dimension2-indexer1-ds_2d_padded_low]
/Users/erik/Codes/parcels/tests/sgrid/test_accessor.py:154: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
for dim, size_before in ds.dims.items():
tests/sgrid/test_accessor.py: 10 warnings
<frozen _collections_abc>:883: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
tests/sgrid/test_accessor.py::test_isel[node_dimension1-face_dimension1-indexer0-ds_2d_padded_high]
tests/sgrid/test_accessor.py::test_isel[node_dimension1-face_dimension1-indexer0-ds_2d_padded_low]
tests/sgrid/test_accessor.py::test_isel[node_dimension1-face_dimension1-indexer1-ds_2d_padded_high]
tests/sgrid/test_accessor.py::test_isel[node_dimension1-face_dimension1-indexer1-ds_2d_padded_low]
tests/sgrid/test_accessor.py::test_isel[node_dimension2-face_dimension2-indexer0-ds_2d_padded_high]
tests/sgrid/test_accessor.py::test_isel[node_dimension2-face_dimension2-indexer0-ds_2d_padded_low]
tests/sgrid/test_accessor.py::test_isel[node_dimension2-face_dimension2-indexer1-ds_2d_padded_high]
tests/sgrid/test_accessor.py::test_isel[node_dimension2-face_dimension2-indexer1-ds_2d_padded_low]
/Users/erik/Codes/parcels/tests/sgrid/test_accessor.py:157: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
size_after = ds_trimmed.dims[dim]
tests/sgrid/test_accessor.py::test_isel_drop_dim[ds_2d_padded_high]
tests/sgrid/test_accessor.py::test_isel_drop_dim[ds_2d_padded_low]
/Users/erik/Codes/parcels/tests/sgrid/test_accessor.py:170: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
for dim, size_after in ds_trimmed.dims.items():
tests/sgrid/test_accessor.py::test_isel_drop_dim[ds_2d_padded_high]
tests/sgrid/test_accessor.py::test_isel_drop_dim[ds_2d_padded_low]
/Users/erik/Codes/parcels/tests/sgrid/test_accessor.py:171: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
size_before = ds.dims[dim]
tests/sgrid/test_accessor.py::test_isel_p1_consistency_invariant
/Users/erik/Codes/parcels/tests/sgrid/test_accessor.py:204: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
n_nodes = ds.dims[node_dim]
tests/sgrid/test_accessor.py: 100 warnings
/Users/erik/Codes/parcels/tests/sgrid/test_accessor.py:222: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
n_nodes = ds.dims[node_dim]
tests/sgrid/test_accessor.py: 100 warnings
/Users/erik/Codes/parcels/tests/sgrid/test_accessor.py:252: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
n_nodes = ds.dims[node_dim]
tests/sgrid/test_accessor.py: 100 warnings
/Users/erik/Codes/parcels/tests/sgrid/test_accessor.py:259: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
n_faces = ds.dims.get(face_dim)
tests/sgrid/test_accessor.py: 100 warnings
<frozen _collections_abc>:795: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
tests/sgrid/test_sgrid.py: 101 warnings
/Users/erik/Codes/parcels/.pixi/envs/default/lib/python3.14/site-packages/xgcm/grid.py:196: DeprecationWarning: The `periodic` argument will be deprecated. To preserve previous behavior supply `boundary = 'periodic'.
warnings.warn(
tests/test_advection.py::test_advection_zonal_periodic
/Users/erik/Codes/parcels/tests/test_advection.py:94: FutureWarning: In a future version of xarray the default value for data_vars will change from data_vars='all' to data_vars=None. This is likely to lead to different results when multiple datasets have matching variables with overlapping values. To opt in to new defaults and get rid of these warnings now use `set_options(use_new_combine_kwarg_defaults=True) or set data_vars explicitly.
ds = xr.concat([ds, halo], dim="XG")
tests/test_advection.py::test_moving_eddy[AdvectionRK45-0.0001]
tests/test_advection.py::test_stommelgyre_fieldset[A-AdvectionRK45-0.1]
tests/test_advection.py::test_stommelgyre_fieldset[C-AdvectionRK45-0.1]
tests/test_advection.py::test_peninsula_fieldset[A-AdvectionRK45-0.001]
tests/test_particleset_execute.py::test_particleset_run_RK_to_endtime_fwd_bwd[dt0-AdvectionRK45]
tests/test_particleset_execute.py::test_particleset_run_RK_to_endtime_fwd_bwd[dt1-AdvectionRK45]
/Users/erik/Codes/parcels/src/parcels/_core/kernel.py:79: KernelWarning: Setting RK45 minimum timestep to 1 s. Use fieldset.add_context('RK45_min_dt', [timestep]) to change.
self.check_fieldsets_in_kernels(f)
tests/test_advection.py::test_moving_eddy[AdvectionRK45-0.0001]
tests/test_advection.py::test_decaying_moving_eddy[AdvectionRK45-0.0001]
tests/test_advection.py::test_stommelgyre_fieldset[A-AdvectionRK45-0.1]
tests/test_advection.py::test_stommelgyre_fieldset[C-AdvectionRK45-0.1]
tests/test_advection.py::test_peninsula_fieldset[A-AdvectionRK45-0.001]
tests/test_particleset_execute.py::test_particleset_run_RK_to_endtime_fwd_bwd[dt0-AdvectionRK45]
tests/test_particleset_execute.py::test_particleset_run_RK_to_endtime_fwd_bwd[dt1-AdvectionRK45]
/Users/erik/Codes/parcels/src/parcels/_core/kernel.py:79: KernelWarning: Setting RK45 maximum timestep to 1 day. Use fieldset.add_context('RK45_max_dt', [timestep]) to change.
self.check_fieldsets_in_kernels(f)
tests/test_advection.py::test_nemo_curvilinear_fieldset
tests/test_convert.py::test_nemo_to_sgrid_2d[NemoCurvilinear_data_zonal]
tests/test_convert.py::test_convert_nemo_offsets
/Users/erik/Codes/parcels/src/parcels/convert.py:139: UserWarning: No depth dimension found in your dataset. Assuming no depth (i.e., surface data).
warnings.warn("No depth dimension found in your dataset. Assuming no depth (i.e., surface data).", stacklevel=1)
tests/test_advection.py::test_nemo_3D_curvilinear_fieldset[AdvectionRK4]
tests/test_advection.py::test_nemo_3D_curvilinear_fieldset[AdvectionRK4_3D]
/Users/erik/Codes/parcels/src/parcels/_datasets/remote.py:190: FutureWarning: dropping variables using `drop` is deprecated; use drop_vars.
return ds.isel(time=0).drop(["time", "time_steps"])
tests/test_interpolation.py::test_spatial_slip_interpolation[XPartialslip-1-0-0-0.0-expected0]
/Users/erik/Codes/parcels/src/parcels/interpolators/_xinterpolators.py:419: RuntimeWarning: divide by zero encountered in divide
f_u = np.where(is_land(0, 0, 0, 0) & is_land(0, 0, 0, 1) & (eta > 0), f_u * (a + b * eta) / eta, f_u)
tests/test_interpolation.py::test_spatial_slip_interpolation[XPartialslip-1-0-0-0.0-expected0]
/Users/erik/Codes/parcels/src/parcels/interpolators/_xinterpolators.py:421: RuntimeWarning: divide by zero encountered in divide
f_v = np.where(is_land(0, 0, 0, 0) & is_land(0, 0, 1, 0) & (xsi > 0), f_v * (a + b * xsi) / xsi, f_v)
tests/test_interpolation.py: 6 warnings
tests/test_particleset_execute.py: 7 warnings
tests/test_sigmagrids.py: 1 warning
/Users/erik/Codes/parcels/src/parcels/_core/field.py:203: RuntimeWarning: Sampling of velocities should normally be done using fieldset.UV or fieldset.UVW object; tread carefully
self._check_velocitysampling()
tests/test_particlefile.py::test_time_is_age[outputdt1]
tests/test_particlefile.py::test_time_is_age[outputdt2]
/Users/erik/Codes/parcels/src/parcels/_core/particleset.py:413: ParticleSetWarning: Some of the particles have a start time difference that is not a multiple of outputdt. This could cause the first output of some of the particles that start later in the simulation to be at a different time than expected.
_warn_outputdt_release_desync(outputdt, start_time, self._data["time"][:])
tests/test_particleset_execute.py::test_pset_execute_invalid_arguments
/Users/erik/Codes/parcels/src/parcels/_core/particleset.py:496: RuntimeWarning: invalid value encountered in cast
sign_dt = np.sign(dt).astype(int)
tests/test_particleset_execute.py::test_particleset_run_RK_to_endtime_fwd_bwd[dt0-AdvectionRK45]
tests/test_particleset_execute.py::test_particleset_run_RK_to_endtime_fwd_bwd[dt1-AdvectionRK45]
/Users/erik/Codes/parcels/src/parcels/_core/kernel.py:79: KernelWarning: Setting RK45 tolerance to 10 m. Use fieldset.add_context('RK45_tol', [distance]) to change.
self.check_fieldsets_in_kernels(f)
tests/test_spatialhash.py::test_invalid_positions
tests/test_spatialhash.py::test_mixed_positions
/Users/erik/Codes/parcels/src/parcels/_core/spatialhash.py:592: RuntimeWarning: invalid value encountered in cast
xq = np.clip((xn * bitwidth).astype(np.uint32), 0, bitwidth)
tests/test_spatialhash.py::test_invalid_positions
tests/test_spatialhash.py::test_mixed_positions
/Users/erik/Codes/parcels/src/parcels/_core/spatialhash.py:593: RuntimeWarning: invalid value encountered in cast
yq = np.clip((yn * bitwidth).astype(np.uint32), 0, bitwidth)
tests/test_xgrid.py::test_vertical1D_field[ds0]
/Users/erik/Codes/parcels/tests/test_xgrid.py:189: FutureWarning: dropping variables using `drop` is deprecated; use drop_vars.
ds = ds.drop(set(ds.data_vars) - {"grid"})
Describe the solution you'd like
Go in and fix all the code that these warnings point to
Describe alternatives you've considered
No response
Additional context
No response
What version of Parcels are you running?
v4
Is your feature request related to a problem?
Running
pytest tests/now throws a lot of warnings (see list below for 481decc). Although a few of these are upstream (so we can't solve them), most of these are in our own code. It would be good to fix theseOnce the list is empty, we can implement #2413 to fail on warnings
Describe the solution you'd like
Go in and fix all the code that these warnings point to
Describe alternatives you've considered
No response
Additional context
No response