Skip to content

Commit 46ce99e

Browse files
Fix docstrings for morton code and dilate_bits
1 parent 06211ab commit 46ce99e

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

parcels/spatialhash.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,26 @@ def _encode_morton3d(x, y, z, xmin, xmax, ymin, ymax, zmin, zmax):
368368
Quantize (x, y, z) to 10 bits each (0..1023), dilate the bits so there are
369369
two zeros between successive bits, and interleave them into a 3D Morton code.
370370
371+
Parameters
372+
----------
373+
x, y, z : array_like
374+
Input coordinates to encode. Can be scalars or arrays (broadcasting applies).
375+
xmin, xmax : float
376+
Minimum and maximum bounds for x coordinate.
377+
ymin, ymax : float
378+
Minimum and maximum bounds for y coordinate.
379+
zmin, zmax : float
380+
Minimum and maximum bounds for z coordinate.
381+
382+
Returns
383+
-------
384+
code : ndarray, dtype=uint32
385+
The resulting Morton codes, same shape as the broadcasted input coordinates.
386+
371387
Notes
372388
-----
373389
- Works with scalars or NumPy arrays (broadcasting applies).
374-
- Output is up to 30 bits; we return np.uint32 (or np.uint64 if you prefer).
375-
- Requires `part1by2` defined as in your previous snippet.
390+
- Output is up to 30 bits returned as uint32.
376391
"""
377392
# Convert inputs to ndarray for consistent dtype/ufunc behavior.
378393
x = np.asarray(x)

0 commit comments

Comments
 (0)