It’s nearly 7pm on a Friday night, and you’re blobbing out in front of the TV waiting for Jim Hickey to tell you what the weather is going to be like for the weekend. As he does so beautiful 3D graphics fill the screen as a camera flies over the country, showing a terrain map with accurate texturing, animated clouds and rain, and city names with temperatures.
The software that produces these graphics is called Weatherscape, and it was written in the mid-90s by a team of five developers from the Met Service and TVNZ. The software is being used by various broadcasters internationally, including Channel 9 in Australia and CNBC in Singapore, and has been on the market since 1996.
The software produces broadcast-quality animated 3D graphics in real-time, and outputs them via serial digital interface (SDI) to broadcast equipment. The clouds are entered into the system by hand. But change is forecast.
For the past year a team at the Met Service in Wellington has been writing the next generation of the software, called Weatherscape XT (the XT stands for extreme). It has been developed by a small team using a derivative of extreme programming, and went live for the first time on July 28 at CNBC in Dubai, in the United Arab Emirates.
Working in pairs and writing in C++, the developers have redeveloped the system from the ground up. The new application is based largely on game technology, uses Open-GL, and can render its images in real-time on a standard PC using a standard GeForce 4 video card (with lots of RAM). This configuration allows the developers (and customers) to move away from the expensive SGI machines required for the original system.
Development team coach Henry Maddocks, who freely admits to being viewed as “a pain in the arse” by his charges, says the work is maths-intensive. The system relies on “bucket loads” of numerical manipulation, Maddocks says, requiring the programmers to have a strong mathematical background. Some equations are so complex they defy proper description.
Test-driven development has been seen as a big benefit to the project. Maddocks believes that there aren’t as many unit-tests as there should be, but at 300-plus, he’s not unhappy with the results. CppUnit is used for unit-testing, but Maddocks believe that a move to CppUnit-Lite may be a better solution. However, as it would require rewriting all of the tests, it is unlikely that that move will happen.
Although XP mandates automated acceptance testing, that isn’t being done. Maddocks says problems like detecting the location of a cloud in real-time on every frame of an animation have not yet been resolved to his satisfaction.
The XP process seems to be providing real benefit across the team, and the Met Service uses it on other projects too. The team is loosely following all of the XP practices, except user-testing.
The developers have spent time studying the way games and gaming engines are written applying that knowledge to the new system. However, unlike games programmers, the team is focused on maintaining a constant frame-rate. Maddocks says that the sort of frame-rate variation that’s acceptable in Unreal Tournament would be unusable in their system.
Basic terrain information for the system comes from a model with 50m resolution, overlaid with texture data at 1km resolution. Virtual cameras can be placed anywhere on the globe, or even out in space looking down, and a flight path can be planned. The system will generate a smooth animation of the camera’s viewpoint as it flies down that path.
Weather data comes from Bracknell in the UK and Washington in the US. The data contains information about various layers of the atmosphere, but Weatherscape is mostly interested in that at mean sea level, which has a resolution of 120km. For detailed presentations this isn’t nearly enough, so it also has access to mezzo-scale data with a 20km resolution. During the America’s Cup data was imported for the Hauraki Gulf with a resolution of 1.6km.
The system operates on this data directly, without any pre-processing. Unlike the original system, Weatherscape XT can plan presentations independent of the data. In the old system each presentation was custom-created for each dataset. The new system allows a presentation to be devised and run against updated datasets.
To support that, and to allow a richer GUI, the developers chose to implement an MVC pattern throughout the system.
The system has been developed primarily in Linux (Mandrake, and Red Hat) and on Mac OS X. The developers prefer simple tools to complicated IDEs and therefore use simple editors for their source code, CVS as a repository and a few custom command line tools for building.
When comparing his work with that done at Weta Digital — both organisations produce 3D computer graphics — Maddocks says “[Weta] can spend as long as it wants rendering its frames; we have to have ours done in 20mins”.