From 42abb71b075fa123bda1671dc4c357bf75b4ba85 Mon Sep 17 00:00:00 2001 From: Ahan M R Date: Mon, 17 Feb 2020 18:41:45 +0530 Subject: [PATCH 01/11] Updated modelchain.py #523 Added weather data in get_solarpostion method of modelchain.ModelChain.prepare_inputs --- pvlib/modelchain.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index 45a9f5ca98..c7c9ec9267 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -861,7 +861,8 @@ def prepare_inputs(self, weather, times=None): self.times = self.weather.index self.solar_position = self.location.get_solarposition( - self.weather.index, method=self.solar_position_method) + self.weather.index, method=self.solar_position_method, + pressure=self.weather.pressure,temperature=self.weather.temp_air) self.airmass = self.location.get_airmass( solar_position=self.solar_position, model=self.airmass_model) From 212e02865d41980ba6bc1f87d2a68e0f4b94623d Mon Sep 17 00:00:00 2001 From: Ahan M R Date: Mon, 17 Feb 2020 19:00:24 +0530 Subject: [PATCH 02/11] Updated modelchain.py #523 Added weather arguments in get_solarposition of method modelchain.ModelChain.prepare_inputs --- pvlib/modelchain.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index c7c9ec9267..48d97aa4cb 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -861,8 +861,7 @@ def prepare_inputs(self, weather, times=None): self.times = self.weather.index self.solar_position = self.location.get_solarposition( - self.weather.index, method=self.solar_position_method, - pressure=self.weather.pressure,temperature=self.weather.temp_air) + self.weather.index, method=self.solar_position_method, pressure=self.weather.pressure, temperature=self.weather.temp_air) self.airmass = self.location.get_airmass( solar_position=self.solar_position, model=self.airmass_model) From f61941d2dbf6465d16f3889ffea1e532e10ff10a Mon Sep 17 00:00:00 2001 From: Ahan M R Date: Mon, 17 Feb 2020 19:07:40 +0530 Subject: [PATCH 03/11] Updated modelchain.py #523 Added weather arguments in get_solarpostion method of modelchain.ModelChain.prepare_input --- pvlib/modelchain.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index 48d97aa4cb..8083a3f5da 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -860,8 +860,10 @@ def prepare_inputs(self, weather, times=None): self.times = self.weather.index - self.solar_position = self.location.get_solarposition( - self.weather.index, method=self.solar_position_method, pressure=self.weather.pressure, temperature=self.weather.temp_air) + self.solar_position = self.location.get_solarposition(self.weather.index, + method=self.solar_position_method, + pressure=self.weather.pressure, + temperature=self.weather.temp_air) self.airmass = self.location.get_airmass( solar_position=self.solar_position, model=self.airmass_model) From 469c7b4cc35c5f6bfff0f1619900605ad3000378 Mon Sep 17 00:00:00 2001 From: Ahan M R Date: Mon, 17 Feb 2020 19:17:38 +0530 Subject: [PATCH 04/11] Updated modelchain.py #523 Added weather data arguments in get_solarpostion method of modelchain.ModelChain.prepare_inputs as part of the Pull request. --- pvlib/modelchain.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index 8083a3f5da..a3e405cd99 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -860,10 +860,11 @@ def prepare_inputs(self, weather, times=None): self.times = self.weather.index - self.solar_position = self.location.get_solarposition(self.weather.index, - method=self.solar_position_method, - pressure=self.weather.pressure, - temperature=self.weather.temp_air) + self.solar_position = self.location.get_solarposition( + self.weather.index, + method=self.solar_position_method, + pressure=self.weather.pressure, + temperature=self.weather.temp_air) self.airmass = self.location.get_airmass( solar_position=self.solar_position, model=self.airmass_model) From 5e6de6ab31c30b0355f81824e0fb17bb07b57797 Mon Sep 17 00:00:00 2001 From: Ahan M R Date: Mon, 17 Feb 2020 19:36:27 +0530 Subject: [PATCH 05/11] Updated modelchain.py Added weather inputs to get_solarpostion method in modelchain.ModelChain.prepare_inputs --- pvlib/modelchain.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index a3e405cd99..d65b3e5d65 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -861,10 +861,9 @@ def prepare_inputs(self, weather, times=None): self.times = self.weather.index self.solar_position = self.location.get_solarposition( - self.weather.index, - method=self.solar_position_method, - pressure=self.weather.pressure, - temperature=self.weather.temp_air) + self.weather.index,method=self.solar_position_method, + pressure=self.weather.pressure, + temperature=self.weather.temp_air) self.airmass = self.location.get_airmass( solar_position=self.solar_position, model=self.airmass_model) From 7d1a1a197ef67684b774ddc8efd4dea014c180b8 Mon Sep 17 00:00:00 2001 From: Ahan M R Date: Mon, 17 Feb 2020 19:39:39 +0530 Subject: [PATCH 06/11] Updated modelchain.py Added weather data in get_solarpostion method in modelchain.ModelChain.prepare_inputs --- pvlib/modelchain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index d65b3e5d65..aca841a1f9 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -861,7 +861,7 @@ def prepare_inputs(self, weather, times=None): self.times = self.weather.index self.solar_position = self.location.get_solarposition( - self.weather.index,method=self.solar_position_method, + self.weather.index, method=self.solar_position_method, pressure=self.weather.pressure, temperature=self.weather.temp_air) From 81d5fbbdbf54f42dba2053278e1da9e992440ab5 Mon Sep 17 00:00:00 2001 From: Ahan M R Date: Mon, 17 Feb 2020 19:46:03 +0530 Subject: [PATCH 07/11] Updated modelchain.py Added weather data in get_solarpostion method in modelchain.ModelChain.prepare_inputs --- pvlib/modelchain.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index aca841a1f9..01387f3c9b 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -861,9 +861,9 @@ def prepare_inputs(self, weather, times=None): self.times = self.weather.index self.solar_position = self.location.get_solarposition( - self.weather.index, method=self.solar_position_method, - pressure=self.weather.pressure, - temperature=self.weather.temp_air) + self.weather.index, method=self.solar_position_method, + pressure=self.weather.pressure, + temperature=self.weather.temp_air) self.airmass = self.location.get_airmass( solar_position=self.solar_position, model=self.airmass_model) From 1d99c4cea69730d5b9b7cbf5c14b4a6586a531e4 Mon Sep 17 00:00:00 2001 From: Ahan M R Date: Mon, 17 Feb 2020 19:50:49 +0530 Subject: [PATCH 08/11] Updated modelchain.py Added weather data in get_solarpostion method in modelchain.ModelChain.prepare_inputs --- pvlib/modelchain.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index 01387f3c9b..0cdcd5ddb0 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -861,9 +861,8 @@ def prepare_inputs(self, weather, times=None): self.times = self.weather.index self.solar_position = self.location.get_solarposition( - self.weather.index, method=self.solar_position_method, - pressure=self.weather.pressure, - temperature=self.weather.temp_air) + self.weather.index, method=self.solar_position_method, + pressure=self.weather.pressure, temperature=self.weather.temp_air) self.airmass = self.location.get_airmass( solar_position=self.solar_position, model=self.airmass_model) From e9ad08a436543d6ea2c3d42c9b83a2ddfab03c0e Mon Sep 17 00:00:00 2001 From: Ahan M R Date: Mon, 17 Feb 2020 19:53:18 +0530 Subject: [PATCH 09/11] Updated modelchain.py Added weather data in get_solarpostion method in modelchain.ModelChain.prepare_inputs --- pvlib/modelchain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index 0cdcd5ddb0..15c2e4bef1 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -861,7 +861,7 @@ def prepare_inputs(self, weather, times=None): self.times = self.weather.index self.solar_position = self.location.get_solarposition( - self.weather.index, method=self.solar_position_method, + self.weather.index, method=self.solar_position_method, pressure=self.weather.pressure, temperature=self.weather.temp_air) self.airmass = self.location.get_airmass( From 6caa825042630c15f202c2eab2705b436ec243af Mon Sep 17 00:00:00 2001 From: Ahan M R Date: Mon, 17 Feb 2020 22:34:53 +0530 Subject: [PATCH 10/11] Updated modelchain.py This handles the case where pressure or temp_air is not in weather, using the pvlib.tools._build_kwargs logic for keyword arguments. #523 --- pvlib/modelchain.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index 15c2e4bef1..05144f7f1c 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -16,6 +16,7 @@ import pvlib.irradiance # avoid name conflict with full import from pvlib.pvsystem import _DC_MODEL_PARAMS from pvlib._deprecation import pvlibDeprecationWarning +from pvlib.tools import _build_kwargs def basic_chain(times, latitude, longitude, @@ -859,10 +860,13 @@ def prepare_inputs(self, weather, times=None): 'is used for times.', pvlibDeprecationWarning) self.times = self.weather.index + + kwargs = _build_kwargs(['pressure', 'temp_air'], weather) + kwargs['temperature'] = kwargs.pop('temp_air') self.solar_position = self.location.get_solarposition( self.weather.index, method=self.solar_position_method, - pressure=self.weather.pressure, temperature=self.weather.temp_air) + **kwargs) self.airmass = self.location.get_airmass( solar_position=self.solar_position, model=self.airmass_model) From 494a6eaedd56ee4def2c2f07676bf4138b116894 Mon Sep 17 00:00:00 2001 From: Ahan M R Date: Mon, 17 Feb 2020 22:38:35 +0530 Subject: [PATCH 11/11] updated modelchain.py This PR handles, the case where pressure or temp_air is not in weather, using the pvlib.tools._build_kwargs method, as keyword arguments. --- pvlib/modelchain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index 05144f7f1c..1eff7e293b 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -860,7 +860,7 @@ def prepare_inputs(self, weather, times=None): 'is used for times.', pvlibDeprecationWarning) self.times = self.weather.index - + kwargs = _build_kwargs(['pressure', 'temp_air'], weather) kwargs['temperature'] = kwargs.pop('temp_air')