It is recommended (not required): that you have both color.gs and cbar.gs in your script library to plot the RADAR color scale and associated colorbar.
For this tutorial, we will simply plot county boundaries on a map of the US. Before we get started, we will first need to download the proper shapefiles. The county shapefiles are available from NOAA here. This site should provide you with a table showing recent versions of the shapefile, download and unzip it. The list of files included within the zipped folder shows four files, these are the files from the April 2013 version:
Most shapefiles I have encountered have some combination of these files, and because each shape tends to come with multiple files, I have found it useful to create a separate folder to store my shapefiles in, aptly named: Shapefiles.
Now that you have the county shapefiles in your proper folder we can begin with the tutorial. The first, and possibly most important thing to know about shapefiles is that you need to plot something from your GrADS data before you can draw your shapefiles. If you don't you will get an error that says: "No Scaling Environment."
So, in order to plot our counties, we need to plot a variable first, which means we will need a file. For this example we will use the RAP model using the 'sdfopen' command.
Now that our data file is open, the rest of the script is very short and most of it is just setting up the domain and display options. If you have read through any previous tutorials, then next block of code will look familiar.
'set lat 22 51'
'set lon -128 -65'
'set gxout shaded'
'set mpdset hires'
'set map 0' ;*Sets map outline color to Black
With the domain set up, we just need to plot the variable. For this example, we will plot the model predicted RADAR reflectivity. I included in this block of code with a good approximation of the NWS color scale for reflectivity using color.gs.
*If you have color.gs*
'color 5 75 5 -kind white->dodgerblue->blue->lime->green->darkgreen->yellow->goldenrod->orange->firebrick->red->darkred->fuchsia->indigo'
Now that the RADAR is plotted, its time to draw the shapefile. This is perhaps the easiest part of the tutorial. You simply use the 'draw shp' command and point to the file path. In this example:
'draw shp Shapefiles/c_03ap12.shp'
This command is all you need to draw the counties on the map. If you wish to change the properties of the shapefile you can do so using a few additional commands. The outline color can be set using the 'set line command. The fill properties can be set using the 'set shpopts' command. By default, shapefiles are not filled.
'set line 0' ;*Where the outline color is set to 0
'set shpopts 15' ;*Fills shapefile, where 15 is the number of the desired fill color. A value of -1 turns off fill.
Depending on your exact output options, your final map should look similar to this.
|RAP Reflectivity map with counties|
Using shapefiles in GrADS can get much more complex. However, for the purposes of this tutorial, I wanted to provide a real basic introduction to shapefiles in GrADS. I may, at a later time, write up more advanced tutorials for shapefiles. In the mean time, if you are interested in learning more about shapefiles in GrADS, I encourage you to check out this resource to get a more comprehensive look.
Again, you can download shapefiles for pretty much everything you could imagine, here is just a small list of shapefile resources to get you started.
Download this Script