@@ -94,6 +94,12 @@ def perez_diffuse_luminance(timestamps, surface_tilt, surface_azimuth,
9494 am ,
9595 return_components = True )
9696
97+ # compatibility with pvlib<0.14.0
98+ components = components .rename (columns = {'isotropic' : 'poa_isotropic' ,
99+ 'circumsolar' : 'poa_circumsolar' ,
100+ 'horizon' : 'poa_horizon' ,
101+ 'sky_diffuse' : 'poa_sky_diffuse' })
102+
97103 # Calculate Perez view factors:
98104 a = irradiance .aoi_projection (
99105 df_inputs .surface_tilt ,
@@ -114,24 +120,19 @@ def perez_diffuse_luminance(timestamps, surface_tilt, surface_azimuth,
114120 # Calculate diffuse luminance
115121 luminance = pd .DataFrame (
116122 np .array ([
117- components ['horizon ' ] / vf_perez ['vf_horizon' ],
118- components ['circumsolar ' ] / vf_perez ['vf_circumsolar' ],
119- components ['isotropic ' ] / vf_perez ['vf_isotropic' ]
123+ components ['poa_horizon ' ] / vf_perez ['vf_horizon' ],
124+ components ['poa_circumsolar ' ] / vf_perez ['vf_circumsolar' ],
125+ components ['poa_isotropic ' ] / vf_perez ['vf_isotropic' ]
120126 ]).T ,
121127 index = df_inputs .index ,
122128 columns = ['luminance_horizon' , 'luminance_circumsolar' ,
123129 'luminance_isotropic' ]
124130 )
125- luminance .loc [components ['sky_diffuse' ] == 0 , :] = 0.
126-
127- # Format components column names
128- components = components .rename (columns = {'isotropic' : 'poa_isotropic' ,
129- 'circumsolar' : 'poa_circumsolar' ,
130- 'horizon' : 'poa_horizon' })
131+ luminance .loc [components ['poa_sky_diffuse' ] == 0 , :] = 0.
131132
132133 df_inputs = pd .concat ([df_inputs , components , vf_perez , luminance ],
133134 axis = 1 , join = 'outer' )
134- df_inputs = df_inputs .rename (columns = {'sky_diffuse ' : 'poa_total_diffuse' })
135+ df_inputs = df_inputs .rename (columns = {'poa_sky_diffuse ' : 'poa_total_diffuse' })
135136
136137 # Adjust the circumsolar luminance when it hits the back surface
137138 if df_inputs_back_surface .shape [0 ] > 0 :
0 commit comments