@@ -353,6 +353,7 @@ def martin_ruiz_diffuse(surface_tilt, a_r=0.16, c1=0.4244, c2=None):
353353 # avoid undefined results for horizontal or upside-down surfaces
354354 zeroang = 1e-06
355355
356+
356357 surface_tilt = np .where (surface_tilt == 0 , zeroang , surface_tilt )
357358 surface_tilt = np .where (surface_tilt == 180 , 180 - zeroang , surface_tilt )
358359
@@ -361,8 +362,9 @@ def martin_ruiz_diffuse(surface_tilt, a_r=0.16, c1=0.4244, c2=None):
361362 c2 = 0.5 * a_r - 0.154
362363
363364 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
366368
367369 # avoid RuntimeWarnings for <, sin, and cos with nan
368370 with np .errstate (invalid = 'ignore' ):
@@ -372,8 +374,8 @@ def martin_ruiz_diffuse(surface_tilt, a_r=0.16, c1=0.4244, c2=None):
372374 trig_term_sky = sin_beta + (pi - beta - sin_beta ) / (1 + cos (beta ))
373375 trig_term_gnd = sin_beta + (beta - sin_beta ) / (1 - cos (beta )) # noqa: E222 E261 E501
374376
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 )
377379
378380 if out_index is not None :
379381 iam_sky = pd .Series (iam_sky , index = out_index , name = 'iam_sky' )
0 commit comments