Skip to content

Commit 76788bf

Browse files
committed
igneore unnecessary numpy warnings
1 parent 3f352fb commit 76788bf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

climada/hazard/trop_cyclone.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def _vtrans_holland(track, i_node, close_centr, r_arr, ureg):
332332
centroids_dlat = close_centr[:, 0] - track.lat[i_node].values
333333

334334
# scalar product, a*b=|a|*|b|*cos(phi), phi angle between vectors
335-
with np.errstate(invalid='print'):
335+
with np.errstate(invalid='ignore'):
336336
cos_phi = (centroids_dlon * node_dx + centroids_dlat * node_dy) / \
337337
LA.norm([centroids_dlon, centroids_dlat], axis=0) / node_dlen
338338

@@ -343,7 +343,7 @@ def _vtrans_holland(track, i_node, close_centr, r_arr, ureg):
343343
# calculate v_trans wind field array assuming that
344344
# - effect of v_trans decreases with distance from eye (r_arr_normed)
345345
# - v_trans is added 100% to the right of the track, 0% in front (cos_phi)
346-
with np.errstate(all='ignore'):
346+
with np.errstate(divide='ignore', invalid='ignore'):
347347
r_arr_normed = track.radius_max_wind[i_node].values / r_arr
348348
r_arr_normed[r_arr_normed > 1] = 1
349349

@@ -364,7 +364,7 @@ def _bs_value(v_trans, penv, pcen, prepcen, lat, hol_xx, tint):
364364
Returns:
365365
float
366366
"""
367-
with np.errstate(all='ignore'):
367+
with np.errstate(invalid='ignore', divide='ignore'):
368368
return -4.4e-5 * (penv - pcen)**2 + 0.01 * (penv-pcen) + \
369369
0.03 * (pcen - prepcen) / tint - 0.014 * abs(lat) + \
370370
0.15 * v_trans**hol_xx + 1.0
@@ -388,7 +388,7 @@ def _stat_holland(r_arr, r_max, hol_b, penv, pcen, ycoord):
388388
f_val = 2 * 0.0000729 * np.sin(np.abs(ycoord) * np.pi / 180)
389389
r_arr_mult = 0.5 * 1000 * r_arr * f_val
390390
# units are m/s
391-
with np.errstate(all='ignore'):
391+
with np.errstate(divide='ignore', invalid='ignore'):
392392
r_max_norm = (r_max/r_arr)**hol_b
393393
return np.sqrt(100 * hol_b / rho * r_max_norm * (penv - pcen) *
394394
np.exp(-r_max_norm) + r_arr_mult**2) - r_arr_mult

0 commit comments

Comments
 (0)