Get weather_name
512971
def get_weather_name(self, ip):
        '''  '''
        rec = self.get_all(ip)
        return rec and rec.weather_name
563590
def getDynMeth(name):
    '''
    
    '''
    cname, fname = name.rsplit('.', 1)

    clas = getDynLocal(cname)
    if clas is None:
        return None

    return getattr(clas, fname, None)
87862
function getNames(local) {
    return forAll(data, function getNamesIterator(row) {
        return local ? row.local : row.name;
    });
}
630273
def to_dict(self):
        
        return {
            'station_id': self.station_id,
            'timestamp': self.timestamp,
            'temperature': self.temperature,
            'wind_speed': self.wind_speed,
            'wind_gust': self.wind_gust,
            'wind_deg': self.wind_deg,
            'pressure': self.pressure,
            'humidity': self.humidity,
            'rain_1h': self.rain_1h,
            'rain_6h': self.rain_6h,
            'rain_24h': self.rain_24h,
            'snow_1h': self.snow_1h,
            'snow_6h': self.snow_6h,
            'snow_24h': self.snow_24h,
            'dew_point': self.dew_point,
            'humidex': self.humidex,
            'heat_index': self.heat_index,
            'visibility_distance': self.visibility_distance,
            'visibility_prefix': self.visibility_prefix,
            'clouds_distance': self.clouds_distance,
            'clouds_condition': self.clouds_condition,
            'clouds_cumulus': self.clouds_cumulus,
            'weather_precipitation': self.weather_precipitation,
            'weather_descriptor': self.weather_descriptor,
            'weather_intensity': self.weather_intensity,
            'weather_proximity': self.weather_proximity,
            'weather_obscuration': self.weather_obscuration,
            'weather_other': self.weather_other}
480320
def name(self):
        """"""
        with self._bt_interface.connect(self._mac) as connection:
            name = connection.read_handle(_HANDLE_READ_NAME)  # pylint: disable=no-member

        if not name:
            raise BluetoothBackendException("Could not read NAME using handle %s"
                                            " from Mi Temp sensor %s" % (hex(_HANDLE_READ_NAME), self._mac))
        return ''.join(chr(n) for n in name)
237021
def check_weather(self):
        '''
        
        '''

        if self.units not in ('imperial', 'metric'):
            raise Exception("units must be one of (imperial, metric)!")

        if self.location_code is None:
            self.logger.error(
                'A location_code is required to check Weather.com. See the '
                'documentation for more information.'
            )
            self.data['update_error'] = self.update_error
            return
        self.data['update_error'] = ''
        try:

            self.parser.get_weather_data(self.forecast_url)
            if self.parser.weather_data is None:
                self.logger.error(
                    'Failed to read weather data from page. Run module with '
                    'debug logging to get more information.'
                )
                self.data['update_error'] = self.update_error
                return

            try:
                observed = self.parser.weather_data['Observation']
                # Observation data stored under a sub-key containing the
                # lat/long coordinates. For example:
                #
                # geocode:41.77,-88.35:language:en-US:units:e
                #
                # Since this is the only key under "Observation", we can just
                # use next(iter(observed)) to get it.
                observed = observed[next(iter(observed))]['data']['vt1observation']
            except KeyError:
                self.logger.error(
                    'Failed to retrieve current conditions from API response. '
                    'Run module with debug logging to get more information.'
                )
                self.data['update_error'] = self.update_error
                return

            try:
                forecast = self.parser.weather_data['DailyForecast']
                # Same as above, use next(iter(forecast)) to drill down to the
                # correct nested dict level.
                forecast = forecast[next(iter(forecast))]
                forecast = forecast['data']['vt1dailyForecast'][0]
            except (IndexError, KeyError):
                self.logger.error(
                    'Failed to retrieve forecast data from API response. '
                    'Run module with debug logging to get more information.'
                )
                self.data['update_error'] = self.update_error
                return

            try:
                self.city_name = self.parser.weather_data['Location']
                # Again, same technique as above used to get down to the
                # correct nested dict level.
                self.city_name = self.city_name[next(iter(self.city_name))]
                self.city_name = self.city_name['data']['prsntNm']
            except KeyError:
                self.logger.warning(
                    'Failed to get city name from API response, falling back '
                    'to location code \'%s\'', self.location_code
                )
                self.city_name = self.location_code

            # Cut off the timezone from the end of the string (it's after the last
            # space, hence the use of rpartition). International timezones (or ones
            # outside the system locale) don't seem to be handled well by
            # datetime.datetime.strptime().
            try:
                observation_time_str = str(observed.get('observationTime', ''))
                observation_time = datetime.strptime(observation_time_str,
                                                     '%Y-%d-%yT%H:%M:%S%z')
            except (ValueError, AttributeError):
                observation_time = datetime.fromtimestamp(0)

            try:
                pressure_trend_str = observed.get('barometerTrend', '').lower()
            except AttributeError:
                pressure_trend_str = ''

            if pressure_trend_str == 'rising':
                pressure_trend = '+'
            elif pressure_trend_str == 'falling':
                pressure_trend = '-'
            else:
                pressure_trend = ''

            try:
                high_temp = forecast.get('day', {}).get('temperature', '')
            except (AttributeError, IndexError):
                high_temp = ''
            else:
                if high_temp is None:
                    # In the mid-afternoon, the high temp disappears from the
                    # forecast, so just set high_temp to an empty string.
                    high_temp = ''

            try:
                low_temp = forecast.get('night', {}).get('temperature', '')
            except (AttributeError, IndexError):
                low_temp = ''

            if self.units == 'imperial':
                temp_unit = '°F'
                wind_unit = 'mph'
                pressure_unit = 'in'
                visibility_unit = 'mi'
            else:
                temp_unit = '°C'
                wind_unit = 'kph'
                pressure_unit = 'mb'
                visibility_unit = 'km'

            self.data['city'] = self.city_name
            self.data['condition'] = str(observed.get('phrase', ''))
            self.data['observation_time'] = observation_time
            self.data['current_temp'] = str(observed.get('temperature', ''))
            self.data['low_temp'] = str(low_temp)
            self.data['high_temp'] = str(high_temp)
            self.data['temp_unit'] = temp_unit
            self.data['feelslike'] = str(observed.get('feelsLike', ''))
            self.data['dewpoint'] = str(observed.get('dewPoint', ''))
            self.data['wind_speed'] = str(observed.get('windSpeed', ''))
            self.data['wind_unit'] = wind_unit
            self.data['wind_direction'] = str(observed.get('windDirCompass', ''))
            # Gust can be None, using "or" to ensure empty string in this case
            self.data['wind_gust'] = str(observed.get('gust', '') or '')
            self.data['pressure'] = str(observed.get('altimeter', ''))
            self.data['pressure_unit'] = pressure_unit
            self.data['pressure_trend'] = pressure_trend
            self.data['visibility'] = str(observed.get('visibility', ''))
            self.data['visibility_unit'] = visibility_unit
            self.data['humidity'] = str(observed.get('humidity', ''))
            self.data['uv_index'] = str(observed.get('uvIndex', ''))
        except Exception:
            # Don't let an uncaught exception kill the update thread
            self.logger.error(
                'Uncaught error occurred while checking weather. '
                'Exception follows:', exc_info=True
            )
            self.data['update_error'] = self.update_error
535449
def _get_all_forecast_from_api(api_result: dict) -> OrderedDict:
    """"""
    # Total time in hours since last forecast
    total_hours_last_forecast = 1.0

    # Last forecast time
    last_time = None

    # Need the ordered dict to get
    # the days in order in next stage
    forecasts_ordered = OrderedDict()

    # Get the parameters
    for forecast in api_result['timeSeries']:

        valid_time = datetime.strptime(
            forecast['validTime'], "%Y-%m-%dT%H:%M:%SZ")
        for param in forecast['parameters']:
            if param['name'] == 't':
                temperature = float(param['values'][0])  # Celcisus
            elif param['name'] == 'r':
                humidity = int(param['values'][0])  # Percent
            elif param['name'] == 'msl':
                pressure = int(param['values'][0])  # hPa
            elif param['name'] == 'tstm':
                thunder = int(param['values'][0])  # Percent
            elif param['name'] == 'tcc_mean':
                octa = int(param['values'][0])  # Cloudiness in octas
                if 0 <= octa <= 8:  # Between 0 -> 8
                    cloudiness = round(100*octa/8)  # Convert octas to percent
                else:
                    cloudiness = 100  # If not determined use 100%
            elif param['name'] == 'Wsymb2':
                symbol = int(param['values'][0])  # category
            elif param['name'] == 'pcat':
                precipitation = int(param['values'][0])  # percipitation
            elif param['name'] == 'pmean':
                mean_precipitation = float(
                    param['values'][0])  # mean_percipitation
            elif param['name'] == 'ws':
                wind_speed = float(param['values'][0])  # wind speed
            elif param['name'] == 'wd':
                wind_direction = int(param['values'][0])  # wind direction
            elif param['name'] == 'vis':
                horizontal_visibility = float(param['values'][0])  # Visibility
            elif param['name'] == 'gust':
                wind_gust = float(param['values'][0])  # wind gust speed

        roundedTemp = int(round(temperature))

        if last_time is not None:
            total_hours_last_forecast = (valid_time - last_time).seconds/60/60

        # Total precipitation, have to calculate with the nr of
        # hours since last forecast to get correct total value
        tp = round(mean_precipitation*total_hours_last_forecast, 2)

        forecast = \
            SmhiForecast(roundedTemp, roundedTemp, roundedTemp,
                         humidity, pressure, thunder, cloudiness,
                         precipitation, wind_direction, wind_speed,
                         horizontal_visibility, wind_gust,
                         round(mean_precipitation, 1), tp, symbol,
                         valid_time)

        if valid_time.day not in forecasts_ordered:
            # add a new list
            forecasts_ordered[valid_time.day] = []

        forecasts_ordered[valid_time.day].append(forecast)

        last_time = valid_time

    return forecasts_ordered
302190
def forecast_names(self):
        
        if "forecasts" in self.pestpp_options.keys():
            return self.pestpp_options["forecasts"].lower().split(',')
        elif "predictions" in self.pestpp_options.keys():
            return self.pestpp_options["predictions"].lower().split(',')
        else:
            return None
1302436
function getTempFileName(state) {
    var fn = state.tmp_dir + "/delta_js_" + state.round + "." + state.ext;
    state.round++;
    return fn;
}
185425
def get_name(self, properly_capitalized=False):
        """"""

        if properly_capitalized:
            self.name = _extract(
                self._request(self.ws_prefix + ".getInfo", True), "name"
            )

        return self.name
615072
def formatted(self):
    '''  '''

    return """
Weather Station: %s (%s, %s)
Elevation: %s m
Time: %s UTC
Air Temperature: %s C (%s F)
Wind Speed: %s m/s (%s mph)
Wind Direction: %s
Present Weather Obs: %s
Precipitation: %s
Cloud Coverage: %s oktas
Cloud Summation: %s
Solar Irradiance: %s 
    """ % (self.weather_station, self.latitude, self.longitude,
           self.elevation, self.datetime, self.air_temperature,
           self.air_temperature.get_fahrenheit(), self.wind_speed,
           self.wind_speed.get_miles(), self.wind_direction,
           str(self.present_weather), str(self.precipitation),
           str(self.sky_cover), str(self.sky_cover_summation),
           str(self.solar_irradiance))
775259
async def weather_type_classe(self):
        """"""

        data = await self.retrieve(url=API_WEATHER_TYPE)

        self.weather_type = dict()

        for _type in data['data']:
            self.weather_type[_type['idWeatherType']] = _type['descIdWeatherTypePT']

        return self.weather_type
200586
def updateWeather(self):
        """"""
        yql = _YQL_WEATHER.format(self._woeid, self._unit)

        # send request
        tmpData = _yql_query(yql)

        # data exists
        if tmpData is not None and "channel" in tmpData:
            self._data = tmpData["channel"]
            return True

        _LOGGER.error("Fetch no weather data Yahoo!")
        self._data = {}
        return False
212690
function prepareWeather(weatherData) {
      return {
        temperature: weatherData.main.temp,
        icon: (angular.isDefined(weatherIcons[weatherData.weather[0].icon])) ? weatherData.weather[0].icon : weatherData.weather[0].id,
        description: weatherData.weather[0].description
      }
    }
221567
def name(self) -> str:
        """"""
        if self.direction == DIRECTION_IN:
            return self.raw.get('Input.Name', '')
        return self.raw.get('Output.Name', '')
530494
def ep_style_string(self):
        
        # Put together the values in the order that they exist in the ddy file
        ep_vals = [self.name,
                   self.sky_condition.month,
                   self.sky_condition.day_of_month,
                   self.day_type,
                   self.dry_bulb_condition.dry_bulb_max,
                   self.dry_bulb_condition.dry_bulb_range,
                   self.dry_bulb_condition.modifier_type,
                   self.dry_bulb_condition.modifier_schedule,
                   self.humidity_condition.hum_type, '',
                   self.humidity_condition.schedule, '', '',
                   self.humidity_condition.wet_bulb_range,
                   self.humidity_condition.barometric_pressure,
                   self.wind_condition.wind_speed,
                   self.wind_condition.wind_direction,
                   self.wind_condition.rain,
                   self.wind_condition.snow_on_ground,
                   self.sky_condition.daylight_savings_indicator,
                   self.sky_condition.solar_model,
                   self.sky_condition.beam_shced,
                   self.sky_condition.diff_sched, '', '', '']

        # assign humidity values based on the type of criteria
        if self.humidity_condition.hum_type == 'Wetbulb' or \
                self.humidity_condition.hum_type == 'Dewpoint':
                    ep_vals[9] = self.humidity_condition.hum_value
        elif self.humidity_condition.hum_type == 'HumidityRatio':
            ep_vals[11] = self.humidity_condition.hum_value
        elif self.humidity_condition.hum_type == 'Enthalpy':
            ep_vals[12] = self.humidity_condition.hum_value

        # assign sky condition values based on the solar model
        if self.sky_condition.solar_model == 'ASHRAEClearSky':
            ep_vals[25] = self.sky_condition.clearness
        if self.sky_condition.solar_model == 'ASHRAETau':
            ep_vals[23] = self.sky_condition.tau_b
            ep_vals[24] = self.sky_condition._tau_d
            ep_vals.pop()

        # put everything together into one string
        comented_str = ['  {},{}{}\n'.format(
            str(val), ' ' * (60 - len(str(val))), self.comments[i])
                        for i, val in enumerate(ep_vals)]
        comented_str[-1] = comented_str[-1].replace(',', ';')
        comented_str.insert(0, 'SizingPeriod:DesignDay,\n')
        comented_str.append('\n')

        return ''.join(comented_str)
625048
def _getsatname(self):
        
        if self.platform_name.startswith("Meteosat"):
            return self.platform_name
        else:
            raise NotImplementedError(
                'Platform {0} not yet supported...'.format(self.platform_name))