@@ -178,7 +178,7 @@ def smoo2(A, hei, wid, kind="hann", badflag=-9999, beta=14):
178
178
# Checking window type and dimensions
179
179
kinds = ["hann" , "hamming" , "blackman" , "bartlett" , "kaiser" ]
180
180
if kind not in kinds :
181
- raise ValueError ("Invalid window type requested: %s" % kind )
181
+ raise ValueError (f "Invalid window type requested: { kind } " )
182
182
183
183
if (np .mod (hei , 2 ) == 0 ) or (np .mod (wid , 2 ) == 0 ):
184
184
raise ValueError ("Window dimensions must be odd" )
@@ -205,7 +205,7 @@ def smoo2(A, hei, wid, kind="hann", badflag=-9999, beta=14):
205
205
A = np .asanyarray (A )
206
206
Fnan = np .isnan (A )
207
207
imax , jmax = A .shape
208
- As = np .NaN * np .ones ((imax , jmax ))
208
+ As = np .nan * np .ones ((imax , jmax ))
209
209
210
210
for i in range (imax ):
211
211
for j in range (jmax ):
@@ -257,7 +257,7 @@ def smoo2(A, hei, wid, kind="hann", badflag=-9999, beta=14):
257
257
a = Ac * wdwc
258
258
As [i , j ] = a .sum () / wdwc .sum ()
259
259
# Assigning NaN to the positions holding NaNs in the original array.
260
- As [Fnan ] = np .NaN
260
+ As [Fnan ] = np .nan
261
261
262
262
return As
263
263
@@ -302,7 +302,7 @@ def weim(x, N, kind="hann", badflag=-9999, beta=14):
302
302
# Checking window type and dimensions.
303
303
kinds = ["hann" , "hamming" , "blackman" , "bartlett" , "kaiser" ]
304
304
if kind not in kinds :
305
- raise ValueError ("Invalid window type requested: %s" % kind )
305
+ raise ValueError (f "Invalid window type requested: { kind } " )
306
306
307
307
if np .mod (N , 2 ) == 0 :
308
308
raise ValueError ("Window size must be odd" )
@@ -329,7 +329,7 @@ def weim(x, N, kind="hann", badflag=-9999, beta=14):
329
329
ln = (N - 1 ) / 2
330
330
lx = x .size
331
331
lf = lx - ln
332
- xs = np .NaN * np .ones (lx )
332
+ xs = np .nan * np .ones (lx )
333
333
334
334
# Eliminating bad data from mean computation.
335
335
fbad = x == badflag
@@ -459,7 +459,7 @@ def medfilt1(x, L=3):
459
459
msg = "Input sequence has to be 1d: ndim = {}" .format
460
460
raise ValueError (msg (xin .ndim ))
461
461
462
- xout = np .zeros_like (xin ) + np .NaN
462
+ xout = np .zeros_like (xin ) + np .nan
463
463
464
464
Lwing = (L - 1 ) // 2
465
465
@@ -538,7 +538,7 @@ def md_trenberth(x):
538
538
>>> filtered = md_trenberth(x)
539
539
>>> fig, ax = plt.subplots()
540
540
>>> (l1,) = ax.plot(t, x, label="original")
541
- >>> pad = [np.NaN ] * 5
541
+ >>> pad = [np.nan ] * 5
542
542
>>> (l2,) = ax.plot(t, np.r_[pad, filtered, pad], label="filtered")
543
543
>>> legend = ax.legend()
544
544
@@ -598,9 +598,9 @@ def pl33tn(x, dt=1.0, T=33.0, mode="valid", t=None):
598
598
>>> filtered_33d3 = pl33tn(x, dt=4.0, T=72.0) # 3 day filter
599
599
>>> fig, ax = plt.subplots()
600
600
>>> (l1,) = ax.plot(t, x, label="original")
601
- >>> pad = [np.NaN ] * 8
601
+ >>> pad = [np.nan ] * 8
602
602
>>> (l2,) = ax.plot(t, np.r_[pad, filtered_33, pad], label="33 hours")
603
- >>> pad = [np.NaN ] * 17
603
+ >>> pad = [np.nan ] * 17
604
604
>>> (l3,) = ax.plot(t, np.r_[pad, filtered_33d3, pad], label="3 days")
605
605
>>> legend = ax.legend()
606
606
0 commit comments