@@ -178,7 +178,7 @@ def smoo2(A, hei, wid, kind="hann", badflag=-9999, beta=14):
178178 # Checking window type and dimensions
179179 kinds = ["hann" , "hamming" , "blackman" , "bartlett" , "kaiser" ]
180180 if kind not in kinds :
181- raise ValueError ("Invalid window type requested: %s" % kind )
181+ raise ValueError (f "Invalid window type requested: { kind } " )
182182
183183 if (np .mod (hei , 2 ) == 0 ) or (np .mod (wid , 2 ) == 0 ):
184184 raise ValueError ("Window dimensions must be odd" )
@@ -205,7 +205,7 @@ def smoo2(A, hei, wid, kind="hann", badflag=-9999, beta=14):
205205 A = np .asanyarray (A )
206206 Fnan = np .isnan (A )
207207 imax , jmax = A .shape
208- As = np .NaN * np .ones ((imax , jmax ))
208+ As = np .nan * np .ones ((imax , jmax ))
209209
210210 for i in range (imax ):
211211 for j in range (jmax ):
@@ -257,7 +257,7 @@ def smoo2(A, hei, wid, kind="hann", badflag=-9999, beta=14):
257257 a = Ac * wdwc
258258 As [i , j ] = a .sum () / wdwc .sum ()
259259 # Assigning NaN to the positions holding NaNs in the original array.
260- As [Fnan ] = np .NaN
260+ As [Fnan ] = np .nan
261261
262262 return As
263263
@@ -302,7 +302,7 @@ def weim(x, N, kind="hann", badflag=-9999, beta=14):
302302 # Checking window type and dimensions.
303303 kinds = ["hann" , "hamming" , "blackman" , "bartlett" , "kaiser" ]
304304 if kind not in kinds :
305- raise ValueError ("Invalid window type requested: %s" % kind )
305+ raise ValueError (f "Invalid window type requested: { kind } " )
306306
307307 if np .mod (N , 2 ) == 0 :
308308 raise ValueError ("Window size must be odd" )
@@ -329,7 +329,7 @@ def weim(x, N, kind="hann", badflag=-9999, beta=14):
329329 ln = (N - 1 ) / 2
330330 lx = x .size
331331 lf = lx - ln
332- xs = np .NaN * np .ones (lx )
332+ xs = np .nan * np .ones (lx )
333333
334334 # Eliminating bad data from mean computation.
335335 fbad = x == badflag
@@ -459,7 +459,7 @@ def medfilt1(x, L=3):
459459 msg = "Input sequence has to be 1d: ndim = {}" .format
460460 raise ValueError (msg (xin .ndim ))
461461
462- xout = np .zeros_like (xin ) + np .NaN
462+ xout = np .zeros_like (xin ) + np .nan
463463
464464 Lwing = (L - 1 ) // 2
465465
@@ -538,7 +538,7 @@ def md_trenberth(x):
538538 >>> filtered = md_trenberth(x)
539539 >>> fig, ax = plt.subplots()
540540 >>> (l1,) = ax.plot(t, x, label="original")
541- >>> pad = [np.NaN ] * 5
541+ >>> pad = [np.nan ] * 5
542542 >>> (l2,) = ax.plot(t, np.r_[pad, filtered, pad], label="filtered")
543543 >>> legend = ax.legend()
544544
@@ -598,9 +598,9 @@ def pl33tn(x, dt=1.0, T=33.0, mode="valid", t=None):
598598 >>> filtered_33d3 = pl33tn(x, dt=4.0, T=72.0) # 3 day filter
599599 >>> fig, ax = plt.subplots()
600600 >>> (l1,) = ax.plot(t, x, label="original")
601- >>> pad = [np.NaN ] * 8
601+ >>> pad = [np.nan ] * 8
602602 >>> (l2,) = ax.plot(t, np.r_[pad, filtered_33, pad], label="33 hours")
603- >>> pad = [np.NaN ] * 17
603+ >>> pad = [np.nan ] * 17
604604 >>> (l3,) = ax.plot(t, np.r_[pad, filtered_33d3, pad], label="3 days")
605605 >>> legend = ax.legend()
606606
0 commit comments