From f45ae87b4d5cd30c76769f11f1166a45c45e73b4 Mon Sep 17 00:00:00 2001 From: Christoph Date: Tue, 3 Sep 2024 09:49:08 -0700 Subject: [PATCH] added test cases --- afc/radiance/forecast.py | 21 +++++++++++++-------- test/test_1.py | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/afc/radiance/forecast.py b/afc/radiance/forecast.py index e4ba9e5..727c84d 100644 --- a/afc/radiance/forecast.py +++ b/afc/radiance/forecast.py @@ -597,19 +597,16 @@ def compute2(self, weather_df, weather_cutoff=75): return output_df - -if __name__ == "__main__": - - import warnings - warnings.simplefilter(action='ignore', category=pd.errors.PerformanceWarning) +def test(wwr=0.4, # [0.4, 0.6] + mode='dshade', # ['dshade', 'shade', 'blinds', 'ec'] + facade_type='shade' # ['shade', 'blinds', 'ec'] + ): + """test funciton for radiance""" from .configs import get_config root = os.path.dirname(os.path.abspath(__file__)) # configuration - wwr = 0.4 # [0.4, 0.6] - mode = 'dshade' # ['dshade', 'shade', 'blinds', 'ec'] - facade_type = 'shade' # ['shade', 'blinds', 'ec'] print('Running example for:', wwr, mode, facade_type) filestruct, config_path = get_config(mode, wwr) @@ -654,4 +651,12 @@ def compute2(self, weather_df, weather_cutoff=75): # print(k, v) print(res) print(res['wpi_0_6']) + return res + +if __name__ == "__main__": + + import warnings + warnings.simplefilter(action='ignore', category=pd.errors.PerformanceWarning) + + res = test() res.to_csv('radiance-forecast_new.csv') diff --git a/test/test_1.py b/test/test_1.py index d73d17d..bd06603 100644 --- a/test/test_1.py +++ b/test/test_1.py @@ -41,7 +41,7 @@ def test1(): inputs = make_inputs(parameter, df) # Query controller - ctrl.do_step(inputs=inputs) + print(ctrl.do_step(inputs=inputs)) df = pd.read_json(io.StringIO(ctrl.get_output(keys=['output-data'])['output-data'])) # check