|
Vector GraphicsIntroductionVector graphics use points, lines, curves, and polygons to construct a scalable image. Try zooming in as much as possible on the figure in this PDF document drawn with vector graphics and prepared in LaTeX. In contrast to raster graphics, notice how you can scale the image to any size without degrading quality. There are several formats for vector graphics. Some common formats include the Scalable Vector Graphics (SVG) language (also see SVGBasics tutorials), Adobe Illustrator (AI), PostScript (PS), and encapsulated PostScript (EPS). My experience with applications in meteorology leads me to believe that EPS graphics would be the most beneficial to learn about here, but others have had some success with the newer SVG format. Before we begin with EPS, let's start by learning about plain PostScript. Editing PostScript
Start by downloading applestar.ps onto Blizzard.
Type the following at the prompt:
gv applestar.ps &
If something happens, then you have a program called GhostView in your path and you may skip to the next paragraph.
If instead you get gv: Command not found. then you need to make a few changes to your setup.
A .cshrc file tells Blizzard which commands to execute when you log in.
You can customize your session by adding commands to this file.
If you do not already have a .cshrc file in your home directory (test this with ls -la), then type the following commands to retrieve my .cshrc file:
cd
Ignore any errors that show up in your terminal window by hitting Enter.
Be sure to scroll down in the GhostView window to see the graphic!
Now open applestar.ps in a text editor to see the PostScript commands.
(If you ever used an Apple IIe, you may notice that the basic idea of drawing with these commands is not that different from Apple Logo.)
Now grab applestar.eps and view the file with both GhostView and with a text editor.
The only difference between applestar.ps and applestar.eps is that the first line of applestar.ps has been replaced by
%!PS-Adobe-3.0 EPSF-3.0 Now edit applestar.eps with a text editor and see if you can make something interesting. You can use this Summary of PostScript Commands as a reference. A First Guide to PostScript provides a nice introduction and tutorial. The PostScript tips at Prepressure include help with rendering PostScript and dealing with errors. Modifying Generated PostScript
Sometimes you may find it useful to modify PostScript output from a program.
Let's use a program called gnuplot to accomplish this.
At the Linux prompt, try the following:
gnuplot
Converting PostScript Graphics to Raster Graphics
You can use ImageMagick to convert your PostScript graphics into raster graphics for display on a Web page:
convert applestar.eps applestar_alias.png Plotting METAR ObservationsFor your assignment, you will create station plots of METAR observations, much like what you would see at RAP Real-Time Weather Data. To simplify things a bit, we will use a Python utility written by Brian Fiedler called "vplot" to write out PostScript commands. Visit vplot to learn all about it and note that simpleSVG replaces vplot, but makes SVG graphics instead of PostScript graphics. For now, we'll use vplot here and I'll make a note to change this someday. Anyway, grab stnplot.tar and untar it with tar xvf stnplot.tar Follow the directions in the README file and look at the comments within stnplot.py. Your finished product might look something like the figure below.
Station Plot ResourcesMetarWeather is a nifty (and free) Windows program that downloads and decodes recent METAR observations. Archived raw and decoded observations are also available from Plymouth State. You may use the data file that I included in the assignment, but you could also download and plot your own set of observations. I massaged the decoded METAR reports a bit to produce 200902111900metar.dat for the assignment, so you may need to do the same if you decide to go this route. You can read about METAR code in Surface Weather Observations and Reports. The National Weather Service JetStream - Online School for Weather has a great resource for interpreting surface weather plots, where you can learn how to create a station plot. |