Skip to content

Commit

Permalink
fix(stat): Implement better workaround for degree symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed Mar 20, 2024
1 parent 5e6cf35 commit e97954e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ladybug/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class STAT(object):
_wind_dir_names = ('North', 'NorthEast', 'East', 'SouthEast', 'South',
'SouthWest', 'West', 'NorthWest')
# compiled strings for identifying data in the file
_coord_pattern1 = re.compile(r"{([NSEW])(\s*\d*)deg(\s*\d*)")
_coord_pattern1 = re.compile(r"{([NSEW])(\s*\d*).(\s*\d*)")
_coord_pattern2 = re.compile(r"{([NSEW])(\s*\d*) (\s*\d*)")
_elev_pattern1 = re.compile(r"Elevation\s*[-]*\s*(\d*)m\s*(\S*)")
_elev_pattern2 = re.compile(r"Elevation\s*[-]*\s*(\d*)\s*m\s*(\S*)")
Expand Down Expand Up @@ -272,8 +272,7 @@ def _import_data(self):
source = self._header[6].strip().replace('Data Source -- ', '')
station_id = self._header[8].strip().replace('WMO Station ', '')
if iron_python: # IronPython
matches = self._coord_pattern1.findall(
self._header[3].replace('\xb0', 'deg'))
matches = self._coord_pattern1.findall(self._header[3])
else: # CPython
matches = self._coord_pattern2.findall(self._header[3])
lat_sign = -1 if matches[0][0] == 'S' else 1
Expand Down

0 comments on commit e97954e

Please sign in to comment.