Skip to content

Commit 049c442

Browse files
Fixes TypeError when casting arrays to scalar with Numpy>=2.4 (#1264)
* Applies fix * Apply suggestion from @spjuhel * Apply suggestion from @emanuel-schmid Co-authored-by: Emanuel Schmid <51439563+emanuel-schmid@users.noreply.github.com> --------- Co-authored-by: Emanuel Schmid <51439563+emanuel-schmid@users.noreply.github.com>
1 parent 081a02b commit 049c442

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

climada/hazard/tc_tracks_synth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ def _apply_decay_coeffs(track, v_rel, p_rel, land_geom, s_rel):
10491049
# if there is no further landfall, correct until the end of
10501050
# the track
10511051
end_cor = track["time"].size
1052-
rndn = 0.1 * float(np.abs(np.random.normal(size=1) * 5) + 6)
1052+
rndn = 0.1 * float(np.abs(np.random.default_rng().normal() * 5) + 6)
10531053
r_diff = (
10541054
track["central_pressure"][land_sea].values
10551055
- track["central_pressure"][land_sea - 1].values

climada/util/hdf5_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def get_string(array):
8989
-------
9090
string
9191
"""
92-
return "".join(chr(int(c)) for c in array)
92+
return "".join(chr(c.item()) for c in array)
9393

9494

9595
def get_str_from_ref(file_name, var):

0 commit comments

Comments
 (0)