@@ -1495,7 +1495,6 @@ def dirint(ghi, zenith, times, pressure=101325, use_delta_kt_prime=True,
14951495
14961496 kt_prime = kt / (1.031 * np .exp (- 1.4 / (0.9 + 9.4 / airmass )) + 0.1 )
14971497 kt_prime [kt_prime > 0.82 ] = 0.82 # From SRRL code. consider np.NaN
1498- kt_prime .fillna (0 , inplace = True )
14991498 pvl_logger .debug ('kt_prime:\n %s' , kt_prime )
15001499
15011500 # wholmgren:
@@ -1519,7 +1518,7 @@ def dirint(ghi, zenith, times, pressure=101325, use_delta_kt_prime=True,
15191518 # Later, we'll subtract 1 to conform to Python's 0-indexing.
15201519
15211520 # Create kt_prime bins
1522- kt_prime_bin = pd .Series (index = times )
1521+ kt_prime_bin = pd .Series (0 , index = times , dtype = np . int64 )
15231522 kt_prime_bin [(kt_prime >= 0 ) & (kt_prime < 0.24 )] = 1
15241523 kt_prime_bin [(kt_prime >= 0.24 ) & (kt_prime < 0.4 )] = 2
15251524 kt_prime_bin [(kt_prime >= 0.4 ) & (kt_prime < 0.56 )] = 3
@@ -1529,7 +1528,7 @@ def dirint(ghi, zenith, times, pressure=101325, use_delta_kt_prime=True,
15291528 pvl_logger .debug ('kt_prime_bin:\n %s' , kt_prime_bin )
15301529
15311530 # Create zenith angle bins
1532- zenith_bin = pd .Series (index = times )
1531+ zenith_bin = pd .Series (0 , index = times , dtype = np . int64 )
15331532 zenith_bin [(zenith >= 0 ) & (zenith < 25 )] = 1
15341533 zenith_bin [(zenith >= 25 ) & (zenith < 40 )] = 2
15351534 zenith_bin [(zenith >= 40 ) & (zenith < 55 )] = 3
@@ -1539,7 +1538,7 @@ def dirint(ghi, zenith, times, pressure=101325, use_delta_kt_prime=True,
15391538 pvl_logger .debug ('zenith_bin:\n %s' , zenith_bin )
15401539
15411540 # Create the bins for w based on dew point temperature
1542- w_bin = pd .Series (index = times )
1541+ w_bin = pd .Series (0 , index = times , dtype = np . int64 )
15431542 w_bin [(w >= 0 ) & (w < 1 )] = 1
15441543 w_bin [(w >= 1 ) & (w < 2 )] = 2
15451544 w_bin [(w >= 2 ) & (w < 3 )] = 3
@@ -1548,7 +1547,7 @@ def dirint(ghi, zenith, times, pressure=101325, use_delta_kt_prime=True,
15481547 pvl_logger .debug ('w_bin:\n %s' , w_bin )
15491548
15501549 # Create delta_kt_prime binning.
1551- delta_kt_prime_bin = pd .Series (index = times )
1550+ delta_kt_prime_bin = pd .Series (0 , index = times , dtype = np . int64 )
15521551 delta_kt_prime_bin [(delta_kt_prime >= 0 ) & (delta_kt_prime < 0.015 )] = 1
15531552 delta_kt_prime_bin [(delta_kt_prime >= 0.015 ) & (delta_kt_prime < 0.035 )] = 2
15541553 delta_kt_prime_bin [(delta_kt_prime >= 0.035 ) & (delta_kt_prime < 0.07 )] = 3
@@ -1562,6 +1561,10 @@ def dirint(ghi, zenith, times, pressure=101325, use_delta_kt_prime=True,
15621561 # assignment and Python-style array lookup.
15631562 dirint_coeffs = coeffs [kt_prime_bin - 1 , zenith_bin - 1 ,
15641563 delta_kt_prime_bin - 1 , w_bin - 1 ]
1564+ # convert unassigned bins to nan
1565+ # use where to avoid boolean indexing deprecation
1566+ dirint_coeffs [np .where ((kt_prime_bin == 0 ) | (zenith_bin == 0 ) |
1567+ (w_bin == 0 ) | (delta_kt_prime_bin == 0 ))] = np .nan
15651568
15661569 dni = disc_out ['dni' ] * dirint_coeffs
15671570
0 commit comments