pvlib.irradiance.disc #2071
Unanswered
naoseivoar
asked this question in
Q&A
Replies: 2 comments
-
This just happened to me too! It turns out one of the pandas series/data-frames was shifted by 30 minutes to interval centers while the irradiance components still had indices at the start of the interval, thus doubling the size when merged through operations like addition. The trick for me was either:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you! I managed to fix it by making sure all the index are in Datetime |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys, so I'm trying to convert a solar resource timeseries using pvlib. The error appears when I use pvlib.irradiance.disc function, it says it can't broadcast operands with different shapes (93216,) and (46608,) but both my operands are shaped (46608,) and I can´t find the variable with shape (93216,) but this last one is the double of the other one so it might be a clue. Does anyone know if this an issue related with this function?
import pandas as pd
import datetime
import numpy as np
import pvlib
from pvlib.pvsystem import PVSystem, FixedMount
from pvlib.location import Location
from pvlib.modelchain import ModelChain
from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS
#%%
temperature_model_parameters = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']
latitude=-40.38
longitude=8.39
dados=pd.read_csv('C:/Users/henri/OneDrive - Universidade de Lisboa/tese/scripts/weather_aveiro_final.csv')
sandia_modules = pvlib.pvsystem.retrieve_sam('SandiaMod')
cec_inverters = pvlib.pvsystem.retrieve_sam('cecinverter')
sandia_module = sandia_modules['Canadian_Solar_CS5P_220M___2009_']
cec_inverter = cec_inverters['ABB__MICRO_0_25_I_OUTD_US_208__208V_']
location=Location(latitude, longitude)
system=PVSystem(surface_tilt=20,
surface_azimuth=200,
module_parameters=sandia_module,inverter_parameters=cec_inverter,
temperature_model_parameters=temperature_model_parameters)
mc = ModelChain(system, location)
weather = pd.DataFrame()
weather['temp_air'] = dados['Avg_Temp']
weather['ghi'] = dados['GHI (W/m2)']
#%%
Calculates solar position
solar_position = location.get_solarposition(dados['Time'])
Calculates Irradiance components (DNI e DHI) from GHI
dni = pvlib.irradiance.disc(solar_position['apparent_zenith'], weather['ghi'], dados.index)
weather['dni'] = dni['dni']
weather['dhi'] = weather['ghi'] - dni['dni'] * np.cos(np.radians(solar_position['apparent_zenith']))
Beta Was this translation helpful? Give feedback.
All reactions