Weather Analysis is a meteorological data logging and forecasting program that stores up to 190 daily weather records in a fixed-width string array, with each 31-character record encoding date, high/low temperatures, barometric pressure, weather condition code, precipitation, snowfall, and wind direction/speed. The forecasting module applies a rule-based lookup using barometric pressure thresholds (29.8, 30.1, 30.2 inches), trend codes (steady/rising/falling), and wind direction codes to generate one of roughly 15 forecast messages, including flashing severe storm warnings with audio alerts. The program uses string slicing on dimensioned single-row string arrays (B$ through K$) as typed input buffers, a common Spectrum technique for constraining user input length. Climatological normal data hardcoded in the display routine reflects Los Angeles, California NWS records at 270 ft elevation. A correction routine (line 5000) allows updating any record by date search, and a date-search routine (line 3000) retrieves individual records for display.
Program Structure
The program is organized as a menu-driven application launched via GO SUB 2000 at line 59 (an introductory splash screen), followed by the main menu loop starting at line 60. The instruction in line 2 to use GO TO 59 rather than RUN exists because RUN would re-execute line 5 onward, reinitializing the counter variable L and the array dimensions, destroying stored data.
The six main functional modules are:
- Data Update (lines 135–375): Collects daily weather observations and stores them in the master array.
- Forecast (lines 380–687): Rule-based weather prediction from pressure, trend, and wind inputs.
- Display Data (lines 700–750): Dumps all stored records sequentially.
- Display Normals (lines 900–1040): Shows hardcoded LA climatological normals.
- Search Date (lines 3000–4020): Retrieves a single record by date.
- Corrections (lines 5000–6010): Allows in-place editing of an existing record.
Data Storage Architecture
All weather records are packed into a single two-dimensional string array A$(190,31), giving 190 rows of 31 characters each. Each row uses a fixed-width encoding:
| Columns | Field | Format |
|---|---|---|
| 1–2 | Month | 2 digits |
| 3–4 | Day | 2 digits |
| 5–6 | Year | 2 digits |
| 7–10 | High temperature | sign + 3 digits |
| 11–14 | Low temperature | sign + 3 digits |
| 15–19 | Barometric pressure | 5 characters (e.g. 30.12) |
| 20 | Weather condition code | 1 digit (1–7) |
| 21–25 | Precipitation | 5 characters (e.g. 02.75) |
| 26–27 | Snowfall | 2 digits |
| 28–31 | Wind direction + speed | 2-digit direction code + 2-digit speed |
The record count is tracked in the scalar variable L, which is initialized to 0 at line 9 and incremented at line 158 before the entry loop. Because L is not part of the DIM declarations, it survives between sessions as long as RUN is not used.
Input Buffer Arrays
A set of single-row string arrays (B$ through J$) serves as fixed-length input buffers. By dimensioning each to a specific length (e.g., DIM B$(1,8) for dates, DIM C$(1,4) for temperatures), the program constrains user input via sliced INPUT statements such as INPUT B$(1,1 TO 8). This is a well-known Spectrum technique that forces the entered string to exactly fill the declared length, preventing overruns into the master array.
Forecast Engine
The forecast module (lines 435–505) is a cascade of IF conditions testing three numeric inputs: barometric pressure A (in inches of mercury), barometric trend code B (1=steady through 5=rapid fall), and wind direction code C (1=N through 8=NW). Each condition maps to a forecast message block. Severe storm conditions (lines 675 and 680) use FLASH 1, contrasting paper/ink colors, and triple BEEP tones to draw attention. Note that lines 506–599 are absent — the cascade falls through to the forecast text blocks without a default “no match” handler, so unusual input combinations would simply produce no output and silently return to the menu via the next executed line.
Date Search and Correction Logic
Both the search (line 3000) and correction (line 5000) modules strip the separator dashes from the entered date string (format MM-DD-YY) by copying only the digit substrings into C$(1,1 TO 4) (month and day), then performing a linear scan of A$() rows 1 to L, comparing the first four characters of each record. Year digits (columns 5–6) are not included in the comparison key, meaning dates with the same month and day in different years would collide. The correction module at line 6010 performs a GO TO 300 to reuse the data confirmation display originally written for the update module, sharing code neatly between the two paths.
Notable Techniques and Anomalies
- The data entry loop at line 160 uses
FOR X=L TO 190but immediately fills only rowX=Land breaks on confirmation (GO TO 65), making it effectively a single-iteration loop. TheFOR/NEXTstructure is never meaningfully iterated. - Line 706 and 720 contain blank
REM-equivalent empty lines (bare line numbers with no statement), which are legal but produce no effect — likely editor artifacts. - The display routine at line 705 prints entire 31-character rows with
PRINT A$(T), which will output the raw packed string without field labels, making the display mode (lines 700–750) difficult to read compared to the formatted search display. PAUSE 40000is used throughout as an indefinite pause (the maximum value), relying on a keypress to advance — an idiomatic substitute forPAUSE 0with effectively the same behavior on most hardware.- The normals table (lines 940–1000) is hardcoded for the Los Angeles NWS station at 270 ft elevation and is not parameterized; it cannot be adapted to other locations without editing the source.
- The word “FORCAST” at line 2065 and “TEMERATURE” at line 190 are spelling errors in the original listing, not encoding artifacts.
- “MONTHES” at line 2057 is a misspelling of “months.”
Source Code
1 REM "WX LA"
2 REM DO NOT USE "RUN"-USE GOTO 59
5 LET X=0
6 LET A=0
7 LET B=0
8 LET C=0
9 LET L=0
10 DIM A$(190,31)
15 DIM B$(1,8)
20 DIM C$(1,4)
25 DIM D$(1,4)
30 DIM E$(1,5)
35 DIM F$(1,1)
40 DIM G$(1,5)
45 DIM H$(1,3)
50 DIM I$(1,4)
55 DIM J$(1,31)
56 DIM K$(1)
59 GO SUB 2000
60 BORDER 0:PAPER 1:INK 7:CLS
65 PRINT AT 0,5;"WEATHER ANALYSIS "
66 BEEP .2,55
70 PRINT
75 PRINT AT 5,3;"UPDATE DATA ENTER U "
80 PRINT AT 7,3;"FORECAST FROM DATA ENTER F "
85 PRINT AT 9,3;"DISPLAY DATA ENTER D "
90 PRINT AT 11,3;"DISPLAY NORMALS ENTER N "
92 PRINT AT 13,3;"TO STOP ENTER S "
93 PRINT AT 15,3;"SEARCH DATE ENTER C "
94 PRINT AT 17,3;"CORRECTIONS ENTER M "
95 PRINT AT 20,0;"FUNCTION???"
100 INPUT Y$
102 BEEP .05,40
105 IF Y$="U" THEN GO TO 135
110 IF Y$="F" THEN GO TO 380
115 IF Y$="D" THEN GO TO 700
120 IF Y$="N" THEN GO TO 900
122 IF Y$="C" THEN GO TO 3000
123 IF Y$="M" THEN GO TO 5000
125 IF Y$="S" THEN STOP
130 GO TO 95
135 CLS
140 PRINT " DATA UPDATE"
143 IF L=190 THEN PRINT "FILE FULL"
144 IF L=190 THEN PAUSE 40000
145 IF L=190 THEN GO TO 60
146 PRINT
150 PRINT "ENTER DATE (AS 12-30-82):"
155 INPUT B$(1,1 TO 8)
158 LET L=L+1
160 FOR X=L TO 190
165 LET A$(X,1 TO 2)=B$(1,1 TO 2)
170 LET A$(X,3 TO 4)=B$(1,4 TO 5)
172 LET A$(X,5 TO 6)=B$(1,7 TO 8)
175 PRINT "ENTER HIGH TEMPERATURE (AS +076)"
180 INPUT C$(1,1 TO 4)
185 LET A$(X,7 TO 10)=C$(1,1 TO 4)
190 PRINT "ENTER LOW TEMERATURE (AS -006)"
195 INPUT D$(1,1 TO 4)
200 LET A$(X,11 TO 14)=D$(1,1 TO 4)
205 PRINT "ENTER BAROMETER (IN INCHES)"
210 INPUT E$(1,1 TO 5)
215 LET A$(X,15 TO 19)=E$(1,1 TO 5)
220 PRINT "ENTER GENERAL WEATHER CONDITION",,"1=FAIR",,"2=CLOUDY",,"3=RAIN"
223 PRINT ,"4=SNOW",,"5=THUNDERSHOWERS","6=SNOW FLURRIES",,"7=HEAVY RAIN"
225 INPUT F$(1,1)
230 LET A$(X,20)=F$(1,1)
235 PRINT "ENTER PRECIPITATION (INCHES)"
240 PRINT "AS: 02.75"
245 INPUT G$(1,1 TO 5)
248 LET A$(X,21 TO 25)=G$(1,1 TO 5)
250 PRINT "SNOWFALL AMOUNT (AS 07)"
255 INPUT H$(1,1 TO 2)
258 LET A$(X,26 TO 27)=H$(1,1 TO 2)
260 CLS
265 PRINT "ENTER WIND DIRECTION AND SPEED:"
270 PRINT "USE THIS CODE:","01=N",,"02=NE",,"03=E",,"04=SE",,"05=S",,"06=SW"
273 PRINT ,"07=W",,"08=NW"
275 PRINT
280 PRINT "ENTER DIRECTION AND SPEED","AS FOUR DIGIT NUMBER ","0312",""
285 INPUT I$(1,1 TO 4)
290 LET A$(X,28 TO 31)=I$(1,1 TO 4)
295 CLS
300 PRINT "DATE: ";A$(X,1 TO 6)
305 PRINT "HI TEMP: ";A$(X,7 TO 10)
310 PRINT "LO TEMP: ";A$(X,11 TO 14)
315 PRINT "BAROMETER: ";A$(X,15 TO 19)
320 PRINT "CONDITIONS: ";A$(X,20)
330 PRINT "PRECIPITATION: ";A$(X,21 TO 25)
335 PRINT "SNOWFALL: ";A$(X,26 TO 27)
340 PRINT "WINDS: ";A$(X,28 TO 31)
342 PRINT "USE THIS CODE:","01=N",,"02=NE",,"03=E",,"04=SE",,"05=S",,"06=SW"
343 PRINT ,"07=W",,"08=NW"
345 PRINT
350 PRINT "IS THIS CORRECT?"
355 INPUT Z$
360 IF Z$="N" THEN GO TO 145
365 LET L=X
370 IF Z$="Y" THEN CLS
375 IF Z$="Y" THEN GO TO 65
380 CLS
385 PRINT " FORECAST"
390 PRINT "ENTER BAROMETRIC PRESSURE:"
395 INPUT A
400 PRINT
405 PRINT "IS BAROMETER: ","1. STEADY",,"2. SLOW RISE",,"3. RAPID RISE"
406 PRINT ,"4. SLOW FALL",,"5. RAPID FALL"
407 PRINT "RAPID CHANGE IS ANY CHANGE ","IN EXCESS OF 0.06 PER HOUR."
410 INPUT B
415 PRINT
420 PRINT "WIND FROM:"
425 PRINT ,"1=N",,"2=NE",,"3=E",,"4=SE",,"5=S",,"6=SW",,"7=W",,"8=NW"
430 INPUT C
433 CLS
435 IF A >=30.2 AND B=4 AND C >=6 AND C <=8 THEN GO TO 625
440 IF A >=30.2 AND B=1 AND C >=6 AND C <=8 THEN GO TO 620
445 IF A >=30.1 AND B=1 AND C >=6 AND C <=8 THEN GO TO 600
450 IF A >=30.1 AND B=3 AND C >=6 AND C <=8 THEN GO TO 605
455 IF A >=30.1 AND B=4 AND C >=6 AND C <=8 THEN GO TO 610
460 IF A >=30.1 AND B=5 AND C >=6 AND C <=8 THEN GO TO 615
465 IF A >=30.1 AND B=4 AND (C=4 OR C=5) THEN GO TO 630
470 IF A >=30.1 AND B=5 AND (C=4 OR C=5) THEN GO TO 635
475 IF A >=30.1 AND B=4 AND C >=2 AND C <=4 THEN GO TO 640
480 IF A >=30.1 AND B=5 AND C >=2 AND C <=4 THEN GO TO 645
485 IF A >=30.1 AND B=4 AND (C=3 OR C=2) THEN GO TO 650
490 IF A >=30.1 AND B=5 AND (C=3 OR C=2) THEN GO TO 655
492 IF A <=29.8 AND B=5 AND C >=1 AND C <=3 THEN GO TO 680
493 IF A <=29.8 AND B=5 AND C >=3 AND C <=5 THEN GO TO 675
494 IF A <=29.8 AND B=3 THEN GO TO 685
495 IF A <=30.1 AND B=4 AND C <=4 AND C >=2 THEN GO TO 660
500 IF A <=30.1 AND B=5 AND C <=4 AND C >=2 THEN GO TO 665
505 IF A <=30.1 AND B=2 AND (C=5 OR C=6) THEN GO TO 670
600 PRINT "FAIR, LITTLE CHANGE IN TEMP","FOR NEXT DAY OR TWO."
601 PAUSE 40000
602 GO TO 60
605 PRINT "FAIR TODAY, RAINY AND WARMER","WITHIN 48 HOURS."
606 PAUSE 40000
607 GO TO 60
610 PRINT "WARMER, RAIN WITHIN 18 TO 24","HOURS."
616 PAUSE 40000
617 GO TO 60
620 PRINT "CONTINUED FAIR WITH LITTLE","OR NO CHANGE IN TEMPERATURE."
621 PAUSE 40000
622 GO TO 60
625 PRINT "FAIR AND WARMER FOR NEXT 48 HOURS."
626 PAUSE 40000
627 GO TO 60
630 PRINT "RAIN WITHIN 24 HOURS."
631 PAUSE 40000
632 GO TO 60
635 PRINT "WINDY, WITH RAIN WITHIN 12","TO 24 HOURS."
636 PAUSE 40000
637 GO TO 60
640 PRINT "RAIN IN 12 TO 18 HOURS."
641 PAUSE 40000
642 GO TO 60
645 PRINT "WINDY AND RAIN WITHIN 12 HOURS."
646 PAUSE 40000
647 GO TO 60
650 PRINT "IN SUMMER WITH LIGHT WINDS: ","RAIN MAY NOT FALL FOR SEVERAL","DAYS."
651 PRINT "IN WINTER: RAIN WITHIN 24 HOURS."
652 PAUSE 40000
653 GO TO 60
655 PRINT "IN SUMMER: RAIN LIKELY WITHIN","12 TO 24 HOURS."
656 PRINT "IN WINTER: RAIN OR SNOW WITH INCREASING WINDS."
657 PAUSE 40000
658 GO TO 60
660 PRINT "RAIN FOR NEXT DAY OR TWO."
661 PAUSE 40000
662 GO TO 60
665 PRINT "RAIN, WITH HIGH WINDS FOLLOWED","WITHIN 24 HOURS BY CLEARING "
666 PRINT "AND TURNING COLDER."
667 PAUSE 40000
668 GO TO 60
670 PRINT "CLEARING WITHIN A FEW HOURS,","FAIR FOR NEXT SEVERAL DAYS."
671 GO TO 60
675 PAPER 7:INK 2:FLASH 1:PRINT "SEVERE STORM WARNING":FLASH 0:PAPER 1:INK 7:PRINT "WINDY, WITH RAIN OR SNOW"," IMMINENT"
676 BEEP .2,20:BEEP .2,25:BEEP .2,30:PRINT "FOLLOWED WITHIN 24 HOURS BY","CLEARING AND COLDER TEMPS."
677 PAUSE 40000
678 GO TO 60
680 PAPER 7:INK 2:FLASH 1:PRINT "SEVERE STORM WARNING":FLASH 0:PAPER 1:INK 7:PRINT "SEVERE NORTHEAST GALES"
681 BEEP .2,20:BEEP .2,25:BEEP .2,30:PRINT "HEAVY RAIN OR SNOW, FOLLOWED IN WINTER BY A COLD WAVE"
682 PAUSE 40000
683 GO TO 60
685 PRINT "CLEARING AND COLDER."
686 PAUSE 40000
687 GO TO 60
700 CLS
705 FOR T=1 TO L
706
710 PRINT A$(T)
720
730 NEXT T
740 PAUSE 200
750 GO TO 60
900 CLS
905 PRINT " WEATHER NORMS"
925 PRINT
930 PRINT " TEMP"
935 PRINT " HI LO MO RAIN SNOW"
940 PRINT "J 66 46 56 3.06 TR"
945 PRINT "F 67 48 58 3.07 TR"
950 PRINT "M 68 49 59 2.55 0.0"
955 PRINT "A 70 52 61 1.07 0.0"
960 PRINT "M 73 56 64 0.32 0.0"
965 PRINT "J 76 59 68 0.06 0.0"
970 PRINT
975 PRINT "J 82 63 73 0.01 0.0"
980 PRINT "A 83 64 74 0.05 0.0"
985 PRINT "S 82 62 72 0.23 0.0"
990 PRINT "O 78 58 68 0.50 0.0"
995 PRINT "N 73 52 62 1.37 0.0"
1000 PRINT "D 68 48 58 2.62 TR"
1005 PRINT
1010 PRINT "YR 74 55 64 14.91"
1015 PRINT
1020 PRINT "DATA FROM NWS L.A.,CA."
1025 PRINT " ELEVATION 270 FT."
1030 PAUSE 40000
1040 GO TO 60
2000 BORDER 0:PAPER 0:INK 7:CLS
2001 FOR I=1 TO 10
2002 PRINT
2003 NEXT I
2005 PRINT " WEATHER ANALYSIS "
2040 PAUSE 400
2050 CLS
2055 PRINT "THIS PROGRAM IS DESIGNED TO","STORE A LIMITED AMOUNT OF DATA"
2056 PRINT "IN THE FILE PORTION OF THE","PROGRAM. IT IS SUGGESTED"
2057 PRINT "THAT FOR STORAGE OF MORE THAN","SIX MONTHES A WEATHER FILE BE"
2058 PRINT "MAINTAINED."
2060 PRINT
2065 PRINT "THIS PROGRAM WILL OFFER A","FORCAST OF EXPECTED LOCAL"
2066 PRINT "WEATHER CONDITIONS,USING","BAROMETRIC PRESSURE AND WIND"
2067 PRINT "DIRECTION",,,,"YOU WILL BE SURPRISED AT"
2068 PRINT "THE ACCURACY OF THIS METHOD,","YET IT IS BASED ON SOUND"
2069 PRINT "SCIENTIFIC PRINCIPLES."
2070 PRINT
2075 PRINT "PRESS ANY KEY TO CONTINUE"
2080 PAUSE 40000
2085 CLS
2090 RETURN
3000 CLS
3010 PRINT "ENTER DATE (AS 12-05-82)"
3015 INPUT B$(1,1 TO 8)
3018
3020 LET C$(1,1 TO 2)=B$(1,1 TO 2)
3025 LET C$(1,3 TO 4)=B$(1,4 TO 5)
3030 FOR A=1 TO L
3035 IF C$(1,1 TO 4)=A$(A,1 TO 4) THEN GO TO 3050
3040 NEXT A
3042
3045 FLASH 1:PRINT "DATE NOT FOUND":FLASH 0
3046 PAUSE 40000
3047 GO TO 60
3050 CLS
3055
3066 PRINT "DATE: ";A$(A,1 TO 6)
3070 PRINT "HI TEMP: ";A$(A,7 TO 10)
3075 PRINT "LO TEMP: ";A$(A,11 TO 14)
3080 PRINT "BAROMETER: ";A$(A,15 TO 19)
3085 PRINT "CONDITION: ";A$(A,20)
3090 PRINT "PRECIPITATION: ";A$(A,21 TO 25)
3095 PRINT "SNOWFALL: ";A$(A,26 TO 27)
4000 PRINT "WINDS: ";A$(A,28 TO 31)
4010 PAUSE 40000
4020 GO TO 60
5000 CLS
5005 PRINT "ENTER DATE TO CHANGE:"
5010 INPUT B$(1,1 TO 8)
5011 LET C$(1,1 TO 2)=B$(1,1 TO 2)
5012 LET C$(1,3 TO 4)=B$(1,4 TO 5)
5015
5020 FOR N=1 TO L
5025 IF A$(N,1 TO 4)=C$(1,1 TO 4) THEN GO TO 5100
5030 NEXT N
5040
5050 FLASH 1:PRINT "DATE NOT IN FILE":FLASH 0
5055 PAUSE 40000
5060 GO TO 60
5100 CLS
5105
5110 PRINT "ENTER: "
5120 PRINT TAB 5;"DATE (AS 6 DIGITS)"," (120582)"
5125 INPUT A$(N,1 TO 6)
5130 PRINT TAB 5;"HI TEMP"
5135 INPUT A$(N,7 TO 10)
5140 PRINT TAB 5;"LOW TEMP"
5145 INPUT A$(N,11 TO 14)
5150 PRINT TAB 5;"BAROMETER"
5155 INPUT A$(N,15 TO 19)
5160 PRINT TAB 5;"CONDITION"
5165 PRINT ,"1. FAIR",,"2. CLOUDY",,"3. RAIN",,"4. SNOW",,"5. THUNDERSHOWER"
5167 PRINT ,"6. SNOW FLURRIES","7. HEAVY RAIN"
5170 INPUT A$(N,20)
5175 PRINT TAB 5;"RAIN"
5180 INPUT A$(N,21 TO 25)
5185 PRINT TAB 5;"WINDS"
5190 INPUT A$(N,28 TO 31)
5195 PRINT TAB 5;"SNOWFALL"
6000 INPUT A$(N,26 TO 27)
6005 LET X=N
6007 CLS
6010 GO TO 300Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
