1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
|
METAR DECODER SOFTWARE PACKAGE (MDSP)
Update History:
NEW
29 June 1998 (Posting of METAR Decoder,
Upgrade,Version 1.8)
15 July 1996 (Posting of METAR Decoder,
Upgrade,Version 1.7)
1) METAR date/time groups that are not
postfixed with 'Z' will be
recognized and decoded along with
date/time groups that are correctly
encoded.
2) Station identifiers that include a
mix of alphanumeric characters
following the first alpha character
will be accepted as a valid station
ID.
3) Incorrectly coded prevailing
visibility groups (e.g. 1/SM) will
be ignored as spurious or
extraneous groups.
4) Indeterminant 3/6-HR precipitation
groups (i.e. 6////) are flagged
using a boolean variable. The
boolean variable is TRUE, if 6////
appears in the observation
or FALSE, if 6//// does not appear
in the observation.
5) The keyword 'COR', a positionally
dependent METAR group, will be
recognized and decoded whether it
appears before or after the
date/time group.
6) Spurious or extraneous groups that
occur within the body of a METAR
observation will be skipped without
compromising the positional
integrity of groups that may
follow.
7) Code has been added to the
DCDMETAR.C and DCDMTRMK.C files
to protect against attempts at
using NULL pointers in string
functions.
26 June 1996 (Posting of METAR Decoder,
Upgrade,Version 1.6)
21 May 1996 (Posting of METAR Decoder,
Upgrade,Version 1.5)
15 May 1996 (Posting of METAR Decoder,
Upgrade,Version 1.4)
07 May 1996 (Posting of METAR Decoder,
Upgrade,Version 1.3)
26 February 1996 (Posting of METAR Decoder,
Upgrade,Version 1.2)
20 December 1995 (Posting of METAR Decoder,
Upgrade,Version 1.1)
11 June 1995 (Posting of METAR Decoder,
Version 1.0)
General Information:
--------------------
The Systems Operations Center (SOC) of the National Weather
Service (NWS) has developed a "C" language software package
to decode WMO FM 15-IX Ext. (METAR) and FM 16-IX Ext. (SPECI)
formatted reports. The format specifications for these report
types are described in the Federal Meteorological Handbook Number
1 (FMH-1), Surface Weather Observations and Reports (December
1995).
A METAR report may consist of two parts -
1) the main body of the report consists of observational
data that meets aviation requirements (e.g. wind speed
and direction, sky condition, temperature and dew
point temperature, etc.)
2) the remarks section may consist of one or more sections
(i.e. Automated and Manual, Plain Language (Manual
Only), and Additive Data and Automated Maintenance)
The MDSP is specifically designed to meet SOC operational
requirements. Nevertheless, it is a comprehensive decoder. As a
result, SOC management decided to make the MDSP available to any
interested party via the Internet. However, as the SOC makes this
software available, it neither implies or guarantees the accuracy
or dependability of the MDSP.
The MDSP makes no attempt to decode any METAR/SPECI group
that does not conform to the METAR/SPECI format outlined in FMH-1
(METAR).
How Do You Use It?:
-------------------
The METAR Decoder (DCDMETAR) is a "C" language routine that
takes two arguments. The 1st argument is a pointer to a METAR
report character string. The 2nd argument is a pointer to a
Decoded_METAR data type (defined in METAR.H). DCDMETAR returns
12, if it encounters an invalid station ID (i.e. a station that
does not contains 4 characters statino ID and/or whose first
character is not alpha). Otherwise, it returns 0.
All decoded groups/elements are assigned to members of the
structure whose address is that of the 2nd input argument. If
the decoder encounters a multiple instance of the same
group/element in the Remarks section of the Decoder, then that
group/element is not decoded.
The input METAR report must be a character string that is
terminated by a sentinel (i.e. '\0'). The report string should
also be free of any communication transmission characters (e.g.
carriage returns, linefeeds, etc.). Each group in the report
must be separated by at least one blank character.
The decoded groups/elements of the METAR report are
evaluated as one of 4 basic data types - int, bool, char, or
float. All decoded METAR structure members are initialized prior
to decoding each input METAR report. All int variables are set
to MAXINT ( defined in LOCAL.H). All bool variables are set to
FALSE (i.e. 0). All char and char strings are set to '\0'(s).
All float variables are set to (float) MAXINT.
METAR decoded structure members retain their initialization
values, if no groups/elements were decoded from the METAR report
and assigned to those members.
The METAR Decoder has the following function prototype:
int DcdMETAR( char *observation, Decoded_METAR *Mptr ),
The following program segment illustrates how the DcdMETAR
function might be invoked:
#include <metar h>
main()
{
/***************************/
/* DECLARE LOCAL VARIABLES */
/***************************/
Decoded_METAR MetarStruct,
*Mptr = &MetarStruct;
char *observation;
.
.
.
if ( (observation = getMETAR( selectionParms ))
!= NULL ) {
if( DcdMETAR( observation, Mptr) != 0 )
printf("Error Msg\m");
else {
'Process decoded METAR
groups/elements'
}
}
.
.
.
Within the routine that calls DcdMETAR, a variable must be
declared as a Decoded_METAR type. The address of that
Decoded_METAR variable and a pointer to a METAR report string are
then passed to the DcdMETAR routine. The function getMETAR is
for illustrative purposes only and simply represents a generic routine that the user must furnish in
order to supply METAR reports to the DcdMETAR routine.
All of the files listed below have been packaged as a single
self-extracting file called DCDMETAR.EXE. An ASCII version of
these files is also available in the file DCDMETAR.SRC. Each of
the header files and functions in DCDMETAR.SRC are separated by
the delimiter @@ and the name of the file (e.g. @@DRVMETAR.C
would be followed by the DRVMETAR.C source code.
1) DRVMETAR.C 6) STSPACK2.C 11) LOCAL.H
2) DCDMETAR.C 7) STSPACK3.C
3) DCDMTRMK.C 8) ANTOI.C
4) PRTDMETR.C 9) CHARCMP.C
5) FRACPART.C 10) METAR.H
What's Included?:
-----------------
The files that make up the MDSP are described below. These
files have been packaged as a single self-extracting file called
DCDMETAR.EXE. If your system can not expand this file, then
you will have to manually extract the individual source and
header files from the file called DCDMETAR.SRC. Each source or
header file within DCDMETAR.SRC is delimited by the 2 characters
"@@" followed by the name of the file (e.g. @@DRVMETAR.C or
@@METAR.H).
1) DRVMETAR.C - A main program that acts as a driver for
the MDSP. In its current configuration, DRVMETAR
uses an array of pointers to METAR report character
strings for input to the METAR Decoder. The user may
elect to continue with this configuration and provide
his or her own METAR reports for testing or instead read
individual METAR reports in from a file or some other
database. The METAR report strings that are in DRVMETAR
are not meant to be reports that reflect physical
reality, but rather reports that were designed to
exercise various parts of the MDSP.
2) DCDMETAR.C - A function that decodes the main body of
the METAR report. The decoded groups/elements of the
METAR report are stored in a structure of the type
Decoded_METAR.
3) DCDMTRMK.C - A function that decodes the remarks section
of the METAR report. The decoded groups/elements of the
METAR report are also stored in a struture of the type
Decoded_METAR.
4) PRTDMETR.C - A function that prints the decoded METAR
report groups/elements.
5) FRACPART.C - A function that converts a character string
fraction (e.g. "1/4", "1/8", etc.) into a floating point
number.
6) STSPACK2.C - A collection of routines written at the
SOC to perform string evaluations that expand upon the
standard C string functions.
6) STSPACK3.C - A collection of routines written at the
SOC to perform string evaluations that expand upon the
standard C string functions.
7) ANTOI.C - A routine developed at the SOC to convert
variable length numeric character strings into integers.
8) CHARCMP.C - A routine developed at the SOC to recognize
character patterns. If a given string pattern is found
in a given character string, CHARCMP returns TRUE.
Otherwise, it returns FALSE.
9) METAR.H - An MDSP header file. This header file
contains the definition of the decoded METAR structure
members.
10) LOCAL.H - A "general purpose" header file developed
at the SOC. LOCAL.H is referenced in METAR.H. LOCAL.H
includes a number of locally defined variables that are
used in the MDSP.
Printing The METAR Report and/or Decoded METAR Report:
------------------------------------------------------
The routine PRTDMETR may be used to print the decoded
METAR report. PRTDMETR prints the decoded groups/elements in the
order in which they would appear according to the format
described in FMH-1 (METAR). The DRVMETAR module contains a print
statement to print the input METAR report and it also calls the
PRTDMETR routine that prints the decoded METAR data.
MDSP Updates:
-------------
All updates to the MDSP are based upon:
1) meeting all METAR decoding specifications by July
1, 1996
2) responding to decoding problems or errors
that have been demonstrated to exist in the
MDSP
Areas of on-going MDSP refinement and documentation:
1) internal/external documentation
Inquires:
---------
Questions, comments, or problems regarding the MDSP,
should be directed to Carl McCalla at -
NOAA/National Weather Service
1325 East-West Highway
SSMC2, W/OSO242, Station 5114
Silver Spring, Maryland 20910
Work: (301) 713-0882, Ext 115
FAX: (301) 608-0911
E-Mail Address: Carl.Mccalla@noaa.gov
|