I'm using Pollination v1.70.1.0 (based on the number associated with the uninstaller), with ladybug-core 0.44.49 and have found a few bugs.
They're probably related, but the two I've stumbled across are:
When saving an EPW, I get this error:
from ladybug.epw import EPW
epw = EPW(r"C:\Users\...\source.epw")
epw.save(r"C:\Users\...\temp.epw")
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[23], line 14
13 epw = EPW(epw_file)
---> 14 epw.save(r"C:\Users\...\temp.epw")
File .\.venv\lib\site-packages\ladybug\epw.py:1931, in EPW.save(self, file_path)
1925 def save(self, file_path):
1926 """Write EPW object as a file.
1927
1928 Args:
1929 file_path: Text for the full path to where the file will be written.
1930 """
-> 1931 file_data = self.to_file_string()
1932 write_to_file(file_path, file_data, True)
1933 return file_data
File .\.venv\lib\site-packages\ladybug\epw.py:1876, in EPW.to_file_string(self)
1874 # load data if it's not loaded convert to SI if it is in IP
1875 if not self.is_data_loaded:
-> 1876 self._import_data()
1877 originally_ip = False
1878 if self.is_ip:
File .\.venv\lib\site-packages\ladybug\epw.py:379, in EPW._import_data(self, import_header_only)
377 self._import_location(line)
378 header_lines = [line] + [epwin.readline() for i in xrange(7)]
--> 379 self._import_header(header_lines)
380 if import_header_only:
381 return
File .\.venv\lib\site-packages\ladybug\epw.py:513, in EPW._import_header(self, header_lines)
509 grnd_header = Header(temperature.GroundTemperature(), 'C',
510 AnalysisPeriod(), header_meta)
511 grnd_vals = [float(x) for x in grnd_data[st_ind + 4: st_ind + 16]]
512 self._monthly_ground_temps[float(grnd_data[st_ind])] = \
--> 513 MonthlyCollection(grnd_header, grnd_vals, list(xrange(12)))
514 st_ind += 16
516 # parse leap year, daylight savings and comments.
File .\.venv\lib\site-packages\ladybug\datacollection.py:1359, in __init__(self, header, values, datetimes)
1357 self._datetimes = tuple(datetimes)
1358 self.values = values
-> 1359 self._validated_a_period = False
TypeError: descriptor '_header' for 'BaseCollection' objects doesn't apply to a 'MonthlyCollection' object
And the other is when accessing data collections from an SQLiteResult:
from ladybug.sql import SQLiteResult
sql_obj = SQLiteResult(r"C:\Users\...\model\openstudio\run\eplusout.sql")
for outp in sql_obj.available_outputs:
sql_obj.data_collections_by_output_name(outp)
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
Cell In[1], line 5
3 sql_obj = SQLiteResult(r"C:\Users\...\model\openstudio\run\eplusout.sql")
4 for outp in sql_obj.available_outputs:
----> 5 sql_obj.data_collections_by_output_name(outp)
File c:\Users\...\.venv\lib\site-packages\ladybug\sql.py:371, in SQLiteResult.data_collections_by_output_name(self, output_name)
369 if report_frequency == 'Hourly' or isinstance(report_frequency, int):
370 for head, values in zip(headers, all_values):
--> 371 data_colls.append(HourlyContinuousCollection(head, values))
372 elif report_frequency == 'Daily':
373 for head, values in zip(headers, all_values):
File c:\Users\...\.venv\lib\site-packages\ladybug\datacollection.py:614, in HourlyContinuousCollection.__init__(self, header, values)
609 assert header.analysis_period.end_hour == 23, \
610 'analysis_period end hour of {} must be 23. Got {}'.format(
611 self.__class__.__name__, header.analysis_period.end_hour)
613 self._header = header
--> 614 self.values = values
615 self._datetimes = None
616 self._validated_a_period = True
File c:\Users\...\.venv\lib\site-packages\ladybug\_datacollectionbase.py:96, in BaseCollection.values(self, values)
94 @values.setter
95 def values(self, values):
---> 96 self._check_values(values)
97 self._values = list(values)
File c:\Users\...\.venv\lib\site-packages\ladybug\datacollection.py:1024, in HourlyContinuousCollection._check_values(self, values)
1020 """Check values whenever they come through the values setter."""
1021 assert isinstance(values, Iterable) and not isinstance(
1022 values, (str, dict, bytes, bytearray)), \
1023 'values should be a list or tuple. Got {}'.format(type(values))
-> 1024 assert len(values) == len(self.header.analysis_period), 'Length of ' \
1025 'values does not match that expected by the header analysis_period.'\
1026 ' {} != {}'.format(len(values), len(self.header.analysis_period))
AssertionError: Length of values does not match that expected by the header analysis_period. 8760 != 8784
I'm using Pollination v1.70.1.0 (based on the number associated with the uninstaller), with ladybug-core 0.44.49 and have found a few bugs.
They're probably related, but the two I've stumbled across are:
When saving an EPW, I get this error:
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[23], line 14 13 epw = EPW(epw_file) ---> 14 epw.save(r"C:\Users\...\temp.epw") File .\.venv\lib\site-packages\ladybug\epw.py:1931, in EPW.save(self, file_path) 1925 def save(self, file_path): 1926 """Write EPW object as a file. 1927 1928 Args: 1929 file_path: Text for the full path to where the file will be written. 1930 """ -> 1931 file_data = self.to_file_string() 1932 write_to_file(file_path, file_data, True) 1933 return file_data File .\.venv\lib\site-packages\ladybug\epw.py:1876, in EPW.to_file_string(self) 1874 # load data if it's not loaded convert to SI if it is in IP 1875 if not self.is_data_loaded: -> 1876 self._import_data() 1877 originally_ip = False 1878 if self.is_ip: File .\.venv\lib\site-packages\ladybug\epw.py:379, in EPW._import_data(self, import_header_only) 377 self._import_location(line) 378 header_lines = [line] + [epwin.readline() for i in xrange(7)] --> 379 self._import_header(header_lines) 380 if import_header_only: 381 return File .\.venv\lib\site-packages\ladybug\epw.py:513, in EPW._import_header(self, header_lines) 509 grnd_header = Header(temperature.GroundTemperature(), 'C', 510 AnalysisPeriod(), header_meta) 511 grnd_vals = [float(x) for x in grnd_data[st_ind + 4: st_ind + 16]] 512 self._monthly_ground_temps[float(grnd_data[st_ind])] = \ --> 513 MonthlyCollection(grnd_header, grnd_vals, list(xrange(12))) 514 st_ind += 16 516 # parse leap year, daylight savings and comments. File .\.venv\lib\site-packages\ladybug\datacollection.py:1359, in __init__(self, header, values, datetimes) 1357 self._datetimes = tuple(datetimes) 1358 self.values = values -> 1359 self._validated_a_period = False TypeError: descriptor '_header' for 'BaseCollection' objects doesn't apply to a 'MonthlyCollection' objectAnd the other is when accessing data collections from an
SQLiteResult:--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) Cell In[1], line 5 3 sql_obj = SQLiteResult(r"C:\Users\...\model\openstudio\run\eplusout.sql") 4 for outp in sql_obj.available_outputs: ----> 5 sql_obj.data_collections_by_output_name(outp) File c:\Users\...\.venv\lib\site-packages\ladybug\sql.py:371, in SQLiteResult.data_collections_by_output_name(self, output_name) 369 if report_frequency == 'Hourly' or isinstance(report_frequency, int): 370 for head, values in zip(headers, all_values): --> 371 data_colls.append(HourlyContinuousCollection(head, values)) 372 elif report_frequency == 'Daily': 373 for head, values in zip(headers, all_values): File c:\Users\...\.venv\lib\site-packages\ladybug\datacollection.py:614, in HourlyContinuousCollection.__init__(self, header, values) 609 assert header.analysis_period.end_hour == 23, \ 610 'analysis_period end hour of {} must be 23. Got {}'.format( 611 self.__class__.__name__, header.analysis_period.end_hour) 613 self._header = header --> 614 self.values = values 615 self._datetimes = None 616 self._validated_a_period = True File c:\Users\...\.venv\lib\site-packages\ladybug\_datacollectionbase.py:96, in BaseCollection.values(self, values) 94 @values.setter 95 def values(self, values): ---> 96 self._check_values(values) 97 self._values = list(values) File c:\Users\...\.venv\lib\site-packages\ladybug\datacollection.py:1024, in HourlyContinuousCollection._check_values(self, values) 1020 """Check values whenever they come through the values setter.""" 1021 assert isinstance(values, Iterable) and not isinstance( 1022 values, (str, dict, bytes, bytearray)), \ 1023 'values should be a list or tuple. Got {}'.format(type(values)) -> 1024 assert len(values) == len(self.header.analysis_period), 'Length of ' \ 1025 'values does not match that expected by the header analysis_period.'\ 1026 ' {} != {}'.format(len(values), len(self.header.analysis_period)) AssertionError: Length of values does not match that expected by the header analysis_period. 8760 != 8784