The weather is a national obsession, and never more so than during a time of extremes. A summer heatwave may be a dream come true for sun worshippers, but the sweltering heat can cause or exacerbate health problems and leave commuters gasping for air.

With a Samsung GALAXY S4 in your pocket you can always take the weather with you – or at least an array of apps and widgets to keep you well informed about the current state of the climate. They'll also help predict whether you need to slather on factor 50 sunblock or pack a brolly for the inevitable downpour.

How weather apps work

"To forecast the weather you are trying to predict an inherently chaotic system," explains Charles Ewen of the UK's Met Office.

"About half the work that anyone does to forecast the weather is in capturing and understanding the current state of the atmosphere. That has to be done on a global scale – you can't forecast in the UK for any length of time without some knowledge of what is going on in the rest of the world."

The Met Office is one of the primary sources for the weather data used by smartphone apps. It is a key part of a global network of meteorological agencies, coordinated by a United Nations group called the World Meteorological Organisation (WMO).

"The Met Office is a world leader in this and there are about ten or so modelling centres of similar capability around the world," says Ewen. "We also need knowledge of how the atmosphere works, and that comes down to science. That's physics, and especially maths – for example fluid dynamics, as the atmosphere is, to all intents and purposes a fluid.

"Another thing the Met Office does is run a very active and collaborative science program, to some extent with the WMO but largely with academia, to better understand the state of the atmosphere."

Open APIs and crowdsourced weather apps

This kind of academic data is usually publicly available – the Met Office has an open application programming interface, or API, called DataPoint, which is a sort of interface for apps and web services to grab the latest data and predictions from the Met Office's climate models.

The same data is therefore used by both the official Met Office app and many others, such as the BBC Weather app. The difference comes down to presentation and the kind of information each app chooses to give to the user.

Several other commercial apps use their own privately gathered and analysed data. One fast-growing area is so-called crowdsourced data. Until recently, this relied on a combination of observations and weather data from enthusiasts' personal weather stations. A new wave of smartphone apps has arisen, however, that uses actual sensors built into phones to gather hard data and collate it for analysis.

The Samsung GALAXY S4 is particularly well suited for this, which is why it has been singled out as the ideal platform for a new app called WeatherSignal.

Samuel Johnson, of WeatherSignal's parent company OpenSignal, explains: "The GALAXY S4 is perfect for our purposes simply because of the sheer number of sensors it contains. It's the first major feature phone to contain both a hygrometer and a thermometer (making it perfect for taking weather readings). We can take readings from the GALAXY S4 that we can't take from any other smartphone, helping to make our live weather map even more complete."

WeatherSignal currently has around 30,000 active users. "The feedback from users has been fantastic," says Johnson. "Everyone seems to have really got on board with the idea that we're trying to do something that's never been done like this before – a properly localised crowdsourced weather map.