Ошибка при использовании PVLIB-Python
Я новый пользователь библиотеки Python PVLIB. В настоящее время я использую его для получения прогнозов для определенных фотоэлектрических систем со всеми спецификациями, переданными ему в форме фрейма данных Python. Следующий скрипт отлично работал некоторое время, а затем начал давать мне ошибки. Сценарий ниже и ошибка тоже. Есть ли ограничения на вызовы API для этих прогнозов?
forecast_models = [NDFD(), RAP(), HRRR()]
fm_strings = ['NDFD', 'RAP', 'HRRR']
albedo = 0.2
for i in range(0, len(demand_frame)):
latitude = demand_frame['latitude'][i]
longitude = demand_frame['longitude'][i]
tz = system_frame['tz'][i]
today = pd.Timestamp(datetime.date.today(), tz=tz)
start = today - pd.Timedelta(days=1)
end = today + pd.Timedelta(days=7)
surface_tilt = demand_frame['tilt'][i]
surface_azimuth = demand_frame['azimuth'][i]
for j in range(0, len(fm_strings)):
fm = forecast_models[j]
forecast_data = fm.get_processed_data(latitude, longitude, start, end)
time = forecast_data.index
a_point = fm.location
solpos = a_point.get_solarposition(time)
ghi = forecast_data['ghi']
dni_extra = irradiance.extraradiation(fm.time)
airmass = atmosphere.relativeairmass(solpos['apparent_zenith'])
poa_sky_diffuse = irradiance.haydavies(surface_tilt, surface_azimuth,
forecast_data['dhi'], forecast_data['dni'], dni_extra,
solpos['apparent_zenith'], solpos['azimuth'])
poa_ground_diffuse = irradiance.grounddiffuse(surface_tilt, ghi, albedo=albedo)
aoi = irradiance.aoi(surface_tilt, surface_azimuth, solpos['apparent_zenith'], solpos['azimuth'])
poa_irrad = irradiance.globalinplane(aoi, forecast_data['dni'], poa_sky_diffuse, poa_ground_diffuse)
temperature = forecast_data['temp_air']
wnd_spd = forecast_data['wind_speed']
pvtemps = pvsystem.sapm_celltemp(poa_irrad['poa_global'], wnd_spd, temperature)
for k in range(0, len(poa_irrad)):
if poa_irrad['poa_global'][k] > 1000:
poa_irrad['poa_global'][k] = poa_irrad['poa_global'][k-1]
temperature = forecast_data['temp_air']
wnd_spd = forecast_data['wind_speed']
pvtemps = pvsystem.sapm_celltemp(poa_irrad['poa_global'], wnd_spd, temperature)
dc_out= pvsystem.pvwatts_dc(poa_irrad['poa_global'], pvtemps['temp_cell'], system_frame['dc'][i], -.002)
if j == 0:
dc_frame = pd.DataFrame({'NDFD_kWh': dc_out})
if j == 1:
dc_frame['RAP_kWh'] = dc_out
if j == 2:
dc_frame['HRRR_kWh'] = dc_out
dc_frame['Itron_ID'] = demand_frame['ID'][i]
dc_frame.index = dc_frame.index.tz_localize(None)
out_name = datetime.date.today().strftime("%m_%d_%y") + '\\' + demand_frame['ID'][i] + '_Sim'
dc_frame.to_csv(r'\\itron.com\CNA\Ral1\Software_And_Services\DER dashboard\PVSims\Demand_Only_All_Sims\%s.csv' % out_name, index_label = 'Datetime')
Ошибка:
---------------------------------------------------------------------------
MemoryError Traceback (most recent call last)
<ipython-input-7-99e85b96b753> in <module>()
23 poa_sky_diffuse = irradiance.haydavies(surface_tilt, surface_azimuth,
24 forecast_data['dhi'], forecast_data['dni'], dni_extra,
---> 25 solpos['apparent_zenith'], solpos['azimuth'])
26 poa_ground_diffuse = irradiance.grounddiffuse(surface_tilt, ghi, albedo=albedo)
27 aoi = irradiance.aoi(surface_tilt, surface_azimuth, solpos['apparent_zenith'], solpos['azimuth'])
C:\Users\speri\AppData\Local\Continuum\Anaconda\lib\site-packages\pvlib\irradiance.py in haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra, solar_zenith, solar_azimuth, projection_ratio)
731 term2 = 0.5 * (1 + tools.cosd(surface_tilt))
732
--> 733 sky_diffuse = dhi * (AI * Rb + term1 * term2)
734 sky_diffuse = np.maximum(sky_diffuse, 0)
735
C:\Users\speri\AppData\Local\Continuum\Anaconda\lib\site-packages\pandas\core\ops.py in wrapper(left, right, name, na_op)
698 return NotImplemented
699
--> 700 left, right = _align_method_SERIES(left, right)
701
702 converted = _Op.get_op(left, right, name, na_op)
C:\Users\speri\AppData\Local\Continuum\Anaconda\lib\site-packages\pandas\core\ops.py in _align_method_SERIES(left, right, align_asobject)
627 right = right.astype(object)
628
--> 629 left, right = left.align(right, copy=False)
630
631 return left, right
C:\Users\speri\AppData\Local\Continuum\Anaconda\lib\site-packages\pandas\core\series.py in align(self, other, join, axis, level, copy, fill_value, method, limit, fill_axis, broadcast_axis)
2409 fill_value=fill_value, method=method,
2410 limit=limit, fill_axis=fill_axis,
-> 2411 broadcast_axis=broadcast_axis)
2412
2413 @Appender(generic._shared_docs['rename'] % _shared_doc_kwargs)
C:\Users\speri\AppData\Local\Continuum\Anaconda\lib\site-packages\pandas\core\generic.py in align(self, other, join, axis, level, copy, fill_value, method, limit, fill_axis, broadcast_axis)
4790 copy=copy, fill_value=fill_value,
4791 method=method, limit=limit,
-> 4792 fill_axis=fill_axis)
4793 else: # pragma: no cover
4794 raise TypeError('unsupported type: %s' % type(other))
C:\Users\speri\AppData\Local\Continuum\Anaconda\lib\site-packages\pandas\core\generic.py in _align_series(self, other, join, axis, level, copy, fill_value, method, limit, fill_axis)
4859 join_index, lidx, ridx = self.index.join(other.index, how=join,
4860 level=level,
-> 4861 return_indexers=True)
4862
4863 left = self._reindex_indexer(join_index, lidx, copy)
C:\Users\speri\AppData\Local\Continuum\Anaconda\lib\site-packages\pandas\core\indexes\datetimes.py in join(self, other, how, level, return_indexers, sort)
1067 this, other = self._maybe_utc_convert(other)
1068 return Index.join(this, other, how=how, level=level,
-> 1069 return_indexers=return_indexers, sort=sort)
1070
1071 def _maybe_utc_convert(self, other):
C:\Users\speri\AppData\Local\Continuum\Anaconda\lib\site-packages\pandas\core\indexes\base.py in join(self, other, how, level, return_indexers, sort)
2988 if not self.is_unique and not other.is_unique:
2989 return self._join_non_unique(other, how=how,
-> 2990 return_indexers=return_indexers)
2991 elif not self.is_unique or not other.is_unique:
2992 if self.is_monotonic and other.is_monotonic:
C:\Users\speri\AppData\Local\Continuum\Anaconda\lib\site-packages\pandas\core\indexes\base.py in _join_non_unique(self, other, how, return_indexers)
3076 left_idx, right_idx = _get_join_indexers([self.values],
3077 [other._values], how=how,
-> 3078 sort=True)
3079
3080 left_idx = _ensure_platform_int(left_idx)
C:\Users\speri\AppData\Local\Continuum\Anaconda\lib\site-packages\pandas\core\reshape\merge.py in _get_join_indexers(left_keys, right_keys, sort, how, **kwargs)
996 join_func = _join_functions[how]
997
--> 998 return join_func(lkey, rkey, count, **kwargs)
999
1000
pandas\_libs\join.pyx in pandas._libs.join.full_outer_join (pandas\_libs\join.c:123190)()
MemoryError:
Я предполагаю, что это какая-то ошибка сети. У API есть предел, и это то, что вызывает ошибку? Любые ответы / комментарии будут высоко ценится. Благодарю.