diff --git a/docs/sphinx/whatsnew/v1.6.1.rst b/docs/sphinx/whatsnew/v1.6.1.rst index 1cb2230..48f91b7 100644 --- a/docs/sphinx/whatsnew/v1.6.1.rst +++ b/docs/sphinx/whatsnew/v1.6.1.rst @@ -3,13 +3,15 @@ v1.6.1 (??) ========== +Enhancements +------------ +* Compatibility with pvlib >=0.14.0. (:pull:`39`) Maintenance ----------- * Drop Python 3.8 and 3.9 support (:pull:`30`, :pull:`33`) * Add Python 3.14 support (:pull:`35`) - Documentation ------------- * Fixed typo in README. (:issue:`28`, :pull:`29`) diff --git a/pvfactors/irradiance/utils.py b/pvfactors/irradiance/utils.py index b25a582..7200085 100644 --- a/pvfactors/irradiance/utils.py +++ b/pvfactors/irradiance/utils.py @@ -94,6 +94,12 @@ def perez_diffuse_luminance(timestamps, surface_tilt, surface_azimuth, am, return_components=True) + # compatibility with pvlib<0.14.0 + components = components.rename(columns={'isotropic': 'poa_isotropic', + 'circumsolar': 'poa_circumsolar', + 'horizon': 'poa_horizon', + 'sky_diffuse': 'poa_sky_diffuse'}) + # Calculate Perez view factors: a = irradiance.aoi_projection( df_inputs.surface_tilt, @@ -114,24 +120,19 @@ def perez_diffuse_luminance(timestamps, surface_tilt, surface_azimuth, # Calculate diffuse luminance luminance = pd.DataFrame( np.array([ - components['horizon'] / vf_perez['vf_horizon'], - components['circumsolar'] / vf_perez['vf_circumsolar'], - components['isotropic'] / vf_perez['vf_isotropic'] + components['poa_horizon'] / vf_perez['vf_horizon'], + components['poa_circumsolar'] / vf_perez['vf_circumsolar'], + components['poa_isotropic'] / vf_perez['vf_isotropic'] ]).T, index=df_inputs.index, columns=['luminance_horizon', 'luminance_circumsolar', 'luminance_isotropic'] ) - luminance.loc[components['sky_diffuse'] == 0, :] = 0. - - # Format components column names - components = components.rename(columns={'isotropic': 'poa_isotropic', - 'circumsolar': 'poa_circumsolar', - 'horizon': 'poa_horizon'}) + luminance.loc[components['poa_sky_diffuse'] == 0, :] = 0. df_inputs = pd.concat([df_inputs, components, vf_perez, luminance], axis=1, join='outer') - df_inputs = df_inputs.rename(columns={'sky_diffuse': 'poa_total_diffuse'}) + df_inputs = df_inputs.rename(columns={'poa_sky_diffuse': 'poa_total_diffuse'}) # Adjust the circumsolar luminance when it hits the back surface if df_inputs_back_surface.shape[0] > 0: