last modified:
06:38 PM CST, Wed 13 Dec 2006
GIF from gempak (with crontab)Unisys owns gempak AND the rights to GIF. Not too surprising, Unisys is happy to offer GIF output from gempak. The first gemapak script from gpscripts.tar that you are invited to play with is corrected.csh. The script originates from the gempak script examples, under Creating images for WWW, where you will find a script to create ETA gif images. That script DOES NOT run on Gentry, for a couple of reasons. First, the GDATTIM and GVCORD variables are set incorrectly for the version of gempak we are running (5.8.2a). Secondly, there is a modification needed for running on Gentry; for the configuration on Gentry we need to invoke the command: source /usr/local/nawips/Gemenviron early in the script. You may want to inspect Gemenviron with a text editor, or with this "browser": less /usr/local/nawips/Gemenviron (Use the up/down arrow key to "cruise" around; enter q to quit). Also, for your covenience, corrected.csh has been altered to send GIF files to a directory mydump. You must make that directory first, and corrected.csh must be executable by you. Here we go: mkdir mydump chmod u+x correctd.csh corrected.cshIf all went well, you will find a bunch of newly rendered GIF files in mydump: eta_emsl.gif, eta_emsl.gif.1, eta_emsl.gif.2 and so on. These aren't the most amazing graphical renderings of a forecast product, but that is where we begin... sat2gif.csh makes ir_sat.gif, and surfaceobs.csh makes nyobs.gif. These scripts are designed to be run automatically, at a time specified by you using crontab. But first change all the bfiedler to yourname in all these scripts. You can read about crontab at Crontab Tutorial or Linux Cron Howto. But beware the crontab on Gentry is even easier to use than documented in those references. Those references advise about using crontab -e to edit a file owned by root in /var/spool/cron/crontabs. On Gentry you can put the cron commands in a file owned by you, for example mycron.txt. Then invoke your commands with crontab mycron.txt. You can see your schedule with crontab -l. You can kill you scheduled jobs with crontab -r, edit you mycron.txt with any text editor, and resubmit your schedule again with crontab mycron.txt. Now, an explanation of the modification within corrected.csh: setenv DISPLAY :1.0 Believe it or not, when gempak makes a gif, it grabs information about color depth, etc. from the x-session you opened with Gentry. When called with crontab, gempak might croak even before you display the gif, if your remote computer display is set to 16 or 24 bit color, rather than 8 bit. So Gentry has a kluge set up to grab X-resources from a dummy 8-bit display, accessed with the above setenv command. You might think this kluge is unnecessary, given what is said about the "GIF" option in device, but only the option "GF" with the above kluge worked for me for some scripts, particularly those executed by crontab. PostScript from gempakThe following three example scripts make postscript output, and show how to fix an annoying "feature" of gempak. If you look at one the GIFs that you just made, you will see that the map is drawn on top of the contours for the data. Certainly for upper air data, the plot will look more natural with the contours on top of the map. Included in gpscripts.tar are four more gempak scripts for your enjoyment and education:
ps2eps ounA.ps ps2eps ounB.ps ps2eps eta.ps latex fewfigs dvips -o fewfigs.ps fewfigs gv fewfigs.ps lpr -P thenameofcolorprinter fewfigs.psOr eps2pdf ounA.eps eps2pdf ounB.eps eps2pdf eta.eps pdflatex fewfigs acroread fewfigs.pdf
gempak from the command lineI personally don't enjoy running gempak from the command line, but some instructions follow. Like GrADS, or Python, gempak can be run from the command line. Unlike grads, all the gempak variables are "remembered" as shell variables, so after you run one of the above scripts (ua2psA.csh for example), running from the command line is snap. Type: snprof You will see all your previous variables flash before your eyes. Then, at the GEMPAK-SNPROF> prompt, enter run then just hit enter (i.e. enter a totally blank command line, this is the reason for the mysterious blank line seen in the scripts after run). Then enter exit. When back in the unix command line, enter gpend, and you've made ounA.ps again. Of course, you may want to attempt more from the command line, e.g. phelp or title=4/3/my new title. Don't forget to type gpend when you are back to the unix command line! Learning moreGempak has various front-end GUIs already known to many students of meteorology. To access garp, ntrans, etc., enter ntl on a metlab workstations in the SOM plaza lab. Playing with the GUIs should give you an idea of the breadth of data available through gempak. Now might be good time to visit the official tutorial. It may be just what you need. But here you are being thrown into the "deep end", namely script writing, so you may want to go straight to the tutorial section on GEMPAK batch scripts. Cut and paste one of the gempak script examples, and make modification appropriate for Gentry, and for producing GIF images. You may then want to visit the "GEMPAK Programs" section of the online gempak documentation. There are indeed a lot. Gempak also contains the programs to create data files in gempak format. You might need to do this if you wanted to compare your model soundings with observed soundings, using gempak plotting programs. But you won't learn much about creating gempak data files in this tutorial. (Have a look a sncfil and snedit to learn how to create upper air data files).
Now it is your turn to think about nifty online uses of gempak.
|