Air pollution in China could be big business.
Bouts of acrid smog enveloping Beijing prompted authorities in the Chinese capital to declare two unprecedented "red alerts" this month - a warning to the city's 22 million inhabitants that heavy pollution is expected for more than three days.
Such alerts rely on advances in pollution forecasting, increasingly important for Communist Party leaders as they seek improvements in monitoring and managing the country's notorious smog in response to growing public awareness.
Official interest has also been boosted by China's preparations to host the Winter Olympics - Beijing's smog is worse in the colder months - in 2022.
"There is increasing attention to the air quality forecast service," said Yu Zheng, a researcher at Microsoft. "More and more people care about this information technology."
A rudimentary forecast was pioneered by Dustin Grzesik, a U.S. geochemist and former Beijing resident who created Banshirne.com, a free website and smartphone app, in 2013 to predict clean air days using publicly available weather data on wind patterns.
"If you can predict the weather, it only takes a few more variables to predict air quality," said Robert Rohde of Berkeley Earth, a U.S.-based non-profit that maps China's real-time air pollution. "Most of the time pollutant emissions don't vary very rapidly."
Now, advances in "cognitive computing" - machines programed to improve modeling on their own - allow more sophisticated forecasting software to provide predictions for the air quality index up to 10 days in advance using data on weather, traffic and land use, as well as real-time pollution levels from government monitoring stations and even social media posts.
Business of smog
Both Microsoft and IBM secured their first government clients last year after developing their respective pollution forecasting technologies at their China-based research labs.
Chinese authorities only began releasing real-time levels of PM2.5 - airborne particulate matter under 2.5 microns in diameter that can penetrate deep into the lungs - in 2012, after denouncing the U.S. embassy for publishing its own real-time monitoring data on Twitter.
IBM's first client was the city of Beijing's environmental protection bureau, which bases its color-coded pollution alerts on the technology.
The company launched a "Joint Environmental Innovation Center" - staffed by government and IBM scientists - with the bureau earlier in December, allowing officials to better model pollution reduction scenarios during the worst episodes.
Still the municipal government only makes public a 24-hour forecast on its website, meaning residents aren't able to see for themselves when a "red alert" may be due.
The environmental bureau's monitoring center did not respond to a request for comment.
IBM has also signed a deal with Zhangjiakou, which will jointly host the 2022 Winter Olympics alongside Beijing, to do forward planning and scenario modeling ahead of the games.
For its part, Microsoft has signed up China's environment ministry, and the environmental protection bureaus in Fujian province and Chengdu, the capital of the southwestern province of Sichuan.
Outside China, IBM has also signed deals for air quality modeling with Delhi, one of the world's most polluted cities, and Johannesburg.
"We should be able to use the same base system and do air quality forecasting in different parts of the world," said Brad Gammons, the business leader behind the IBM initiative, which the company calls 'Green Horizons'.
"With the machine-based learning we can do it very quickly."
The two tech rivals aren't just competing over government clients. Business clients - in particular renewable power generation companies - are another target, along with consumers. Already more than 30 solar farms in China are using IBM's forecasting technology, which can also help predict the availability of sunlight.
Microsoft has created a website called Urban Air and a smartphone app with a 48-hour forecast, while the China Open tennis tournament put IBM pollution forecasts for parks across Beijing on its public WeChat social messaging account.
But there are still kinks to work out.
The latest version of Microsoft's iPhone app lacked the forecasting function advertised, which the company blamed on a bug, while during a recent "red alert," when the air was considered hazardous and schools were shut, the China Open IBM-based forecast recommended "light exercise".