Skip to content

Commit a852930

Browse files
committed
fix(stat): Ensure that ashrae climate zone is always string
1 parent 829d7cb commit a852930

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ladybug/stat.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,9 @@ def _import_data(self):
299299
self._stand_press_at_elev = self._regex_check(
300300
self._press_pattern, self._header[5])
301301
self._ashrae_climate_zone = self._regex_check(
302-
self._ashraecz_pattern, self._body)
302+
self._ashraecz_pattern, self._body, enforce_string=True)
303303
self._koppen_climate_zone = self._regex_check(
304-
self._koppencz_pattern, self._body)
304+
self._koppencz_pattern, self._body, enforce_string=True)
305305

306306
# pull out extreme and seasonal weeks.
307307
self._extreme_hot_week = self._regex_week_parse(self._hotweek_pattern)
@@ -340,9 +340,11 @@ def _import_data(self):
340340
finally:
341341
statwin.close()
342342

343-
def _regex_check(self, regex_pattern, search_space):
343+
def _regex_check(self, regex_pattern, search_space, enforce_string=False):
344344
matches = regex_pattern.findall(search_space)
345345
if len(matches) > 0:
346+
if enforce_string:
347+
return matches[0]
346348
try:
347349
return float(matches[0])
348350
except ValueError:

0 commit comments

Comments
 (0)