myahyagunes
10/5/2019 - 5:39 AM

openweathermap.org Weather Codes

simpleWeather: function a(i) {
    i = t.extend({
        location: "",
        woeid: "",
        unit: "f",
        success: function (t) {
            var n = "http://api.openweathermap.org/data/2.5/weather?" + "q=" + i.location + "&lang=" + i.woeid + "&cnt=1&APPID=fed6e5ba195394929ffd6b8936fd2237";

            t.getJSON(n,
               function (t) {
                   if (null !== t) {
                       var o, n = t,
                        r = {},
                        s = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW", "N"],
                        a = "https://s.yimg.com/os/mit/media/m/weather/images/icons/l/44d-100567.png";

                       r.temp = t.main.temp,
                       r.icon = t.weather.icon;
                       r.wind = t.wind.speed;
                
                       o.image = "http://openweathermap.org/img/w/" + n.weather.icon + ".png",
                       r.icon.push(o);
                       i.success(r)
                   }
               });
        },
        error: function (t) {
            error("There was a problem retrieving the latest weather information.");
        },
            

            

            //r.title = n.item.title,
            //r.temp = n.item.condition.temp,
            //r.code = n.item.condition.code,
            //r.todayCode = n.item.forecast[0].code,
            //r.currently = n.item.condition.text,
            //r.high = n.item.forecast[0].high,
            //r.low = n.item.forecast[0].low,
            //r.text = n.item.forecast[0].text,
            //r.humidity = n.atmosphere.humidity,
            //r.pressure = n.atmosphere.pressure,
            //r.rising = n.atmosphere.rising,
            //r.visibility = n.atmosphere.visibility,
            //r.sunrise = n.astronomy.sunrise,
            //r.sunset = n.astronomy.sunset,
            //r.description = n.item.description,
            //r.city = n.location.city,
            //r.country = n.location.country,
            //r.region = n.location.region,
            //r.updated = n.item.pubDate,
            //r.link = n.item.link,
            //r.units = {
            //    temp: n.units.temperature,
            //    distance: n.units.distance,
            //    pressure: n.units.pressure,
            //    speed: n.units.speed
            //}, r.wind = {
            //    chill: n.wind.chill,
            //    direction: s[Math.round(n.wind.direction / 22.5)],
            //    speed: n.wind.speed
            //}, n.item.condition.temp < 80 && n.atmosphere.humidity < 40 ? r.heatindex = -42.379 + 2.04901523 * n.item.condition.temp + 10.14333127 * n.atmosphere.humidity - .22475541 * n.item.condition.temp * n.atmosphere.humidity - 6.83783 * Math.pow(10, -3) * Math.pow(n.item.condition.temp, 2) - 5.481717 * Math.pow(10, -2) * Math.pow(n.atmosphere.humidity, 2) + 1.22874 * Math.pow(10, -3) * Math.pow(n.item.condition.temp, 2) * n.atmosphere.humidity + 8.5282 * Math.pow(10, -4) * n.item.condition.temp * Math.pow(n.atmosphere.humidity, 2) - 1.99 * Math.pow(10, -6) * Math.pow(n.item.condition.temp, 2) * Math.pow(n.atmosphere.humidity, 2) : r.heatindex = n.item.condition.temp, "3200" == n.item.condition.code ? (r.thumbnail = a, r.image = a) : (r.thumbnail = "https://s.yimg.com/zz/combo?a/i/us/nws/weather/gr/" + n.item.condition.code + "ds.png", r.image = "https://s.yimg.com/zz/combo?a/i/us/nws/weather/gr/" + n.item.condition.code + "d.png"), r.alt = {
            //    temp: e(i.unit, n.item.condition.temp),
            //    high: e(i.unit, n.item.forecast[0].high),
            //    low: e(i.unit, n.item.forecast[0].low)
            //}, "f" === i.unit ? r.alt.unit = "c" : r.alt.unit = "f", r.forecast = [];

        }), this
}
})
<script type="text/javascript">
    $(document).ready(function () {
        loadWeather('@ViewBag.CityName , nl');
        function loadWeather(location, woeid) {
            $.simpleWeather({
                location: location,
                woeid: '',
                unit: 'c',
                success: function a(weather) {
                    html = "<h2 style=\"color:#EF821B\">" + weather.temp + "&deg;" + "  <i style=\"color:#EF821B\" class=\"icon-" + weather.code + "\"></i></h2>";
                    $("#weather").html(html);
                },
                error: function a(error) {
                    $("#weather").html('&lt;p&gt;' + error + '&lt;/p&gt;');
                }
            });
        }
    });
</script>