• No results found

3.5 Available meteorological data

3.5.2 OpenWeatherMap

OpenWeatherMap is a project inspired by OpenStreetMap and Wikipedia in the sense of making information free and available for everybody. The service nowadays delivers 1 billion forecast per day. It provides open weather data for more than 200.000 cities via website and API. A wide range of data is supplied including current weather, forecasts, historical data, precipitation, wind, clouds, etc, (OpenWeatherMap, 2016).

OpenWeatherMap offers meteorological information through an API. Cur- rently, there are eight API’s for different purposes:

• Current weather data: data from over 200.000 cities available in JSON, XML or HTML format, frequently updated.

• 5 day / 3 hour forecast: for any location, forecast data for 5 days ahead, every 3 hours, available in JSON, XML or HTML format.

62 3. MATERIALS AND METHODS • 16 day / daily forecast: for any location, forecast data for 16 days ahead,

daily basis, available in JSON, XML or HTML format.

• Historical data: historical weather data for more than 20.000 cities. • UV index: current UV index and historical data for any geo location. • Weather map layers: maps with precipitation, clouds, pressure, temperature

and wind info.

• Weather stations: recent data from more than 40.000 stations around the world, search weather stations close to a geographic location.

• Bulk downloading: bulk files with current weather and forecasts from more than 20.000 cities.

Figure 3.7 shows the main page of the OpenWeatherMap web site. Figure 3.8 shows the OpemWeatherMap platform conception, structured in three layers, with de data sources in the lower layer and the providing data services in the upper layer.

Data are collected from thousands of sensors distributed all around the planet, including data from satellites and radars. Archives content data from MODIS, Landsat 7 and 8. Ground sensor network covers more than 40.000 weather stations. High-end technologies are used to automatically process billions of data points every second. Big data and cloud technologies enables OpenWeatherMap to work with immense data and process them right away providing the user with images, maps and data.

For the purposes of this work, current weather data and 5 day / 3 hour forecast data are downloaded and stored in a data base.

Current weather data

Current weather data can be obtained using an API directly on the Open- WeatherMap website (www.openweathermap.org). The url for the API call look like this:

h t t p : / / a p i . openweathermap . o r g / d a t a / 2 . 5 / w e a t h e r ? i d =2514256&

3.5. AVAILABLE METEOROLOGICAL DATA 63

Figure 3.7: OpenWeatherMap web site

The url includes two key parameters, and API KEY for user identification purposes (example: b1b15e88fa797225412429c1c50c122a) and a station id which designates the station we want the data from, in this case 2514256.

The response is in JSON format and looks like this:

{” c o o r d ” : { ” l o n ” : − 4 . 4 2 , ” l a t ” : 3 6 . 7 2 } , ” w e a t h e r ” : [ { ” i d ” : 8 0 0 , ” main ” : ” C l e a r ” , ” d e s c r i p t i o n ” : ” c l e a r

,→ s k y ” , ” i c o n ” : ” 0 1 n ” } ] , ” b a s e ” : ” cmc s t a t i o n s ” , ” main ” : { ” temp ” : 2 8 4 . 4 5 3 , ” p r e s s u r e ” : 1 0 1 8 . 2 4 , ”

,→ h u m i d i t y ” : 1 0 0 , ” temp min ” : 2 8 4 . 4 5 3 , ” temp max ” : 2 8 4 . 4 5 3 , ” s e a l e v e l ” : 1 0 3 4 . 6 6 , ” g r n d l e v e l

,→ ” : 1 0 1 8 . 2 4 } , ” wind ” : { ” s p e e d ” : 2 . 8 6 , ” d e g ” : 1 1 6 . 5 0 5 } , ” c l o u d s ” : { ” a l l ” : 0 } , ” d t ” : 1 4 5 7 8 2 9 5 3 1 , ” s y s

,→ ” : { ” m e s s a g e ” : 0 . 0 0 2 8 , ” c o u n t r y ” : ” ES ” , ” s u n r i s e ” : 1 4 5 7 8 5 0 6 6 1 , ” s u n s e t ” : 1 4 5 7 8 9 3 4 1 3 } , ” i d

,→ ” : 2 5 1 4 2 5 6 , ” name ” : ” Malaga ” , ” c o d ” : 2 0 0 }

This responde includes the following parameters: temperature, pressure, hu- midity, wind speed and direction and the name of the station, in this case M´alaga.

64 3. MATERIALS AND METHODS

Figure 3.8: OpenWeatherMap platform diagram

5 day / 3 hour forecast

Similar to current weather, 5 day forecasts can be downloaded using an API on the web site. The url look like this:

h t t p : / / a p i . openweathermap . o r g / d a t a / 2 . 5 / f o r e c a s t ? i d =2514256&

,→ a p p i d=b 1 b 1 5 e 8 8 f a 7 9 7 2 2 5 4 1 2 4 2 9 c 1 c 5 0 c 1 2 2 a

Again, the url includes the two key parameters, the API KEY of the user and the station code. The response is again in JSON format:

{” c i t y ” : { ” i d ” : 2 5 1 4 2 5 6 , ” name ” : ” Malaga ” , ” c o o r d ” : { ” l o n ” : − 4 . 4 2 0 3 4 , ” l a t ” : 3 6 . 7 2 0 1 6 1 } , ” c o u n t r y ” : ” ES

,→ ” , ” p o p u l a t i o n ” : 0 , ” s y s ” : { ” p o p u l a t i o n ” : 0 } } , ” c o d ” : ” 2 0 0 ” , ” m e s s a g e ” : 0 . 0 0 2 6 , ” c n t ” : 4 0 , ” l i s t

,→ ” : [ { ” d t ” : 1 4 5 7 8 3 8 0 0 0 , ” main ” : { ” temp ” : 2 8 4 . 4 5 , ” temp min ” : 2 8 4 . 4 5 , ” temp max ” : 2 8 4 . 4 5 2 , ”

,→ p r e s s u r e ” : 1 0 1 7 . 3 , ” s e a l e v e l ” : 1 0 3 3 . 7 2 , ” g r n d l e v e l ” : 1 0 1 7 . 3 , ” h u m i d i t y ” : 1 0 0 , ” t e m p k f ” : 0 } , ”

,→ w e a t h e r ” : [ { ” i d ” : 8 0 0 , ” main ” : ” C l e a r ” , ” d e s c r i p t i o n ” : ” c l e a r s k y ” , ” i c o n ” : ” 0 1 n ” } ] , ” c l o u d s ” : { ”

,→ a l l ” : 0 } , ” wind ” : { ” s p e e d ” : 3 . 3 1 , ” d e g ” : 8 5 . 0 0 4 5 } , ” s y s ” : { ” pod ” : ” n ” } , ” d t t x t ”:”2016 −03 −13

,→ 0 3 : 0 0 : 0 0 ” } , { ” d t ” : 1 4 5 7 8 4 8 8 0 0 , ” main ” : { ” temp ” : 2 8 3 . 9 4 , ” temp min ” : 2 8 3 . 9 4 , ” temp max

,→ ” : 2 8 3 . 9 4 4 , ” p r e s s u r e ” : 1 0 1 7 . 3 4 , ” s e a l e v e l ” : 1 0 3 3 . 8 , ” g r n d l e v e l ” : 1 0 1 7 . 3 4 , ” h u m i d i t y ” : 1 0 0 , ”

,→ t e m p k f ” : 0 } , ” w e a t h e r ” : [ { ” i d ” : 8 0 0 , ” main ” : ” C l e a r ” , ” d e s c r i p t i o n ” : ” c l e a r s k y ” , ” i c o n ” : ” 0 1 n

,→ ” } ] , ” c l o u d s ” : { ” a l l ” : 0 } , ” wind ” : { ” s p e e d ” : 3 . 8 6 , ” d e g ” : 6 5 . 5 0 3 7 } , ” s y s ” : { ” pod ” : ” n ” } , ” d t t x t

,→ ”:”2016 −03 −13 0 6 : 0 0 : 0 0 ” } , { ” d t ” : 1 4 5 7 8 5 9 6 0 0 , ” main ” : { ” temp ” : 2 8 5 . 6 7 , ” temp min ” : 2 8 5 . 6 7 , ”

,→ temp max ” : 2 8 5 . 6 7 1 , ” p r e s s u r e ” : 1 0 1 8 . 2 8 , ” s e a l e v e l ” : 1 0 3 4 . 6 2 , ” g r n d l e v e l ” : 1 0 1 8 . 2 8 , ” h u m i d i t y

,→ ” : 1 0 0 , ” t e m p k f ” : 0 } , ” w e a t h e r ” : [ { ” i d ” : 8 0 0 , ” main ” : ” C l e a r ” , ” d e s c r i p t i o n ” : ” c l e a r s k y ” , ” i c o n

,→ ” : ” 0 1 d ” } ] , ” c l o u d s ” : { ” a l l ” : 0 } , ” wind ” : { ” s p e e d ” : 4 . 0 6 , ” d e g ” : 6 3 . 5 0 5 3 } , ” s y s ” : { ” pod ” : ” d ” } , ”

,→ d t t x t ”:”2016 −03 −13 0 9 : 0 0 : 0 0 ” } , { ” d t ” : 1 4 5 7 8 7 0 4 0 0 , ” main ” : { ” temp ” : 2 8 7 . 1 5 , ” temp min

,→ ” : 2 8 7 . 1 5 , ” temp max ” : 2 8 7 . 1 5 1 , ” p r e s s u r e ” : 1 0 1 8 . 1 1 , ” s e a l e v e l ” : 1 0 3 4 . 2 3 , ” g r n d l e v e l

,→ ” : 1 0 1 8 . 1 1 , ” h u m i d i t y ” : 9 4 , ” t e m p k f ” : 0 } , ” w e a t h e r ” : [ { ” i d ” : 8 0 0 , ” main ” : ” C l e a r ” , ” d e s c r i p t i o n

,→ ” : ” c l e a r s k y ” , ” i c o n ” : ” 0 1 d ” } ] , ” c l o u d s ” : { ” a l l ” : 0 } , ” wind ” : { ” s p e e d ” : 2 . 6 2 , ” d e g ” : 1 2 0 . 5 1 5 } , ”

,→ s y s ” : { ” pod ” : ” d ” } , ” d t t x t ”:”2016 −03 −13 1 2 : 0 0 : 0 0 ” } , { ” d t ” : 1 4 5 7 8 8 1 2 0 0 , ” main ” : { ” temp

,→ ” : 2 8 6 . 9 7 , ” temp min ” : 2 8 6 . 9 6 7 , ” temp max ” : 2 8 6 . 9 7 , ” p r e s s u r e ” : 1 0 1 6 . 3 8 , ” s e a l e v e l ” : 1 0 3 2 . 3 3 , ”

,→ g r n d l e v e l ” : 1 0 1 6 . 3 8 , ” h u m i d i t y ” : 9 5 , ” t e m p k f ” : 0 } , ” w e a t h e r ” : [ { ” i d ” : 8 0 0 , ” main ” : ” C l e a r ” , ”

,→ d e s c r i p t i o n ” : ” c l e a r s k y ” , ” i c o n ” : ” 0 1 d ” } ] , ” c l o u d s ” : { ” a l l ” : 0 } , ” wind ” : { ” s p e e d ” : 2 . 4 1 , ” d e g

,→ ” : 1 4 9 . 0 0 1 } , ” s y s ” : { ” pod ” : ” d ” } , ” d t t x t ”:”2016 −03 −13 1 5 : 0 0 : 0 0 ” } , { ” d t ” : 1 4 5 7 8 9 2 0 0 0 , ” main ” : { ”

3.5. AVAILABLE METEOROLOGICAL DATA 65

,→ ” : 1 0 3 1 . 4 4 , ” g r n d l e v e l ” : 1 0 1 5 . 4 1 , ” h u m i d i t y ” : 1 0 0 , ” t e m p k f ” : 0 } , ” w e a t h e r ” : [ { ” i d ” : 8 0 0 , ” main

,→ ” : ” C l e a r ” , ” d e s c r i p t i o n ” : ” c l e a r s k y ” , ” i c o n ” : ” 0 1 d ” } ] , ” c l o u d s ” : { ” a l l ” : 0 } , ” wind ” : { ” s p e e d

,→ ” : 1 . 0 6 , ” d e g ” : 1 5 7 } , ” s y s ” : { ” pod ” : ” d ” } , ” d t t x t ”:”2016 −03 −13 1 8 : 0 0 : 0 0 ” } , { ” d t ” : 1 4 5 7 9 0 2 8 0 0 , ”

,→ main ” : { ” temp ” : 2 8 4 . 5 7 , ” temp min ” : 2 8 4 . 5 7 , ” temp max ” : 2 8 4 . 5 7 2 , ” p r e s s u r e ” : 1 0 1 5 . 6 4 , ” s e a l e v e l

,→ ” : 1 0 3 1 . 9 , ” g r n d l e v e l ” : 1 0 1 5 . 6 4 , ” h u m i d i t y ” : 1 0 0 , ” t e m p k f ” : 0 } , ” w e a t h e r ” : [ { ” i d ” : 8 0 0 , ” main ” : ”

,→ C l e a r ” , ” d e s c r i p t i o n ” : ” c l e a r s k y ” , ” i c o n ” : ” 0 1 n ” } ] , ” c l o u d s ” : { ” a l l ” : 0 } , ” wind ” : { ” s p e e d

,→ ” : 0 . 9 2 , ” d e g ” : 1 4 6 . 0 0 4 } , ” s y s ” : { ” pod ” : ” n ” } , ” d t t x t ”:”2016 −03 −13 2 1 : 0 0 : 0 0 ” } , { ” d t

,→ ” : 1 4 5 7 9 1 3 6 0 0 , ” main ” : { ” temp ” : 2 8 4 . 0 2 , ” temp min ” : 2 8 4 . 0 2 , ” temp max ” : 2 8 4 . 0 2 1 , ” p r e s s u r e

,→ ” : 1 0 1 5 . 4 6 , ” s e a l e v e l ” : 1 0 3 1 . 7 4 , ” g r n d l e v e l ” : 1 0 1 5 . 4 6 , ” h u m i d i t y ” : 1 0 0 , ” t e m p k f ” : 0 } , \ v d o t s ” w e a t h e r ” : [ { ” i d ” : 8 0 1 , ” main ” : ” C l o u d s ” , ” d e s c r i p t i o n ” : ” f e w c l o u d s ” , ” i c o n ” : ” 0 2 n ” } ] , ” c l o u d s ” : { ” a l l ,→ ” : 2 4 } , ” wind ” : { ” s p e e d ” : 4 . 7 1 , ” d e g ” : 9 1 . 0 0 1 7 } , ” s y s ” : { ” pod ” : ” n ” } , ” d t t x t ”:”2016 −03 −18 ,→ 0 0 : 0 0 : 0 0 ” } ] } OpenWeatherMap database

A simple dababase is used to store OpenWeatherMap’s current and forecasted values. An application has been developed to automatically read data from web site and and store it into the database.