Return to the archive home page

Weather Prophet

COMPUTE!'s Gazette September 1985

George W. Miller, Assistant Technical Editor

We all look at the forecast to see whether we should go on a picnic or stay home to read a book, or carry an umbrella or put on a shortsleeved shirt. This program for the 64 and Plus/4 can give you a pretty reliable idea of what weather to expect in the next day or two. It could also make a good school project. A disk drive is required.

Everyone talks about the weather; it's one of the safest topics to discuss. You can't argue with somebody who says "Beautiful day we're having." With "Weather Prophet," when you make a new acquaintance at a social gathering and the weather comes up, you can say "My computer is predicting rain," or "I think the forecast is wrong, my computer says it will be sunny."

You'll have to keep some records, of course. Ideally, you should load and run the program every day and spend a few minutes to update the weather files. The payoff is that as your weather database grows, your forecast becomes more accurate.

After entering the necessary information (temperature, humidity, wind speed and direction, and so on), you're given a short forecast. In addition, Weather Prophet looks back into the database for similar weather. It reminds you of what happened for several days after the last occurrence of any similar conditions, allowing you to better evaluate the short-range forecast generated by the program.

Weather Prophet tells you what the normal high and low temperature and rainfall or snowfall amounts for your area should be, and keeps track of the cumulative amounts of rain and snow, for you to compare against the average. Weather Prophet will also calculate the "heating and cooling degree days," so you'll know what to expect on your utility bills. It can even generate a monthly summary report. You choose whether all of this information is printed on the screen or a printer.

Professional weather forecasting services such as Accuweather and the National Weather Service have access to millions of, dollars worth of state-of-the-art equipment, and they still have problems giving a reliable forecast. How can a BASIC program hope to emulate the mainframe computers used by these services?

During our testing period, Weather Prophet maintained an accuracy rating of over 98 percent. That's surprising, considering that the information needed to generate the forecast is very easy for anyone to obtain.

Predicting, Not Guessing

It's been said that to predict the weather, all you have to say is that tomorrow will be pretty much like today, and you'll be right more, often than not. But 50 percent accuracy isn't a very good average. Or you could memorize weather folklore, such as red sky at morning, sailors take warning; red sky at night, sailor's delight. Some of these sayings are remarkably accurate, although they may be true only in certain areas.

Meteorologists have determined that three factors greatly influence local climatic conditions: barometric pressure, the rate of change of the barometer, and the wind direction.

In the northern hemisphere, the winds of a low pressure cell (also known as a cyclone) rotate in a counter-clockwise direction. A high pressure system (or anti-cyclone) has winds rotating in a clockwise direction. If you were to face into the wind, a low pressure cell would generally be located to your right, and an area of high pressure would exist somewhere to your left. Weather Prophet uses this knowledge to decide which type of weather system is influencing your local climatic pattern.

The rate of change of the barometric pressure helps determine how quickly a weather system is approaching and what type of system it is. A low pressure system usually brings in clouds, and bad weather, while high pressure is usually accompanied by clear skies and fair weather. The barometric pressure reading determines how strong the approaching system is.

You can gather this information yourself very easily. Barometers can be purchased at most hardware stores. You can use a weather vane to judge the direction of the wind or just observe the smoke from a chimney. Go outside and face north. East will be on your right hand, south is behind you, and west is to your left. You can easily decide which direction the wind is coming from.

As you gather data to develop your own historical file of local climatological data, you'll need information about the wind speed, too. This can be estimated quite accurately, using this table:

ESTIMATED WIND SPEED

Wind Speed (mph) - Observed Effect

0-1 - calm, smoke rises vertically
1-3 - direction seen in smoke, but not in a weather vane
4-7 - leaves rustle
8-12 - leaves and small twigs move
13-18 - small branches move
19-24 - small trees sway
25-31 - large branches move
32-38 - trees sway, walking into the wind is difficult
39-46 - twigs break off trees, cars veer on road
47-54 - roof slates may blow away
55-63 - trees are uprooted
64-72 - widespread damage apparent
73-up - hurricane winds

You'll need the daily high and low temperatures, relative humidity, and the amount of precipitation as well. This can be obtained from newspapers, the news on television, or from NOAA (National Oceanic and Atmospheric Administration) Radio broadcasts. In most areas this public service band radio station broadcasts a continuous weather forecast from the National Weather Service, and, usually beween 7:00 and 9:00 a.m. and again between 6:00 and 9:00 p.m., broadcasts a weather summary for the preceding day which includes all the information you'll need.

Of course, it would be more fun to collect the information yourself and make your data truly unique to your specific location. Rain gauges may be purchased at many stores, or you can make your on with a coffee can and a ruler. Your barometer may have a gauge for relative humidity built into it, although this can be influenced by its location and may not give a true indication of the actual relative humidity. To measure the high and low temperatures yourself, you'll need a Mini-Max Thermometer, which indicates temperature extremes.

Typing In Weather Prophet

Enter the program carefully using "The Automatic Proofreader," (published frequently in the GAZETTE). Lines 10-40 allow you to set the screen and border colors for your computer. If you're using a 64, delete the REM in line 20 when you're ready to save Weather Prophet. For the Plus/4, delete the REM in line 40. All other program lines are the same for both computers.

You'll have to customize Weather Prophet to display the local normal high and low temperatures, and rainfall and snowfall amounts for your area. Weather Prophet currently holds the normal conditions for Greensboro, North Carolina.

This weather information is available from several sources. Many almanacs list highs, lows, and precipitation. You could also check with your local newspaper or television station. The best source for climatological data is the National Oceanic and Atmospheric Administration:

NOAA
National Environmental Satellite,Data, and Information Service
National Climatic Data Center
Federal Building
Asheville, NC 28801

Request a copy of "Local Climatological Data, Annual Summary with Comparative Data" for your area.

When you have, the information, change the DATA statements in lines 3400 and 3410 to the values for the monthly high temperatures in your area. Lines 3430 and 3440 should be changed to the average monthly low temperatures. Finally, lines 3460 and 3470 will contain average monthly precipitation, and line 3490 will be average monthly snowfall.

The values for each category begin with January for the first value and are entered in order through December.

If you're not using a Commodore printer, it may be necessary to change the commands to send information to your printer. All that's necessary is to enter the proper commands in lines 140 and 150. Be sure to include a RETURN command at the end of each line because these are subroutines.

Carefully enter the program exactly as fisted with the exceptions of your customized DATA statements and printer commands. Weather Prophet uses relative files, and the syntax must be exact.

Putting Weather Prophet To Work

Load and run Weather Prophet. Be sure to leave the disk Which contains Weather Prophet and your data files in the disk drive at all times. The program checks the disk for information frequently as it runs.

You first see the main menu. If you have a printer connected and would like a printout of any information from Weather Prophet, enter 0 to enable output to the printer. The screen will clear for a second, then return, but will now indicate that the printer is on. Be sure your printer is turned on before you use this option. You can turn off the printer by entering 0 again. The display will indicate the printer is off.

The more you use the program and accumulate information, the more intelligent Weather Prophet becomes. Try to collect and enter data at the same time each day. This will help the program maintain some degree of consistency as it evaluates the data.

First, tell the program about the day's weather. Press I to begin entering the data. You'll be prompted for the date, in month, day, and year format. Separate each entry with a comma. (For example, July 4, 1985 would be 7,4,85.)

Have the information you gathered on hand. Answer the prompts as they appear. If you mistype an entry, press RETURN until you reach the end of the data entry routine. The information you typed is displayed on the screen or printer, and you'll be asked if it's correct. Answer no if you've made a mistake and you'll return to the beginning of the routine, with no harm done. Data must then be retyped.

Describe the cloud cover as a number between 0 and 100 percent, which represents the amount of the sky obscured by clouds. On a totally overcast day, for example, the cloud cover would be 100 percent.

The comment line is for your notes about the weather (fair, partly cloudy, rain, and so on). Any comments are OK, but be sure not to use commas.

When you've finished, the information you typed is displayed on the screen, along with the normal high and low temperatures for the month, rainfall and snowfall amounts, and heating or cooling degree days. A cumulative total is also displayed.

Next, the data is stored on the disk and Weather Prophet searches for similar conditions in the file and generates a short term forecast. It only attempts to forecast for the period during which it has a reasonably reliable forecast. This may cover between 12 and 72 hours.

Press any key to continue beyond the forecast. If any data similar to previous weather data is found, it is displayed, and the forecast conditions from that situation are shown. Use this historical record to evaluate the current forecast.

At times you may want a new forecast but don't want to store the information in the file, especially when weather conditions are changing rapidly. To generate a forecast, enter 2 from the main menu, and follow the prompts to enter barometric pressure, rate of change of the barometer, and wind direction. A forecast will be displayed, and the disk will be read in a search for similar conditions, as in data entry mode. No information will be stored on your disk.

Option 3, Search Data, allows you to review and analyze the information already stored. The program asks if you want to search by fields or for a specific record number. If you wish to, look at a specific day and happen to know the record number, this is the quickest search. Press R and answer the next prompt with the number of the record. This is handy when you're updating a file with several days' data after being away for a long weekend and can't remember whether you entered data on Friday evening. Just search for the last record number, and see what that entry holds.

Enter F to search by field, and you can choose to search for a specific date, generate a monthly report, or return to the main menu. To search for a specific date, enter the date (in month, day, year format), and the program will search for the record for that date.

Generating a monthly report is where Weather Prophet can really show off. It takes several minutes to sort through the data, primarily because of the slow speed of the 1541 disk drive. The program lists the extreme conditions for the month you selected: highest temperature, lowest temperature, days with rain, and so on.

If you'd like to check how many degree days have accumulated since you've been running the program, enter 4 from the main menu for the Degree Day Register. The value of heating and cooling degree days will be displayed, along with options to clear each register separately, or to return to the main menu.

The Degree Day Register needs to be reset once each year. Generally, the Heating Degree Day Register should be set to 0 in July, and the Cooling Degree Day Register to 0 in January. Enter the appropriate response and continue with the program.

Option 5 allows a smooth exit from the program, without pressing the RUN/STOP key. It's a good idea to always use this option to end the program, because pressing RUN/STOP while the program is running could cause the files being written to your disk to be damaged.

Try to take a few minutes every day to update the data file. The more you use Weather Prophet, the more reliable it becomes. Daily updates are also necessary to keep the degree day registers, accurate, and to develop accurate information for a monthly report. You'll find the information useful on a day-to-day basis.

September 1985 Gazette Disk