Skip to content
This repository has been archived by the owner on Jan 23, 2019. It is now read-only.

Barometric pressure reading seems wrong. #227

Closed
bklockwood opened this issue Mar 25, 2016 · 5 comments
Closed

Barometric pressure reading seems wrong. #227

bklockwood opened this issue Mar 25, 2016 · 5 comments

Comments

@bklockwood
Copy link

I was confused about the units retreived by weather.pressure. I got lucky and discovered #47 which says:

If you set it to f (Fahrenheit) they return miles, pounds per square inch, and miles per hour.
If you set it to c (Celsius) they return kilometers, millibars, kilometers per hour.

(imho, this should be documented cleanly at http://simpleweatherjs.com/)

But this left me wondering about barometer readings, which typically come in 'inches mercury' (not "pounds per square inch as #47 suggests) or in 'millibars'. I would have guessed that the f setting would bring inches mercury, but this looks wrong to me:

http://codepen.io/quux/pen/zqzBQR

(currently returns "989.0 in")

@fleeting
Copy link
Member

According to Yahoo's documentation it looks like they only return pressure: units of barometric pressure, in for pounds per square inch or mb for millibars (string) - see https://developer.yahoo.com/weather/documentation.html#top for info. Basically I just take the data from Yahoo's API and format to be easy to use, so most of the time I pass along the units and values Yahoo provides. It's possible I could add the other unit by doing a calculation like I've done with F/C and windspeed when I get a chance but a quick solution at the moment is you could do the calculation on your end to convert pounds per square inch to inches of mercury. It would be something like weather.pressure/0.491154152227, which would convert pounds per square inch to inch of mercury.

I'll leave this open as a reminder to look at adding the calculation into the plugin itself. Thanks for the feedback!

@bklockwood
Copy link
Author

Thanks for the response. It would appear that yahoo are wrongly returning the numeric answer in millibars and appending the "in" unit identifier. I have no idea how to submit a bug to them.

@KeepSmillin
Copy link

I had a long day trying to figure out what is happening. On Yahoo weather page the pressure info is correctly rendered in either units (f or c). Using simpleWeather I remarked that for "f" units it returns the correct value but in mbar and it displays "in" for units. When changed to "c" units it multiplies the mbar value with 33.7685 and displays a wrong value in mbar (the value 34405 or so). The 33.7685 is the constant value to transform Hg inches in mbar as 1 in(Hg)=33.7685mbar, so the transformation equation is correct but the input value is wrong ( if the "f" returned value would be correct the "c" (mbar) value would be also correct. I also observed this type of wrong value on many airport sites across US. and nobody seems to notice. At any moment there is no question about psi values (according to numerical values provided). Applying a math transform doesn't solve the problem because the input is wrong (somehow reversed from "f" to "c"). For me it is not clear if the query is OK and the return is wrong or the reverse. Any ideas?!

@fleeting
Copy link
Member

fleeting commented Jun 1, 2016

Thanks for detailing that out! The return data from Yahoo would be wrong. The query to the API only passes in a unit of f or c and that's it.

@KeepSmillin
Copy link

Just for the record. I noticed that sometimes heatindex return is going wild. The returned value is not rounded (as:weather.heatindex: 79.08466565999998) and in "c" units it is becoming totally wrong (as:weather.heatindex: 149.56375613999995). These values were obtained with simpleWeather.dataDump.js [v3.1.0] http://codepen.io/fleeting/pen/yjhBK/ demo for Montreal, QC, today, June 3, 5:25 PM. I experienced this yesterday also. After some time (2 hour or so, yesterday, the returned values become normal again). The only plausible explanation (for me at least) is that Yahoo is mocking us. On another line, those who would like to use images, not the icon font, should create their own images collection because simpleWeather will return only "day" weather images which are not fully compatible with condition codes, especially for queries performed nighttime.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants