Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
interpolation_frequency = init.get('interpolation_frequency', None)
if interpolation_frequency is not None:
max_timedelta = init['max_timedelta']
interpolation_keys = [
'pv', 'poa', 'ghi', 'dni', 'dhi', 'ambient_temperature',
'windspeed'
]
for key in ['pv_tilt', 'pv_azimuth']:
if isinstance(init[key], (pd.Series, pd.DataFrame)):
interpolation_keys.append(key)
for key in interpolation_keys:
if key not in init:
continue
values = init[key]
interpolated = normalization.interpolate(
values, interpolation_frequency, max_timedelta
)
init[key] = interpolated
common_graph = {
'pvlib_location': (
pvlib.location.Location, 'latitude', 'longitude'
),
'times': (
lambda series: series.index, 'pv'
),
'pv_energy': (
power_to_energy, 'pv', 'max_timedelta'
),
'solar_position': (
lambda loc, times: loc.get_solarposition(times),