Developers
DEVELOPER INFORMATION

Reading Weather Condition Codes

You may have noticed that some weather stations report a weather condition code. For legacy reasons we refer to this variable as WNUM or “weather number.” The WNUM is an integer value that with a bit of arithmetic can be converted into a meaningful weather code.

When a station reports a weather_condition_code_N Mesonet API decodes these values into their correct string forms as weather_condition_value_Nd. Note that this variable is often only reported when there is weather to report.

Many automated stations can report up to three “present weather” types (e.g. one could report light snow, blowing snow, and freezing fog all at the same time) and those represent A, B, and C in the formula given. The formula as shown is:

WNUM = A × 80 × 80 + B × 80 + C

If the coded value is < 80, only one condition is being reported, and it is pretty straightforward to figure out the condition using the listing given below.

If the coded value is between 80 and 80 × 80, two conditions are reported, and through a little bit of algebra, it is possible to determine the two codes B and C which both will have numbers between 0-79.

If the coded value is >= 80 × 80, three conditions are reported (A, B, and C). So, using the example above (light snow, blowing snow, and freezing fog) those would correspond to values of A=20, B=32, C=30, therefore:

WNUM = 20 × 80 × 80 + 32 × 80 + 30 = 128000 + 2560 + 30 = 130590

The following are the logic steps involved to unravel the values working backwards:

  1. Begin with the value of 130590
  2. Find A: floor(130590/6400) = 20
  3. Subtract 130590 - (6400*20) to get the remainder: 130590 - (6400*20) = 2590
  4. Find B: floor(2590/80) = 32
  5. C will then be 2590 - (80*32), so 2590 - (80*32) = 30

WNUM Values

The following table outlines the code values which can fill in for A, B or C in the examples above.

Code Description
0 (no value)
1 R (mod rain)
2 L (mod drizzle)
3 S (mod snow)
4 A (mod hail)
5 T (thunder)
6 H (haze)
7 K (smoke)
8 D (dust)
9 F (fog)
10 Q (squalls)
11 V volcanic ash)
12  
13 R- (lt rain)
14 R+ (hvy rain)
15 ZR (mod frz rain)
16 RW (mod rain shwr)
17 L- (lt drizzle)
18 L+ (hvy drizzle)
19 ZL (frz drizzle)
20 S- (lt snow)
21 S+ (hvy snow)
22 SW (mod snow shwr)
23 IP (mod ice pellet)
24 SG (mod snow grain)
25 SP (mod snow pellet)
26 A- (lt hail)
27 A+ (hvy hail)
28 T- (lt thunder)
29 T+ (hvy thunder)
30 IF (ice fog)
31 GF (ground fog)
32 BS (blowing snow)
33 BD (blowing dust)
34 BY (blowing spray)
35 BN (blowing sand)
36 IC (mod ice crystals)
37 IN (ice needles)
38 AP (small hail)
39 KH (smoke, haze)
40 PO (dust whirls)
41 UP (unknown prcp)
42  
43  
44  
45  
46  
47  
48  
49 ZR- (lt frz rain)
50 ZR+ (hvy frz rain)
51 RW- (lt rain shwr)
52 RW+ (hvy rain shwr)
53 ZL- (lt freezing drizzle)
54 ZL+ (hvy freezing drizzle)
55 SW- (lt snow shwr)
56 SW+ (hvy snow shwr)
57 IP- (lt ice pellets)
58 IP+ (hvy ice pellets)
59 SG- (lt snow grains)
60 SG+ (hvy snow grains)
61 SP- (lt snow pellets)
62 SP+ (hvy snow pellets)
63 IPW (mod ice pellet shwr)
64 IC- (lt ice crystals)
65 IC+ (hvy ice crystals)
66 TRW (mod thunder shwr)
67 SPW (snow pellet shwr)
68 BD+ (hvy blowing dust)
69 BN+ (hvy blowing sand)
70 BS+ (hvy blowing snow)
71  
72  
73  
74  
75 IPW- (lt ice pellet shwr)
76 IPW+ (hvy ice pellet shwr)
77 TRW- (lt rain thunder shwr)
78 TRW+ (hvy rain thunder shwr)
79  

And there are 3 Manual character codes which will only be sent on their own

Code Description
-1 Tornado
-2 Funnel Cloud
-3 Water Spout

For more information on the origin and interpretation of Weather Condition Codes, please review the Gempak Parameter guides.