marians / openweather

Rudimentary python client for OpenWeatherMap.org
9 stars 4 forks source link

One question about the variables in weather data #12

Open envhyf opened 8 years ago

envhyf commented 8 years ago

First, thanks for your wonderful job!
I tried your code example today, and I was confused about the meaning of the "name" show like this:

{u'dt': 1376478000, u'main': {u'temp': {u'c': 56, u'ma': 307.04, u'mi': 302.04, u'v': 305.27}, u'temp_max': 302.04}, u'precipitation': {u'v': {u'c': 56, u'ma': 0, u'mi': 0, u'v': 0}}, u'rain': {u'1h': {u'c': 56, u'ma': 0, u'mi': 0, u'v': 0}, u'today': {u'c': 56, u'ma': 0, u'mi': 0, u'v': 0}}, u'temp': {u'c': 56, u'ma': 307.04, u'mi': 302.04, u'v': 305.27}, u'wind': {u'deg': {u'v': 0}, u'gust': {u'c': 56, u'ma': 0, u'mi': 0, u'v': 0}, u'speed': {u'c': 56, u'ma': 0, u'mi': 0, u'v': 0}}}

I can't find the humidity, pressure and wind direction in the list.

I have browsed the http://openweathermap.org/wiki/API/2.1/JSON_API And I find my list type isn't like the history hours data layout like this:

{"dt":1345190400, "rain":{ "1h":{"v":0,"c":6,"mi":0,"ma":0}, "today":{"v":0.9,"c":6,"mi":0.9,"ma":0.9}}, "calc":{ "dewpoint":{"v":16.35,"c":6,"mi":16.1,"ma":16.8}}, "wind":{ "speed":{"v":0,"c":6,"mi":0,"ma":0}, "gust":{"v":0.62,"c":6,"mi":0.3,"ma":1.4}}, "main":{ "humidity":{"v":71.67,"c":6,"mi":68,"ma":74}, "temp":{"v":294.87,"c":6,"mi":294.15,"ma":295.45}, "pressure":{"v":1009.97,"c":6,"mi":1009.9,"ma":1010}}},

Wish for your reply! Thanks again!

marians commented 8 years ago

The wind direction should be this: u'wind': {u'deg': {u'v': 0},, where the "v" stands for the value of the degrees measure. Zero degrees should mean that wind is cumming exactly from north. Which is of course not very likely, but that's some other issue.

I can't find humidity and pressure either.

And I find my list type isn't like the history hours data layout like this

What do you mean with "my list type"?

envhyf commented 8 years ago

Thanks for your reply. I mean the list I get from ow.get_historic_weather() has not concluded "humidity" and "pressure" .
What's more, the wind direction and speed from the data I get from in Beijing, China(station ID =59328) show like this:

u'wind': {u'gust': {u'ma': 0, u'c': 7, u'mi': 0, u'v': 0}, u'speed': {u'ma': 0, u'c': 7, u'mi': 0, u'v': 0}

Is it mean that the ['wind']['gust']['c'] is the wind direction, and the ['speed']['c'] is the velocity(m/s)? Lot's of them show as the value of 0, is t due to the data missing of the station?