Skip to content

Commit 38709fb

Browse files
committed
Update create_particle_data arg
Make it explicitly an initial dict rather than as kwargs
1 parent c67f6c4 commit 38709fb

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

parcels/particle.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,16 @@ def get_default_particle(spatial_dtype: np.float32 | np.float64) -> ParticleClas
189189

190190

191191
def create_particle_data(
192-
*, pclass: ParticleClass, nparticles: int, ngrids: int, time_interval: TimeInterval, **initial: dict[str, np.array]
192+
*,
193+
pclass: ParticleClass,
194+
nparticles: int,
195+
ngrids: int,
196+
time_interval: TimeInterval,
197+
initial: dict[str, np.array] | None,
193198
):
199+
if initial is None:
200+
initial = {}
201+
194202
variables = {var.name: var for var in pclass.variables}
195203

196204
assert "ei" not in initial, "'ei' is for internal use, and is unique since is only non 1D array"

parcels/particleset.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,17 @@ def __init__(
122122
nparticles=lon.size,
123123
ngrids=len(fieldset.gridset),
124124
time_interval=fieldset.time_interval,
125-
lon=lon,
126-
lat=lat,
127-
depth=depth,
128-
time=time,
129-
lon_nextloop=lon,
130-
lat_nextloop=lat,
131-
depth_nextloop=depth,
132-
time_nextloop=time,
133-
id=trajectory_ids,
125+
initial=dict(
126+
lon=lon,
127+
lat=lat,
128+
depth=depth,
129+
time=time,
130+
lon_nextloop=lon,
131+
lat_nextloop=lat,
132+
depth_nextloop=depth,
133+
time_nextloop=time,
134+
id=trajectory_ids,
135+
),
134136
)
135137
self._ptype = pclass
136138

0 commit comments

Comments
 (0)