So, for this tutorial you must download the following files from the script library.
Now, basemaps are fairly easy to make, and can essentially be boiled down to three simple steps.
- Set a domain.
- Define a topography color scale (this is why we need color.gs)
- Fill in the water areas using the ".asc" files
Step 1: Set a Domain.
This is probably the most important step in making a basemap. In order to use the basemap later for your weather maps, you must know a) The lat/lon boundaries, b) the size of the image in pixels, and c) the GrADS page area of the map (set using the 'parea' command). But before we do anything, we want to open the data file. We'll be using topography data to make a basemap with terrain. So we will access the topography data from the GrADS data server. To access this data, we will start with the 'sdfopen' command
Now that our file is open, we will type in a couple of generic commands, so to set the background color to white and print a high resolution map when we display our variable.
'set display color white'
'set mpdset hires'
Now to set the actual domain. So, to make the image above, we will set the domain for the United States. We will do this using the 'set lat' and 'set lon' commands.
'set lat 22 51'
'set lon -128 -65'
At this point, we have our file open and our domain set. So the last thing we need to do before moving on to step 2, is define our page area. Remember this is important, so you know how to scale your weather maps in GrADS to fit on this image. We do this using the 'set parea' command. For the above image, the page area is set by:
'set parea 0.5 10.0 0.5 7.5'
Now that we have our area, we can move on to step two.
Step 2: Define a Topography Color Scale
This is very easy with the color.gs script, all you need to do is pick out a range of colors. For this map, we are going to use a transition from light green to brown, and our scale will fit the range of topography in the US (0 to ~4000 meters). More information on the color.gs script (including a list of colors) can be found at their website listed above, so if you want for information you can find it there. Anyway, the commands for the color scale used on the above image is set by this:
int=(4100-200)/50 ;*int sets the interval used for topography, this scale sets 50 intervals.
'color 200 4100 'int' -kind lightgreen->tan->brown'
Once the color scale is set, simply display the variable.
Now, our basemap is starting to take shape and we are set to move on to the final step.
Step 3: Fill in Water areas
This is the last step, and the only step that involves the use of basemap.gs.
To fill in the water areas, you will need to run the basemap.gs script as such:
'basemap O 11 1 H'
In this command, the O stands for Ocean, so the script will fill in bodies of water. The two numbers correspond to the fill and outline colors respectively. 11 for medium blue and 1 for black. Lastly, the H stands for high resolution, so this will use the file opoly_hires.asc to fill in the ocean.
Now, that you have a nice looking basemap, all thats left is to save the image using the 'printim' command. Be sure to specify the image dimensions, so that you can match them later when you save GrADS output over your basemap.
'printim img_name.png x800 y600 png'
And that's it, that's all there is to it! You now have a nice, elegant basemap to serve as a background for your GrADS output. To learn more how to output GrADS data onto your basemap, check out this tutorial.
Download Example script