Skip to content

Commit 93adb59

Browse files
authored
Updated modelchain.py #893 (#936)
This PR handles, the case where pressure or temp_air is not in weather, using the pvlib.tools._build_kwargs method, as keyword arguments. #893
1 parent 73e2e0c commit 93adb59

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pvlib/modelchain.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import pvlib.irradiance # avoid name conflict with full import
1717
from pvlib.pvsystem import _DC_MODEL_PARAMS
1818
from pvlib._deprecation import pvlibDeprecationWarning
19-
19+
from pvlib.tools import _build_kwargs
2020

2121
def basic_chain(times, latitude, longitude,
2222
module_parameters, temperature_model_parameters,
@@ -870,9 +870,15 @@ def prepare_inputs(self, weather, times=None):
870870
'is used for times.', pvlibDeprecationWarning)
871871

872872
self.times = self.weather.index
873+
try:
874+
kwargs = _build_kwargs(['pressure', 'temp_air'], weather)
875+
kwargs['temperature'] = kwargs.pop('temp_air')
876+
except KeyError:
877+
pass
873878

874879
self.solar_position = self.location.get_solarposition(
875-
self.weather.index, method=self.solar_position_method)
880+
self.weather.index, method=self.solar_position_method,
881+
**kwargs)
876882

877883
self.airmass = self.location.get_airmass(
878884
solar_position=self.solar_position, model=self.airmass_model)

0 commit comments

Comments
 (0)