We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4a01f43 commit 7a77039Copy full SHA for 7a77039
parcels/spatialhash.py
@@ -86,7 +86,10 @@ def _hash_index2d(self, coords):
86
coordinates (in degrees)
87
"""
88
# Wrap longitude to [-180, 180]
89
- lon = coords[:, 1]
+ if self._source_grid.mesh == "spherical":
90
+ lon = (coords[:, 1] + 180.0) % (360.0) - 180.0
91
+ else:
92
+ lon = coords[:, 1]
93
i = ((lon - self._xmin) / self._dh).astype(np.int32)
94
j = ((coords[:, 0] - self._ymin) / self._dh).astype(np.int32)
95
return j, i
0 commit comments