I use the erbs model of pvlib to calculate dni and dhi from the global horizontal irradiance. However, my dni does not seem to be correct at the end of the day. I set the max zenith to 85 as is suggested here: Estimate diffuse and direct component from global irradiance
erbs = pvlib.irradiance.erbs(GHI_df['W/m2'], solpos['zenith'], GHI_df.index, min_cos_zenith=0.065, max_zenith=85)
Changing the max zenith to 85 made it a bit better. However, at the end of the day my dni still seems to give strange values. See the figure below. Does anyone know how to help.