diff --git a/data/data_manager.py b/data/data_manager.py index cba49c4f0..3e911648c 100644 --- a/data/data_manager.py +++ b/data/data_manager.py @@ -146,12 +146,20 @@ def _append_csv_data(self): # Get zone and boundary data keys allowed zon_keys, bou_keys = self._get_zone_and_boundary_keys() + weather_keys = list(self.categories['weather'].keys()) # Search for .csv files in the resources folder for f in self.files: if f.endswith('.csv'): df = pd.read_csv(f, comment='#') cols = df.keys() + + # Check if all weather variables are included in weather.csv + if 'weather' in f: + if not set(cols) <= set(weather_keys): + warnings.warn('The file weather.csv is missing '\ + 'the following variables '+str(set(weather_keys).difference(set(cols)))+'.', Warning) + if 'time' in cols: for col in cols.drop('time'): # Raise error if col already appended @@ -427,7 +435,8 @@ def load_data_and_jsons(self): # Get zone and boundary data keys allowed zon_keys, bou_keys = self._get_zone_and_boundary_keys() - + + # Initialize test case data frame self.case.data = \ pd.DataFrame(index=index).rename_axis('time') @@ -436,6 +445,7 @@ def load_data_and_jsons(self): for f in files: df = pd.read_csv(z_fmu.open(f)) cols = df.keys() + if 'time' in cols: for col in cols.drop('time'): # Check that column has any of the allowed data keys diff --git a/releasenotes.md b/releasenotes.md index 524d922df..8cea7a331 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -8,7 +8,7 @@ Released on xx/xx/xxxx. - Update pyfmi version from 2.11 to 2.12 and miniconda version from py310_23.1.0-1-Linux-x86_64 to py310_24.3.0-0-Linux-x86_64. This is for [#643](https://github.com/ibpsa/project1-boptest/issues/643). - Remove support and unit testing of example python controllers using Python 2. This is for [#634](https://github.com/ibpsa/project1-boptest/issues/634). - +- Add a warning message upon test case compilation in ``data/data_manager.py`` that is displayed if any of the weather variables in ``data/categories.json`` is not in ``/resources/weather.csv``. This is for [#500](https://github.com/ibpsa/project1-boptest/issues/500). ## BOPTEST v0.6.0