Closed wholmgren closed 8 years ago
Here's an example of how to use clearsky.ineichen
...
location = [32.2,-110.9] # Tucson, AZ
start = datetime.now() # today's date
end = start + timedelta(days=7) # 7 days from today
timerange = pd.date_range(start, end, tz=tz)
forecast_data = fm.get_query_data(location,timerange)
cs = pvlib.clearsky.ineichen(forecast_data.index, pvlib.location.Location(*location), solarposition_method='nrel_numpy')
cs_scaled = cs.mul((100-forecast_data['total_clouds']) / 100, axis=0)
A lot of room for improvement here, but it shows the idea.
I have implemented a model from Liu & Jordan as well as the pvlib.clearsky.ineichen conversion you mentioned above. By default values for radiation are calculated using the Liu & Jordan model if they are not being queried. That being said, the probably needs to be some validation done that these values all agree and that it is clear how the model returns radiation data.
All models except for HRRR_ESRL need to calculate all radiation components because the models do not use an accurate equation of time.
The calc_radiation
function is very hard to understand, perhaps because there are some errors in it. Let's talk about it as soon as possible.
I am planning on simplifying the calc_radiation function. This should should help readability and also cur down on the errors.
All models calculate radiation for dni, dhi, and ghi using the liujordan model except for the HRRR_ESRL because of the equation of time issue.
I was surprised to see this code already done. Where does this algorithm come from? As you may have seen, pvlib tries to put published references in the docstrings.
I expected that we'd use the
pvlib.clearsky.ineichen
function to calculate clear sky ghi, dni, dhi, then multiply by some function of cloud cover. I was thinking linear to get started, but it would be pretty easy to fit a 2nd or 3rd order polynomial to some irradiance data measured here on campus.Your approach is interesting and I'm not sure which is best.
Also, change
addRadiation
toadd_radiation
.