Closed
Description
Describe the bug
I changed from 0.5.2 to 0.6 and now receive RuntimeWarning from pvlib.tracking:
RuntimeWarning: invalid value encountered in less
tracker_theta = np.where(wid < 0, wid + wc, wid - wc)
RuntimeWarning: invalid value encountered in greater
tracker_theta[tracker_theta > max_angle] = max_angle
RuntimeWarning: invalid value encountered in less
tracker_theta[tracker_theta < -max_angle] = -max_angle
RuntimeWarning: invalid value encountered in less
surface_azimuth[surface_azimuth < 0] += 360
RuntimeWarning: invalid value encountered in greater_equal
surface_azimuth[surface_azimuth >= 360] -= 360
To Reproduce
To reproduce the behavior:
import pandas as pd
import numpy as np
import warnings
warnings.filterwarnings('always')
from pvlib.location import Location
from pvlib.tracking import SingleAxisTracker
from pvlib.modelchain import ModelChain
# Create dummy meteo data
df_index = pd.date_range(start='2016-11-30 01:00:00', end='2017-01-31 22:00:00', freq='10min', tz='America/Panama')
cols = ['temp_air', 'wind_speed', 'pressure', 'ghi', 'dni', 'dhi']
df = pd.DataFrame(np.random.randint(0,100,size=(9055, 6)), columns=cols, index=df_index)
# Create dummy location
loc = Location(8.246, -81.99, 'America/Panama', 13.9)
pvwatts_system = SingleAxisTracker(surface_tilt=10, surface_azimuth=None, albedo=0.2, module='pvwatts_dc',
module_parameters={'pdc0': 9.9, 'gamma_pdc': -0.004}, inverter='pvwatts_ac',
inverter_parameters={'eta_inv_nom': 0.9637})
pvwatts_mc = ModelChain(pvwatts_system, loc, name='pvwatts',
dc_model='pvwatts', ac_model='pvwatts',
aoi_model='no_loss', spectral_model='no_loss',
losses_model='no_loss')
pvwatts_mc.run_model(df.index, weather=df)
Expected behavior
I think this occurs in 0.6.0 because of the following change in pvlib.tracking singleaxis
in version 0.5.2:
wid = pd.Series(90 - np.degrees(np.arctan2(zp, xp)), index=times)
in version 0.6.0:
wid = 90 - np.degrees(np.arctan2(zp, xp))
The array used in 0.6.0 creates the RuntimeWarning when comparing NaNs to a value
The pd.Series used in 0.5.2 does not create the same warning when comparing NaNs to a value.
Versions:
pvlib.__version__0.6.0
:pandas.__version__0.23.4
:- python: 3.6
Additional context
It doesn't really affect the functioning of the model, but warnings can be distracting.
Metadata
Metadata
Assignees
Labels
No labels