Skip to content

Commit

Permalink
add comment explaining types
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwilby authored and tom-andersson committed Jan 15, 2025
1 parent 2234cc2 commit 191dfd7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions deepsensor/data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def compute_xarray_data_resolution(ds: Union[xr.DataArray, xr.Dataset]) -> float
"""
x1_res = np.abs(np.mean(np.diff(ds["x1"])))
x2_res = np.abs(np.mean(np.diff(ds["x2"])))

# ensure float type, since numpy 2, np.mean returns a numpy float32
data_resolution = float(np.min([x1_res, x2_res]))
return data_resolution

Expand Down

0 comments on commit 191dfd7

Please sign in to comment.