def _import_data(self):
<EOL>iron_python = True<EOL>try:<EOL><INDENT>iron_python = True if platform.python_implementation() == '<STR_LIT>'else False<EOL><DEDENT>except ValueError as e:<EOL><INDENT>if '<STR_LIT>' in str(e):<EOL><INDENT>iron_python = True<EOL><DEDENT><DEDENT>if iron_python:<EOL><INDENT>statwin = codecs.open(self.file_path, '<STR_LIT:r>')<EOL><DEDENT>else:<EOL><INDENT>statwin = codecs.open(self.file_path, '<STR_LIT:r>', encoding='<STR_LIT:utf-8>', errors='<STR_LIT:ignore>')<EOL><DEDENT>try:<EOL><INDENT>line = statwin.readline()<EOL>self._header = [line] + [statwin.readline() for i in xrange(<NUM_LIT:9>)]<EOL>self._body = statwin.read()<EOL><DEDENT>except Exception as e:<EOL><INDENT>import traceback<EOL>raise Exception('<STR_LIT>'.format(e, traceback.format_exc()))<EOL><DEDENT>else:<EOL><INDENT>loc_name = self._header[<NUM_LIT:2>].strip().replace('<STR_LIT>', '<STR_LIT>')<EOL>if '<STR_LIT>' in loc_name:<EOL><INDENT>city = '<STR_LIT:U+0020>'.join(loc_name.split('<STR_LIT>')[:-<NUM_LIT:1>])<EOL><DEDENT>else:<EOL><INDENT>city = '<STR_LIT:U+0020>'.join(loc_name.split()[:-<NUM_LIT:2>])<EOL><DEDENT>country = loc_name.split('<STR_LIT:U+0020>')[-<NUM_LIT:1>]<EOL>source = self._header[<NUM_LIT:6>].strip().replace('<STR_LIT>', '<STR_LIT>')<EOL>station_id = self._header[<NUM_LIT:8>].strip().replace('<STR_LIT>', '<STR_LIT>')<EOL>if iron_python:<EOL><INDENT>coord_pattern = re.compile(r"<STR_LIT>")<EOL>matches = coord_pattern.findall(self._header[<NUM_LIT:3>].replace('<STR_LIT>', '<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>coord_pattern = re.compile(r"<STR_LIT>")<EOL>matches = coord_pattern.findall(self._header[<NUM_LIT:3>])<EOL><DEDENT>lat_sign = -<NUM_LIT:1> if matches[<NUM_LIT:0>][<NUM_LIT:0>] == '<STR_LIT:S>' else <NUM_LIT:1><EOL>latitude = lat_sign * (float(matches[<NUM_LIT:0>][<NUM_LIT:1>]) + (float(matches[<NUM_LIT:0>][<NUM_LIT:2>]) / <NUM_LIT>))<EOL>lon_sign = -<NUM_LIT:1> if matches[<NUM_LIT:1>][<NUM_LIT:0>] == '<STR_LIT>' else <NUM_LIT:1><EOL>longitude = lon_sign * (float(matches[<NUM_LIT:1>][<NUM_LIT:1>]) + (float(matches[<NUM_LIT:1>][<NUM_LIT:2>]) / <NUM_LIT>))<EOL>time_zone = self._regex_check(r"<STR_LIT>", self._header[<NUM_LIT:3>])<EOL>elev_pattern = re.compile(r"<STR_LIT>")<EOL>elev_matches = elev_pattern.findall(self._header[<NUM_LIT:4>])<EOL>if len(elev_matches) == <NUM_LIT:0>:<EOL><INDENT>elev_pattern = re.compile(r"<STR_LIT>")<EOL>elev_matches = elev_pattern.findall(self._header[<NUM_LIT:4>])<EOL><DEDENT>elev_sign = -<NUM_LIT:1> if elev_matches[<NUM_LIT:0>][-<NUM_LIT:1>].lower() == '<STR_LIT>' else <NUM_LIT:1><EOL>elevation = elev_sign * float(elev_matches[<NUM_LIT:0>][<NUM_LIT:0>])<EOL>self._location = Location()<EOL>self._location.city = city<EOL>self._location.country = country<EOL>self._location.source = source<EOL>self._location.station_id = station_id<EOL>self._location.latitude = latitude<EOL>self._location.longitude = longitude<EOL>self._location.time_zone = time_zone<EOL>self._location.elevation = elevation<EOL>self._stand_press_at_elev = self._regex_check(<EOL>r"<STR_LIT>", self._header[<NUM_LIT:5>])<EOL>self._ashrae_climate_zone = self._regex_check(<EOL>r'<STR_LIT>', self._body)<EOL>self._koppen_climate_zone = self._regex_check(<EOL>r'<STR_LIT>', self._body)<EOL>self._extreme_hot_week = self._regex_week_parse(<EOL>r"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>self._extreme_cold_week = self._regex_week_parse(<EOL>r"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>self._typical_weeks = self._regex_typical_week_parse()<EOL>winter_vals = self._regex_parse(r"<STR_LIT>")<EOL>for key, val in zip(DesignDay.heating_keys, winter_vals):<EOL><INDENT>self._winter_des_day_dict[key] = val<EOL><DEDENT>summer_vals = self._regex_parse(r"<STR_LIT>")<EOL>for key, val in zip(DesignDay.cooling_keys, summer_vals):<EOL><INDENT>self._summer_des_day_dict[key] = val<EOL><DEDENT>self._monthly_tau_beam = self._regex_parse(r"<STR_LIT>")<EOL>self._monthly_tau_diffuse = self._regex_parse(r"<STR_LIT>")<EOL>self._monthly_db_50 = self._regex_parse(r"<STR_LIT>")<EOL>self._monthly_wb_50 = self._regex_parse(r"<STR_LIT>")<EOL>self._monthly_db_100 = self._regex_parse(r"<STR_LIT>")<EOL>self._monthly_wb_100 = self._regex_parse(r"<STR_LIT>")<EOL>self._monthly_db_20 = self._regex_parse(r"<STR_LIT>")<EOL>self._monthly_wb_20 = self._regex_parse(r"<STR_LIT>")<EOL>self._monthly_db_04 = self._regex_parse(r"<STR_LIT>")<EOL>self._monthly_wb_04 = self._regex_parse(r"<STR_LIT>")<EOL>self._monthly_db_range_50 = self._regex_parse(r"<STR_LIT>")<EOL>self._monthly_wb_range_50 = self._regex_parse(r"<STR_LIT>")<EOL>self._monthly_wind = self._regex_parse(<EOL>r"<STR_LIT>")<EOL>for direction in self._wind_dir_names:<EOL><INDENT>re_string = r"<STR_LIT>" + direction + r"<STR_LIT>"<EOL>dirs = self._regex_parse(re_string)<EOL>if dirs != []:<EOL><INDENT>self._monthly_wind_dirs.append(dirs)<EOL><DEDENT><DEDENT>if self._monthly_wind_dirs == []:<EOL><INDENT>self._monthly_wind_dirs = [[<NUM_LIT:0>] * <NUM_LIT:12> for i in xrange(<NUM_LIT:8>)]<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>statwin.close()<EOL><DEDENT>
Import data from a stat file.