Weather Wizard
- Type
- Education
- Category
- Weather forecasting program (with optional sensor hardware)
- Author
- Richard Staerzl (program); article by Charles Jackson
- Published in
- Antic, June 1986 (Vol. 5, No. 2)
- Year
- 1986
- Language
- Atari BASIC
- Requirements
- Any Atari 8-bit, Atari BASIC; optional printer; optional thermistor and humidity sensor wired to paddle port 1
- Tags
- antic, weather, forecasting, science, education, graphics-7, paddles, sensors, printer, richard-staerzl, 1986
About the program
"Are you sick of your local TV weatherman's silly hats and awful jokes?" Weather Wizard turns the Atari into a home forecaster. Give it the barometric pressure now and a few hours ago, the wind direction and the state of the sky, and it draws a forecast. Richard Staerzl of Fond du Lac, Wisconsin, wrote the program, and Charles Jackson wrote the article. If you don't own a barometer, the article said, take the readings from the newspaper or a weather broadcast.
Typing it in
Only a few strings contain inverse-video words ({inv}…{/inv}: press the Atari key before and after), such as the heading in line 550 and START in line 576. Lines 16–17 set constants for the optional sensors and should be typed as shown. The magazine printed TYPO II codes.
How to use it
Answer the questions on the big-text screens:
- The previous barometer reading and the present one, in inches of mercury (28–31). Anything else gets a buzz and BAD DATA.
- The hours between the two readings (0.5 for half an hour, and not zero).
- The wind direction, given as where the wind comes from: N, NE, E, SE, S, SW, W or NW. "If the wind blows your hat off, and the hat sails east, it's a west wind."
- The sky: C(lear), P(artly cloudy), M(ostly cloudy), O(vercast) or R(ain).
The forecast screen shows a thermometer (blue for a cooling trend, red for warming), a bar for the chance of precipitation and an icon: sun for fair weather, a cloud for rain or snow. Underneath is a written forecast. If a printer is connected and switched on, it prints a copy. Press START to run it again.
How it works
The article describes simple forecasting rules that are "fairly accurate for locations in the Northern hemisphere" (lines 230–430):
- The pressure trend
Ris the change per hour. Rising pressure lowers the chance of rain and falling pressure raises it. - The level of the pressure sets a base chance: the lower the barometer below 30.3 inches, the wetter.
- The sky adds to the chance, and current rain sets it to 100% with an estimate of when the rain will end.
- The wind sets the temperature trend: southerly winds bring warmer weather and northerly ones colder.
The optional weather station uses a thermistor (Fenwal GA45P2) on paddle 0 and a humidity sensor (Hygropak HA) on paddle 1. With SENSORS=1 (line 15), lines 571–572 convert PEEK(624) and PEEK(625) into temperature and humidity with straight-line formulas. The article explains how to work out your own constants for lines 16–17 from two known readings.
Listing
2 REM WEATHER WIZARD
4 REM BY RICHARD STAERZL
6 REM (c) 1986, ANTIC PUBLISHING
8 BRK=1:IF PEEK(53279)=5 THEN BRK=0
9 DIM W$(2),S$(1),F$(17),T$(6)
10 GRAPHICS 2:COLOR 4:SETCOLOR 4,9,4:POKE 752,1:GOSUB 910
15 SENSORS=0
16 MTEMP=-1.38461538:BTEMP=127.115384
17 MHUM=-0.438596491:BHUM=100.5
20 ? #6;" ":? #6;" ":? #6;" ":? #6;" ":? #6;" ":? #6;" WEATHER WIZARD"
31 ? " BY DICK STAERZL"
33 ? :? " (c) 1986, Antic Publishing":FOR X=1 TO 1000:NEXT X
40 GOSUB 900
50 ? #6:? #6;" LAST BAROMETER READ":GOSUB 3000
60 TRAP 4320:INPUT A:TRAP 40000:GOSUB 4300
70 GOSUB 900
80 ? #6:? #6;" PRESENT BAROMETER":GOSUB 3000
90 TRAP 4420:INPUT B:TRAP 40000:GOSUB 4400
100 GOSUB 900
110 ? #6:? #6;" TIME ELASPED :HOURS":GOSUB 3100
120 TRAP 4200:INPUT T:TRAP 40000:GOSUB 5000
130 GOSUB 900
140 ? #6;" WIND DIRECTION":? #6:GOSUB 3200
150 INPUT W$:GOSUB 4000
160 GOSUB 900
170 ? #6:? #6;" SKY CONDITION IS:":? #6:? #6:? #6:? #6
180 ? #6:? #6;" CLEAR ( C )"
190 ? #6:? #6;" PARTLY CLOUDY ( P )"
200 ? #6:? #6;" MOSTLY CLOUDY ( M )"
210 ? #6:? #6;" OVERCAST ( O )"
220 ? #6:? #6;" RAIN ( R )"
225 INPUT S$:GOSUB 4100
230 R=(B-A)/T*100:B=(30.3-B)*100
240 IF R>=-1.6 AND R<=1.6 THEN D=0
250 IF R>1.6 AND R<2.6 THEN D=-10
260 IF R>=2.6 THEN D=-20
270 IF R>-2.6 AND R<-1.6 THEN D=10
280 IF R<=-2.6 THEN D=20
290 IF B>90 THEN B=90
300 IF B<10 THEN B=10
310 C=B+D+S:IF C>90 THEN C=90:IF C<10 THEN C=10
320 IF C<10 THEN C=10
330 IF S=40 THEN C=100
340 IF C<50 THEN F$=" FAIR"
350 IF C>30 AND C<70 THEN F$=" UNSETTLED"
360 IF C>50 AND C<100 THEN F$=" RAIN"
370 IF C=100 AND D>0 THEN F$="RAIN ENDING 12 HR"
380 IF C=100 AND D<0 THEN F$="RAIN ENDING 6 HR"
390 IF C=100 AND D=0 THEN F$="RAIN ENDING 24 HR"
400 IF W>5 THEN T$="COLDER":T=9
410 IF W<2 THEN T$=" COLD":T=8
420 IF W>1 AND W<4 THEN T$="WARMER":T=4
430 IF W>3 AND W<6 THEN T$=" WARM":T=3
500 GRAPHICS 7:SETCOLOR 0,T,4:COLOR 1:SETCOLOR 1,0,4:COLOR 2:SETCOLOR 2,1,12:COLOR 3:GOSUB 910
510 GOSUB 3500
520 IF C<70 THEN GOSUB 3600
530 IF C>30 THEN GOSUB 3300
540 GOSUB 3850:POKE 752,1
550 ? "{inv} TEMP % PRECIP FORECAST {/inv}"
560 IF NOT (SENSORS) THEN ? " "
570 ? T$,C,F$
571 IF (SENSORS) THEN ? " TEMP=";INT(MTEMP*PEEK(624)+BTEMP),,
572 IF (SENSORS) THEN ? "HUM=";INT(MHUM*PEEK(625)+BHUM)
575 GOSUB 31000
576 ? "Press {inv} START {/inv} to run again.";
580 IF PEEK(53279)<>6 THEN 580
590 GOTO 10
900 GRAPHICS 1:SETCOLOR 4,8,0:COLOR 0:SETCOLOR 2,0,0:COLOR 3:POKE 752,1:GOSUB 910:RETURN
910 IF BRK THEN POKE 16,112:POKE 53774,112:POKE 77,0:POKE 702,64
920 RETURN
3000 ? #6:? #6:? #6;" *":? #6
3010 ? #6:? #6;" 29 30":? #6
3020 ? #6:? #6;" * ? *":? #6
3030 ? #6:? #6;" 28 31":? #6
3040 ? #6:? #6;" *"
3050 RETURN
3100 ? #6:? #6:? #6;" 1 2":? #6
3110 ? #6:? #6;" . .":? #6
3120 ? #6:? #6;" 9 ? 3":? #6
3130 ? #6:? #6;" . .":? #6
3140 ? #6:? #6;" 6"
3150 RETURN
3200 ? #6:? #6;" N":? #6
3210 ? #6:? #6;" * *":? #6
3220 ? #6:? #6;" W ? E":? #6
3230 ? #6:? #6;" * *":? #6
3240 ? #6:? #6;" S":RETURN
3300 REM .STORM CLOUD
3305 COLOR 2:REM GRAY
3310 R=12
3320 FOR X=-R TO R STEP 1
3330 Y=SQR(R*R-X*X)
3340 PLOT 115+X,15+Y:DRAWTO 115+X,15-Y
3350 PLOT 135+X,20+Y:DRAWTO 135+X,20-Y
3360 PLOT 127+X,13+Y:DRAWTO 127+X,13-Y
3370 NEXT X
3380 H=3:J=3:GOSUB 3440
3390 K=1:GOSUB 5100
3400 H=2:J=4:GOSUB 3440:FOR N=1 TO 100:NEXT N
3410 H=3:J=3:GOSUB 3440:GOSUB 5100:FOR N=1 TO 50:NEXT N
3420 K=K+1:IF K<3 THEN GOTO 3400
3430 RETURN
3440 COLOR H:PLOT 120,20:DRAWTO 117,26:COLOR J:DRAWTO 110,40:DRAWTO 115,35:DRAWTO 105,55
3450 DRAWTO 110,50:DRAWTO 100,70
3460 RETURN
3500 REM .THERMOMETER
3510 COLOR 1
3520 R=5
3530 FOR X=-R TO R STEP 1
3540 Y=SQR(R*R-X*X)
3550 PLOT 20+X,65+Y:DRAWTO 20+X,65-Y
3560 NEXT X
3570 PLOT 19,65:DRAWTO 19,30:PLOT 20,65:DRAWTO 20,29:PLOT 21,65:DRAWTO 21,30
3580 RETURN
3600 REM SUN
3610 COLOR 3
3620 R=10
3630 FOR X=-R TO R STEP 1
3640 Y=SQR(R*R-X*X)
3650 PLOT 100+X,20+Y:DRAWTO 100+X,20-Y
3660 NEXT X
3670 A=0:H=1:I=4:J=4:L=4
3680 COLOR 3:PLOT 87,20:DRAWTO 86-A,20:PLOT 112,20:DRAWTO 114+A,20:PLOT 100,8:DRAWTO 100,7-A:PLOT 100,32
3690 DRAWTO 100,33+A:PLOT 90,12:DRAWTO 90-A,12-A:PLOT 110,12:DRAWTO 110+A,12-A:PLOT 90,30:DRAWTO 90-A,30+A
3700 PLOT 110,30:DRAWTO 110+A,30+A
3710 COLOR H:PLOT 148,27:DRAWTO 150,25:DRAWTO 152,27
3720 COLOR I:PLOT 137,32:DRAWTO 140,35:DRAWTO 143,32:PLOT 140,34
3730 COLOR J:PLOT 126,49:DRAWTO 130,45:DRAWTO 134,49:PLOT 130,46
3740 COLOR L:PLOT 116,50:DRAWTO 122,56:DRAWTO 128,50:PLOT 122,55
3750 IF A=0 THEN H=4:I=1
3760 IF A=1 THEN I=4:J=1
3770 IF A=2 THEN J=4:L=1
3780 A=A+1:IF A=5 THEN RETURN
3790 GOSUB 5200:FOR G=1 TO 10:NEXT G
3800 GOTO 3680
3810 GOTO 3680
3850 REM BAR GRAPH
3855 V=70-C/2:FOR Q=48 TO 58
3860 COLOR 2:PLOT Q,70:DRAWTO Q,V:COLOR 3:DRAWTO Q,20
3870 NEXT Q
3890 RETURN
4000 X=0:IF W$="N" OR W$="n" THEN W=0:X=1
4010 IF W$="NE" OR W$="ne" THEN W=1:X=1
4020 IF W$="E" OR W$="e" THEN W=2:X=1
4030 IF W$="SE" OR W$="se" THEN W=3:X=1
4040 IF W$="S" OR W$="s" THEN W=4:X=1
4050 IF W$="SW" OR W$="sw" THEN W=5:X=1
4060 IF W$="W" OR W$="w" THEN W=6:X=1
4070 IF W$="NW" OR W$="nw" THEN W=7:X=1
4080 IF X=0 THEN ? "BAD DATA-TRY AGAIN":GOSUB 5020:GOTO 150
4090 GOSUB 5000:GOTO 160
4100 X=0:IF S$="C" OR S$="c" THEN S=0:X=1
4110 IF S$="P" OR S$="p" THEN S=10:X=1
4120 IF S$="M" OR S$="m" THEN S=20:X=1
4130 IF S$="O" OR S$="o" THEN S=30:X=1
4140 IF S$="R" OR S$="r" THEN S=40:X=1
4150 IF X=0 THEN ? "BAD DATA-TRY AGAIN":GOSUB 5020:GOTO 225
4160 GOSUB 5000:GOTO 230
4200 ? "BAD DATA-TRY AGAIN":GOSUB 5020:GOTO 120
4300 IF A<28 OR A>31 THEN 4320
4310 GOSUB 5000:GOTO 70
4320 GOSUB 5020:? "BAD DATA-TRY AGAIN":GOTO 60
4400 IF B<28 OR B>31 THEN 4420
4410 GOSUB 5000:GOTO 100
4420 GOSUB 5020:? "BAD DATA-TRY AGAIN":GOTO 90
5000 FOR Z=150 TO 0 STEP -10:SOUND 0,9,10,Z/10:NEXT Z:RETURN
5020 FOR Z=150 TO 0 STEP -10:SOUND 0,Z,12,Z:NEXT Z:RETURN
5100 FOR L=0 TO 30:SOUND 0,L*8,8,15-L/2:SOUND 1,L*8,16,15-L/2:NEXT L
5110 RETURN
5200 FOR F=10 TO 5 STEP -1
5210 SOUND 1,F,10,8:NEXT F:SOUND 1,0,0,0
5220 FOR F=8 TO 3 STEP -1
5230 SOUND 1,F,10,8:NEXT F:SOUND 1,0,0,0
5240 FOR F=6 TO 1 STEP -1
5250 SOUND 1,F,10,8:NEXT F:SOUND 1,0,0,0
5260 RETURN
31000 TRAP 31140:OPEN #3,8,0,"P:":TRAP 4000
31010 FOR Y=0 TO 78 STEP 2
31020 FOR X=0 TO 158 STEP 2
31030 LOCATE X,Y,Z
31040 IF Z=0 THEN ? #3;" ";:GOTO 31080
31045 REM COLOR 1,Z=0 BACKGROUND
31050 IF Z=1 THEN ? #3;"*";:GOTO 31080
31055 REM COLOR 2,Z=1
31060 IF Z=2 THEN ? #3;"o";:GOTO 31080
31065 REM COLOR 3,Z=2
31070 ? #3;"+";
31075 REM COLOR 4,Z=3
31080 IF X=158 THEN PRINT #3
31090 NEXT X
31100 NEXT Y
31110 ? #3;" TEMP ";
31115 ? #3;" % PRECIP ";
31120 ? #3;" ";"FORECAST ":? #3
31130 ? #3;" ";T$;" ";C;" ";F$
31135 IF (SENSORS) THEN ? #3;" TEMP=";INT(MTEMP*PEEK(624)+BTEMP),,
31136 IF (SENSORS) THEN ? #3;"HUM=";INT(MHUM*PEEK(625)+BHUM)
31140 CLOSE #3:RETURN
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: WEATHER.BAS.
Credits
- Program listing: Weather Wizard — program listing (Antic, June 1986 (Vol. 5, No. 2)) — Richard Staerzl (program); article by Charles Jackson
- Picture: A forecast from falling pressure, a south-west wind and mostly cloudy skies: warm, with a 90% chance of rain. (Captured from a copy with the answers built in.) — Richard Staerzl (program); article by Charles Jackson (program); screenshot by the site
- Antic, June 1986 - Vol. 5 No. 2: scan of the printed magazine, Weather Wizard, program by Richard Staerzl, article by Charles Jackson, pp. 19-20 (listing p. 112) — Richard Staerzl, 1986
- Antic disk, June 1986 - Vol. 5 No. 2: WEATHER.BAS (detokenized listing) — Richard Staerzl (program); article by Charles Jackson, 1986
