Skip to content

Commit 366e9d9

Browse files
Merge branch 'v4-dev' into feature/uxarray-get-faces-containing-points
2 parents 6282b77 + 8669a13 commit 366e9d9

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
build/*
22
docs/_build/*
33
docs/_downloads
4-
lib/
5-
bin/
6-
parcels_examples
74

8-
*.so
95
*.log
106
*.nc
117
*.nc4
128
!*testfields*.nc
139
out-*
14-
*.c
1510
*.pyc
16-
*.dSYM/*
1711
**/*.zarr/*
1812
.DS_store
1913

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Parcels documentation
22
=====================
33

44

5-
Welcome to the documentation of Parcels. **Parcels** (Probably A Really Computationally Efficient Lagrangian Simulator) is a set of Python classes and methods to create customisable particle tracking simulations using output from Ocean Circulation models. Parcels can be used to track passive and active particulates such as water, plankton, `plastic <http://www.topios.org/>`_ and `fish <https://github.com/Jacketless/IKAMOANA>`_.
5+
Welcome to the documentation of Parcels. **Parcels** provides a set of Python classes and methods to create customisable particle tracking simulations using gridded output from (ocean) circulation models. Parcels can be used to track passive and active particulates such as water, plankton, `plastic <http://www.topios.org/>`_ and `fish <https://github.com/Jacketless/IKAMOANA>`_.
66

77
.. figure:: _static/homepage.gif
88
:class: dark-light

tests/utils.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import struct
56
from pathlib import Path
67
from typing import TYPE_CHECKING
78

@@ -133,3 +134,16 @@ def assert_valid_field_data(data: xr.DataArray, grid: XGrid):
133134
if ax_actual is None:
134135
continue # None is ok
135136
assert ax_actual == ax_expected, f"Expected axis {ax_expected} for dimension '{dim}', got {ax_actual}"
137+
138+
139+
def hash_float_array(arr):
140+
# Adapted from https://cs.stackexchange.com/a/37965
141+
h = 1
142+
for f in arr:
143+
# Mimic Float.floatToIntBits: converts float to 4-byte binary, then interprets as int
144+
float_as_int = struct.unpack("!i", struct.pack("!f", f))[0]
145+
h = 31 * h + float_as_int
146+
147+
# Mimic Java's HashMap hash transformation
148+
h ^= (h >> 20) ^ (h >> 12)
149+
return h ^ (h >> 7) ^ (h >> 4)

0 commit comments

Comments
 (0)