13 TO 16 MAY 2002







Uses of SVG (Scalar Vector Graphics) in Meteorology.

(Submitted by Gil Ross, Chris Little)


The WMO Guide to WWW Data Management WMO 788 (which the ET has been asked to review for updating) has Chapter 6 entitled, "The Use of Computer Graphics for Meteorological Data Representation". This is of course considerably out of date, and amongst others, the formats it describes are GKS (Graphical Kernel System - a geometric model for processing and presenting 2D image data) and CGM (Computer Graphics Metafile a 2D vector graphics format). While these still exist and are still used extensively in meteorological data processing, they have declining industry support in the world at large.

Other formats such as GIF, PNG, JPEG, along with many others, supported by a range of graphical editors or graphics display programs. However, in order to convert meteorological data into these graphical display formats, individual programs have to be written to do this. There are indeed a number of open source meteorological graphics packages (CDAT, GrADS are good academic sourced software, widely used in meteorology), these still require installation and management on local machines and no small amount of set-up to convert meteorological data into a chosen display format which can then be passed on to user to view through their chosen viewer. If the format is a standard image format, then the web browser is a good choice of viewer.

SVG (see is a graphical representation in XML Quoting from the W3C overview:

"SVG is a language for describing two-dimensional graphics in XML. SVG allows for three types of graphic objects: vector graphic shapes (e.g., paths consisting of straight lines and curves), images and text. Graphical objects can be grouped, styled, transformed and composited into previously rendered objects. Text can be in any XML namespace suitable to the application, which enhances search-ability and accessibility of the SVG graphics. The feature set includes nested transformations, clipping paths, alpha masks, filter effects, template objects and extensibility".

This seems to be taking off as a graphical format and it seems likely that many browsers will be able to use plug-ins to process and display SVG data directly (see for a list of current viewers and editors). It also seems likely that some browsers (Internet Explorer as a prime example) will have SVG processing capability built-in, rather than as a plug-in. This will soon mean that the normal browser on any desktop will be able to accept SVG without any special installation.

SVG has added benefits as an image definition format.

The file ASXX4.svg is an SVG file of the synoptic analysis at 0600 12th August 1997 disseminated as a fax chart from Bracknell. This was handcrafted from a CGM, and this process took two hours to learn and complete. The component lines and displays in the CGM do not have identification and have had tags added to them. (The tags were invented arbitrarily here. This would be codified in practice see Appendix A for a cut-down version in XML.).

The file SIGWX22.svg is another trial svg file of the Significant Weather display for 00Z on the 10th January 2002. This was created from a perl script which took 8 hours to write. The same script has been used successfully to transform radically different CGMs to SVG (e.g. output from the NCAR Graphics Package, or the Met Office logo). (There are errors in this file, although it looks to be errors taken from the original CGM file, because to the right of the svg chart (zoom out to see) there is a ghost ITCZ line and two jets going into Asia are displayed. However formal SVG "clipping" could remove these ghosts.). Actually these example would not be acceptable operationally because the all the style and colours (and some sizes) are pre-set. In practice these would be defined in either a cascading stylesheet (CSS) or in an XSLT template.

It is possible that an observation chart with a geographical spread could have as component SVG files: the fixed coastline, the fixed latitude longitude lines, and all SYNOP observations as individual station circles. These could be composited into different chart displays using simple scripts. Notice how the title and context boxes in SIGWX22.svg are not transparent, but block out graphical displays layered below.

The O'Reilly book on SVG SVG Essentials (an excellent book by J. David Eisenberg: First Edition February 2002 ISBN 0-596-00223-8,) has a simple meteorological example in chapter 12 (the examples here are available from the O'Reilly website). This uses an example from the US Navy Meteorological XML markup language OMF ( (fragment appendix B) (As an aside, Eisenberg berates the OMF design for XML bad practice in using attributes rather than content!). Eisenberg creates a sequence of XSLT files ending in the xslt template fig_1206.xslt to create an svg file fig_1206.svg. This transforms an XML data file (the OMF data) via an XML transform file (the xslt file - svg template) to an XML image file (the svg file). This can run on any XSLT processor, converting meteorological data expressed as XML into a meteorological product.

The interoperability and re-usability of XML is exemplified in this template approach. Converting meteorological data into XML files makes the meteorological data enormously flexible.

Preparatory work to develop metadata and vocabularies for meteorological data by the Expert Team on Integrated Data Management and others working groups is essential to bring this about.



Appendix A

The ASXX4 SVG in XML, truncated to fit (about 40 pages in full)

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "">

<svg xmlns="" xmlns:xlink="" width="960px" height="660px" viewBox="0 0 1 0.686439">

<g transform="translate(0, 0.686439)">

<g id="coastline" fill="none" stroke-width="0.000017" stroke="black">

<polyline points="0.566236,-0.128415 0.567984,-0.123433 0.566692,-0.116779 0.569277,-0.109124 0.574414,-0.105721 0.579050.......

many lines of coastline data


<polyline points="0.361682,-0.673740 0.360725,-0.673178 0.360937,-0.672813"/>


<g id="map-graticule">

<g id="longitude-lines" fill="none" stroke-width="0.000017" stroke="red">

<polyline points="0.003815......

many lines of latitude/longitude line data



<g id="longitude-labels" font-size="0.01">

<text x="0.080152" y="-0.671476">100</text>

many lines of latitude/longitude label data

<text x="0.258774" y="-0.057113">40</text>


<g id="High-Low-centre-values" font-size="0.01" fill="none" stroke-width="0.000017" stroke="blue">

<polyline points="0.999985,-0.686439 0.999985,-0.014018 0.003815,-0.014018 0.003815,-0.686439 0.999985,-0.686439"/>

<desc>charori -0.007703,-0.006440,-0.006453,-0.007693 </desc>

<text fill="red" x="0.863742" y="-0.639304">Low</text>

many lines of MSLP centre label data


<g id="Contours-with-labels" font-size="0.01" fill="none" stroke-width="0.000017" stroke="red">

<polyline points="0.250809,-0.686439 0.246127,-0.682915 0.241309,-0.679725 0.239394,-0.678175 0.232660,-0.674028 0.230623,-0.672996 0.225926,-0.668408 0.224330,-0.666266 0.219192,-

many pages of contours and labels

<text fill="blue" x="0.216882" y="-0.477879">1</text>


<g id="Geostrophic-Wind-Scale" font-size="0.01" stroke-width="0.000017">

<desc>textalign normhoriz,normvert,-0.000000,-0.000000 </desc>

<desc>cliprect 0.799085,-0.110500 0.999402,-0.216771 </desc>

<desc>charori 0.000000,-0.010000,-0.010000,-0.000000 </desc>

<polygon fill="white" points="0.799085,-0.110500 0.999402,-0.110500 0.999402,-0.216771 0.799085,-0.216771"/>

many lines of side box scale data


<g id="Title" fill="white" font-size="0.01" stroke-width="0.000017" stroke="red">

<polygon points="0.005501,-0.652104 0.429642,-0.652104 0.429642,-0.685323 0.005501,-0.685323"/>

<desc>textalign normhoriz,normvert,-0.000000,-0.000000 </desc>

<desc>cliprect 0.005501,-0.652104 0.429636,-0.685323 </desc>

<desc>charori 0.000000,-0.011071,-0.011071,-0.000000 </desc>

<desc>charexpan 0.799988 </desc>

<text fill="blue" x="0.009216" y="-0.659483">ASXX EGRR MSLP Analysis DT 0600 UTC 12 Aug 1997</text>

<polyline fill="none" points="0.006239,-0.652470 0.428891,-0.652470 0.428891,-0.684957 0.006239,-0.684957 0.006239,-0.652470"/>

The full chart title dada



end of svg file



Appendix B

OMF Fragment used in Chapter 12 of SVG Essentials (O'Reilly)

<Reports TStamp="997568716">

<SYN Title='AAXX' TStamp='997573600' LatLon='37.567, 126.967' BId='471080'

SName='RKSL, SEOUL' Elev='86'>


<SYG T='22.5' TD='14.1' P='1004.1' P0='1014.1' Pd='0 0.1' Vis='22000'

Ceiling='INF' Wind='30-70, 1.5' WX='NOSIG' Prec=' ' Clouds='44070'>

32972 40703 10225 20141 30041 40141 50001 84070