1616from pvlib import atmosphere , solarposition , tools
1717import pvlib # used to avoid dni name collision in complete_irradiance
1818
19+ from pvlib ._deprecation import pvlibDeprecationWarning
20+ import warnings
1921
20- # see References section of get_ground_diffuse function
21- SURFACE_ALBEDOS = {'urban' : 0.18 ,
22- 'grass' : 0.20 ,
23- 'fresh grass' : 0.26 ,
24- 'soil' : 0.17 ,
25- 'sand' : 0.40 ,
26- 'snow' : 0.65 ,
27- 'fresh snow' : 0.75 ,
28- 'asphalt' : 0.12 ,
29- 'concrete' : 0.30 ,
30- 'aluminum' : 0.85 ,
31- 'copper' : 0.74 ,
32- 'fresh steel' : 0.35 ,
33- 'dirty steel' : 0.08 ,
34- 'sea' : 0.06 }
22+
23+ # Deprecation warning based on https://peps.python.org/pep-0562/
24+ def __getattr__ (attr ):
25+ if attr == 'SURFACE_ALBEDOS' :
26+ warnings .warn (f"{ attr } has been moved to the albedo module as of "
27+ "v0.11.0. Please use pvlib.albedo.SURFACE_ALBEDOS." ,
28+ pvlibDeprecationWarning )
29+ return pvlib .albedo .SURFACE_ALBEDOS
30+ raise AttributeError (f"module { __name__ !r} has no attribute { attr !r} " )
3531
3632
3733def get_extra_radiation (datetime_or_doy , solar_constant = 1366.1 ,
@@ -550,7 +546,7 @@ def get_ground_diffuse(surface_tilt, ghi, albedo=.25, surface_type=None):
550546 Notes
551547 -----
552548 Table of albedo values by ``surface_type`` are from [2]_, [3]_, [4]_;
553- see :py:data :`~pvlib.irradiance .SURFACE_ALBEDOS`.
549+ see :py:const :`~pvlib.albedo .SURFACE_ALBEDOS`.
554550
555551 References
556552 ----------
@@ -565,7 +561,7 @@ def get_ground_diffuse(surface_tilt, ghi, albedo=.25, surface_type=None):
565561 '''
566562
567563 if surface_type is not None :
568- albedo = SURFACE_ALBEDOS [surface_type ]
564+ albedo = pvlib . albedo . SURFACE_ALBEDOS [surface_type ]
569565
570566 diffuse_irrad = ghi * albedo * (1 - np .cos (np .radians (surface_tilt ))) * 0.5
571567
@@ -2442,7 +2438,6 @@ def _gti_dirint_lt_90(poa_global, aoi, aoi_lt_90, solar_zenith, solar_azimuth,
24422438 else :
24432439 # we are here because we ran out of coeffs to loop over and
24442440 # therefore we have exceeded max_iterations
2445- import warnings
24462441 failed_points = best_diff [aoi_lt_90 ][~ best_diff_lte_1_lt_90 ]
24472442 warnings .warn (
24482443 ('%s points failed to converge after %s iterations. best_diff:\n %s'
@@ -2806,8 +2801,8 @@ def orgill_hollands(ghi, zenith, datetime_or_doy, dni_extra=None,
28062801 References
28072802 ----------
28082803 .. [1] Orgill, J.F., Hollands, K.G.T., Correlation equation for hourly
2809- diffuse radiation on a horizontal surface, Solar Energy 19(4), pp 357–359,
2810- 1977. Eqs. 3(a), 3(b) and 3(c)
2804+ diffuse radiation on a horizontal surface, Solar Energy 19(4),
2805+ pp 357–359, 1977. Eqs. 3(a), 3(b) and 3(c)
28112806 :doi:`10.1016/0038-092X(77)90006-8`
28122807
28132808 See Also
0 commit comments