Skip to content

Commit c1de237

Browse files
committed
make the bool init account for none binary concentration
1 parent a2e8fae commit c1de237

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

seaduck/eulerian.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ def from_bool_array(
232232
The field where the Positions are defined on.
233233
bool_array: numpy.ndarray, or xr.DataArray
234234
Points are generated where it is True.
235+
It could be an array of tracer concentration as well.
235236
num: int
236237
Total number of particles to seed (approximately).
237238
random_seed: int optional
@@ -259,7 +260,7 @@ def from_bool_array(
259260
self.tp = self.ocedata.tp
260261

261262
inds = np.where(bool_array)
262-
np_vol = np.array(data["Vol"])
263+
np_vol = np.array(data["Vol"] * bool_array)
263264
vols = np.array(np_vol[inds])
264265
num_each = np.round(vols * num / np.sum(vols)).astype(int)
265266
num = np.sum(num_each)

0 commit comments

Comments
 (0)