

def get_tmy3_data(self, station, station_fallback=True):
    if (self.stations is None):
        self.stations = self._load_stations()
    if (not (station in self.stations)):
        warnings.warn('Station {} is not a TMY3 station. See self.stations for a complete list.'.format(station))
        if station_fallback:
            station = self._find_nearby_station(station)
        else:
            station = None
    if (station is None):
        return None
    url = 'http://rredc.nrel.gov/solar/old_data/nsrdb/1991-2005/data/tmy3/{}TYA.CSV'.format(station)
    r = requests.get(url)
    if (r.status_code == 200):
        hours = []
        for line in r.text.splitlines()[2:]:
            row = line.split(',')
            year = row[0][6:10]
            month = row[0][0:2]
            day = row[0][3:5]
            hour = (int(row[1][0:2]) - 1)
            date_string = '{}{}{}{:02d}'.format(year, month, day, hour)
            dt = datetime.strptime(date_string, '%Y%m%d%H')
            temp_C = float(row[31])
            hours.append({
                'temp_C': temp_C,
                'dt': dt,
            })
        return hours
    else:
        warnings.warn('Station {} was not found. Tried url {}.'.format(station, url))
        return None

dataset/ETHPy150Open impactlab/eemeter/eemeter/weather.py TMY3Client.get_tmy3_data/original