@@ -353,6 +353,7 @@ def martin_ruiz_diffuse(surface_tilt, a_r=0.16, c1=0.4244, c2=None):
353
353
# avoid undefined results for horizontal or upside-down surfaces
354
354
zeroang = 1e-06
355
355
356
+
356
357
surface_tilt = np .where (surface_tilt == 0 , zeroang , surface_tilt )
357
358
surface_tilt = np .where (surface_tilt == 180 , 180 - zeroang , surface_tilt )
358
359
@@ -361,8 +362,9 @@ def martin_ruiz_diffuse(surface_tilt, a_r=0.16, c1=0.4244, c2=None):
361
362
c2 = 0.5 * a_r - 0.154
362
363
363
364
beta = np .radians (surface_tilt )
364
-
365
- from numpy import pi , sin , cos , exp
365
+ sin = np .sin
366
+ pi = np .pi
367
+ cos = np .cos
366
368
367
369
# avoid RuntimeWarnings for <, sin, and cos with nan
368
370
with np .errstate (invalid = 'ignore' ):
@@ -372,8 +374,8 @@ def martin_ruiz_diffuse(surface_tilt, a_r=0.16, c1=0.4244, c2=None):
372
374
trig_term_sky = sin_beta + (pi - beta - sin_beta ) / (1 + cos (beta ))
373
375
trig_term_gnd = sin_beta + (beta - sin_beta ) / (1 - cos (beta )) # noqa: E222 E261 E501
374
376
375
- iam_sky = 1 - exp (- (c1 + c2 * trig_term_sky ) * trig_term_sky / a_r )
376
- iam_gnd = 1 - exp (- (c1 + c2 * trig_term_gnd ) * trig_term_gnd / a_r )
377
+ iam_sky = 1 - np . exp (- (c1 + c2 * trig_term_sky ) * trig_term_sky / a_r )
378
+ iam_gnd = 1 - np . exp (- (c1 + c2 * trig_term_gnd ) * trig_term_gnd / a_r )
377
379
378
380
if out_index is not None :
379
381
iam_sky = pd .Series (iam_sky , index = out_index , name = 'iam_sky' )
0 commit comments