Support Center

Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Empty precipitation field

Bastien Sep 11, 2019 04:27PM BST

Hi,

I'm interested in temperature, humidity, wind speed and precipitation data. I saw that json does not provide the precipitation data so I moved on xml mode.
Here my request (I'm working in python) :
str_req="http://api.openweathermap.org/data/2.5/forecast?APPID={}&lat=48.8566969&lon=2.3514616&mode=xml".format(key)

Problem : the precipitation field is empty. I tryed for Paris and Toulouse but always empty. Above the answer I got :
<?xml version="1.0" encoding="UTF-8"?>
<weatherdata>
<location>
<name>Tournefeuille</name>
<type></type>
<country>FR</country>
<timezone>7200</timezone>
<location altitude="0" latitude="43.5833" longitude="1.35" geobase="geonames" geobaseid="6431860"></location>
</location>
<credit></credit>
<meta>
<lastupdate></lastupdate>
<calctime>0.0077</calctime>
<nextupdate></nextupdate>
</meta>
<sun rise="2019-09-11T05:29:06" set="2019-09-11T18:14:00"></sun>
<forecast>
<time from="2019-09-11T12:00:00" to="2019-09-11T15:00:00">
<symbol number="803" name="broken clouds" var="04d"></symbol>
<precipitation></precipitation>
<windDirection deg="342.123" code="NNW" name="North-northwest"></windDirection>
<windSpeed mps="2.93" unit="m/s" name="Light breeze"></windSpeed>
<temperature unit="kelvin" value="299.23" min="297.2" max="299.23"></temperature>
<pressure unit="hPa" value="1023.57"></pressure>
<humidity value="36" unit="%"></humidity>
<clouds value="broken clouds" all="67" unit="%"></clouds>
</time>
....

And also
<?xml version="1.0" encoding="UTF-8"?>
<weatherdata>
<location>
<name>Saint-Merri</name>
<type></type>
<country>FR</country>
<timezone>7200</timezone>
<location altitude="0" latitude="48.8592" longitude="2.3521" geobase="geonames" geobaseid="2978048"></location>
</location>
<credit></credit>
<meta>
<lastupdate></lastupdate>
<calctime>0.0095</calctime>
<nextupdate></nextupdate>
</meta>
<sun rise="2019-09-11T05:20:59" set="2019-09-11T18:14:06"></sun>
<forecast>
<time from="2019-09-11T15:00:00" to="2019-09-11T18:00:00">
<symbol number="803" name="broken clouds" var="04d"></symbol>
<precipitation></precipitation>
<windDirection deg="261.656" code="W" name="West"></windDirection>
<windSpeed mps="3.4" unit="m/s" name="Gentle Breeze"></windSpeed>
<temperature unit="kelvin" value="293.49" min="292.2" max="293.49"></temperature>
<pressure unit="hPa" value="1025.2"></pressure>
<humidity value="61" unit="%"></humidity>
<clouds value="broken clouds" all="60" unit="%"></clouds>
</time>
...

Does someone know why the precipitation field is empty ?

Up 0 rated Down
Pavel Zuykov Sep 11, 2019 08:16PM BST OpenWeatherMap Agent

Hello,

Rain field will be empty at least then there is no rain in the main weather.

Up 0 rated Down
Bastien Sep 12, 2019 08:14AM BST
Do you mean that rain field (<precipitation></precipitation>) will be always empty or do you mean that an empty field mean 0mm of precipitation ?

I'm using 5 days/3hours forecast, so if I refer to this https://openweathermap.org/forecast5 I can find the following :
forecast.precipitation
forecast.precipitation.value Precipitation volume for the last 3 hours, mm
forecast.precipitation.unit Period of measurements. Possilbe value is 1 hour, 3 hours.
forecast.precipitation.type Type of precipitation. Possible value is rain, snow

By the way, how can I change the units of windspeed to km/h and temperature to celsius ?
Up 1 rated Down
Pavel Zuykov Sep 12, 2019 09:52AM BST OpenWeatherMap Agent

Hello Bastien,

Rain field will be empty if there is no precipitation in the forecast

To change units please follow documentation https://openweathermap.org/forecast5#data

Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)
9eda11838f597e7a95b6a1c991dcae0a@openweathermap.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete