reformatting NWS text products![]()
In pydis2.tar you will find a directory pydis2. I suggest you put pydis2.tar in your public_html directory and do a: tar xvf pydis2.tarIn pydis2 , 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 lwhere 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 and educational 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.
Here is my basic script pydis.cgi in action with the demo data:
Here is my basic script pydis.cgi in action with the current data, found in /data/weather/FOREDISS on Gentry:
Here is my prototype reformatting script pydis3.cgi in action with the demo data:
Here is my prototype reformatting script pydis3.cgi in action with the current data, found in /data/weather/FOREDISS on Gentry:
Your task is to first cp pydis3.cgi pydis3z.cgiThen start hacking on pydis3z.cgi until if conforms with these design criteria (which are also found in comments at the end of pydis3.cgi): #your task: # #(1) add to abbrev dictionary to #replace all ISOLATED "e" with "east", "n" with north, etc. (easy) # #(2) improve capitalization of proper nouns with regex, e.g. # "texas." did not capitalize. # #(2) Fix the replacement of "..." with ", " so that the leading, or # first instance, of "..." is NOT replaced. (you will need to make a counter) # #(3) regex: modify severe to include "tornado" and "tornadoes" # "tornadic" etc, and other severe words (easy). Be effecient! # Note that all those words have root "tornad". # #(4) regex: do some other text modification important to you!Make six links on your web page to your functional script pydis3z.cgi, similar to to these links, where you can see some, but not all of the functionality of pydis3z.cgi: Here is my pydis3z.cgi in action with the demo data:
Here is my pydis3z.cgi in action with the current data, found in /data/weather/FOREDISS on Gentry:
|