How to calculate a 'Feels-Like' temperature using OpenWeatherMaps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require( 'http' ); | |
var url = 'http://api.openweathermap.org/data/2.5/weather?zip=<YOURZIP>,us&units=imperial&APPID=<YOURAPPID>'; | |
http.get( url, function( response ) { | |
var data = ''; | |
response.on( 'data', function( x ) { data += x; } ); | |
response.on( 'end', function() { | |
var json = JSON.parse( data ); | |
var temp = json.main.temp; | |
var wind_speed = json.wind.speed; | |
var wind_chill = 35.74 + 0.6215*temp - 35.75*Math.pow(wind_speed, 0.16) + 0.4275*temp*Math.pow(wind_speed, 0.16); | |
var chill_rounded = Math.round( wind_chill * 10 ) / 10; | |
} ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment