Reformatting NWS text products
Here we attempt to improve the formatting of the text coming out of the Area Discussion cgi scripts found at Oklahoma Weather Roundup.
Download pydis9.tar. Read the Readme.
In pydis9.tar you will find a directory pydis9. I suggest you put pydis9.tar in your public_html directory and do a:
tar xvf pydis9.tar
In pydis9 , you will find two python scripts. These scripts (and the venerable scripts at the Oklahoma Weather Roundup) call the program weather, which is available on Gentry. weather grabs text from standard NWS files. The essential command is:
/usr/local/bin/weather -c foredis stid l
where stid is either oun, ama, fwd, etc.. The above command also works from the Gentry command line. The l stands for lastest, and the weather program on Gentry
is basically grabbing the latest text for stid from the files in /data/weather/FOREDISS.
For development purposes, the scripts can skip the system call to weather and use the data in the bundled directory demo_data. Thus you can experiment with the scripts even if you are not using Gentry. In fact, even if you are using the scripts on Gentry, you are asked to initially use the demo data for the completion of the task. If you want to do all the development on your local Linux PC, rather than Gentry, you may need this dictionary: american-english.
This will be helpful: abbreviations and acronyms.
You will also need to cut and paste this (the original web source is defunct):
code_to_state = {"WA": "WASHINGTON", "VA": "VIRGINIA", "DE": "DELAWARE", "DC": "DISTRICT OF COLUMBIA", "WI": "WISCONSIN", "WV": "WEST VIRGINIA", "HI": "HAWAII", "AE": "Armed Forces Middle East", "FL": "FLORIDA", "FM": "FEDERATED STATES OF MICRONESIA", "WY": "WYOMING", "NH": "NEW HAMPSHIRE", "NJ": "NEW JERSEY", "NM": "NEW MEXICO", "TX": "TEXAS", "LA": "LOUISIANA", "NC": "NORTH CAROLINA", "ND": "NORTH DAKOTA", "NE": "NEBRASKA", "TN": "TENNESSEE", "NY": "NEW YORK", "PA": "PENNSYLVANIA", "CA": "CALIFORNIA", "NV": "NEVADA", "AA": "Armed Forces Americas", "PW": "PALAU", "GU": "GUAM", "CO": "COLORADO", "VI": "VIRGIN ISLANDS", "AK": "ALASKA", "AL": "ALABAMA", "AP": "Armed Forces Pacific", "AS": "AMERICAN SAMOA", "AR": "ARKANSAS", "VT": "VERMONT", "IL": "ILLINOIS", "GA": "GEORGIA", "IN": "INDIANA", "IA": "IOWA", "OK": "OKLAHOMA", "AZ": "ARIZONA", "ID": "IDAHO", "CT": "CONNECTICUT", "ME": "MAINE", "MD": "MARYLAND", "MA": "MASSACHUSETTS", "OH": "OHIO", "UT": "UTAH", "MO": "MISSOURI", "MN": "MINNESOTA", "MI": "MICHIGAN", "MH": "MARSHALL ISLANDS", "RI": "RHODE ISLAND", "KS": "KANSAS", "MT": "MONTANA", "MP": "NORTHERN MARIANA ISLANDS", "MS": "MISSISSIPPI", "PR": "PUERTO RICO", "SC": "SOUTH CAROLINA", "KY": "KENTUCKY", "OR": "OREGON", "SD": "SOUTH DAKOTA"}The simple script pydis.cgi, which simply passed on the text output from weather:
pydis.cgi?ounX Norman demo data
pydis.cgi?amaX Amarillo demo data
pydis.cgi?fwdX Fort Worth demo data
pydis.cgi?oun Norman current data
pydis.cgi?ama Amarillo current data
pydis.cgi?fwd Fort Worth current data
The unfinished pydis9.cgi, as you receive it in pydis9.tar. Check out the cool "mouse over" on the underlined abbreviations:
pydis9.cgi?ounX Norman demo data
pydis9.cgi?amaX Amarillo demo data
pydis9.cgi?fwdX Fort Worth demo data
pydis9.cgi?oun Norman current data
pydis9.cgi?ama Amarillo current data
pydis9.cgi?fwd Fort Worth current data
My completed pydis9.cgi (which your completed script should emulate):
pydis9Z.cgi?ounX Norman demo data
pydis9Z.cgi?amaX Amarillo demo data
pydis9Z.cgi?fwdX Fort Worth demo data
pydis9Z.cgi?oun Norman current data
pydis9Z.cgi?ama Amarillo current data
pydis9Z.cgi?fwd Fort Worth current data