#!/bin/csh ######### Example A2 ### Step 1: Remove the exiting file named tmp.ps, if any. Don't # be alarmed by the warning message "tmp.ps: No such file or directory" /bin/rm tmp.ps ### Step 2: make a basemap psbasemap -R-120/-60/20/50 -JM5 -Ba30/a15 -P -K -X1.5 -Y5 >tmp.ps ### Step 3: plot coastlines and political boundaries pscoast -R -JM -O -K -Dh -W4/155/0/255 -Na/1 \ -G200/200/0 -S10/200/220 >>tmp.ps ### Step 4: plot 1 red square in Kansas and another 1 in Nebraska psxy -R -JM -O -K -Ss0.2 -G255/0/0 <>tmp.ps -100 39 -100 42 END ### Step 5: write the word Texas pstext -R -JM -O -K -N <>tmp.ps -100 32 15 0 5 MC Texas END ### Step 6: add a thick green great-circle arc line connecting two points psxy -R -JM -O -K -W15/0/255/0 <>tmp.ps -110 45 -80 40 END ### Step 7: plot a blue rectangle (e.g., my area of study) psxy -R -JM -O -W9/0/0/255 <>tmp.ps -108 40 -108 38 -103 38 -103 40 -108 40 END ##################### End of useful codes. ############################## #~~~~~~~~~~~~~~~~~~~~~~~~~~ Detailed Explanations ~~~~~~~~~~~~~~~~~~~~~~~ ############################# Step 1: # rm tmp.ps # Your output will be tmp.ps. This step removes existing file # with the same name in the working directory. # If you are asked "rm tmp.ps", answer "y". ############################# Step 2: #psbasemap -R-120/-60/20/50 -JM5 -Ba30/a15 -P -K -X1.5 -Y5 >tmp.ps ### Important: the paramters (e.g. -R, -J, -P, -K, -X, -Y above) # of all GMT commands have no order, meaning that you can # put them wherever you want, as long as they are after # the GMT command (psbasemap in this case) and before # the ">" sign. ### psbasemap is a GMT command to make a basemap ### -R is a parameter of psbasemap, defining the region to be ploted. # The format for -R is -Rxmin/xmax/ymin/ymax ### -J is a parameter for psbasemap. # M after -J means you want to use Mecator projection which # is the most commonly used projection for mapping. # The "5" after -JM means you want the horizontal length of the final # map be 5 inches. The length along the vertical direction will # be determined by GMT. ### -B defines the frame (Boundary) of your plot. a30 means you want # an annotation every 30 degrees at the horizontal direction; and # /a15 means you want an annotation every 15 degrees at the vertical # direction. ### -P means you want to use Portrait mode instead of landscape mode. # If you want to use landscape mode, remove the -P. ### -K means that you will have more output below. ### -X1.5 means that you want your plot shifted by 1.5 inch to the right # from the lowerleft corner of the paper ### -Y5 means that you want your plot shifted up by 5 inches # from the lowerleft corner of the paper ### > is a 're-direction' sign. It means that you want the output # file be written to the file tmp.ps. Without ">", the # output will be on the screen (and rolling forever...) ### tmp.ps is your output graphic file (in Postscript format). ################################# Step 3: #pscoast -R -JM -O -K -Dh -W4/155/0/255 -Na/1 \ #-G200/200/0 -S10/200/220 >>tmp.ps ### pscoast is another GMT command to plot coastlines and political # boundaries ### -R is a paramter for pscoast (all the other single characters preceded # by "-" are parameters for pscoast. Because you have already # given the geographic coordinates in the psbasemap above, # you don't have to give them following -R again. ### -JM is the same as in the psbasemap command above. Again, you don't have # to put a "5" after -JM because it was already given in the # psbasemap command ### -D is a parameter for you to choose which database of coastlines and # political boundaries to be used. -Dh means you want to use the # high resolution one. From low to high: -Dc (coarse), -Dl (low), # -Dh (high), -Df (full). For mapping large areas you may want to # use -Dl or -Dc. ### -O means you want the output (coastlines and political boundaries) created # by this pscoast command to be Overplotted on top of the output from # the commands above ### -K means you will have more output to be added to tmp.ps ### -W is for the thickness and the color of the pen to be used to plot # the coastlines (but not the political boundaries). # the first number following -W ("4" in this case) gives the thickness. # Normally a number between 1 and 5 looks normal. 10 will be pretty # thick and 0.1 will be very thin. # 155/0/255 following -W4/ gives the color of the pen. There are 3 # colors (red/green/blue), each of them ranges from 0 to 255. Therefore # by using 155 for red, you want a middle-level participation of red; # by using 0 for green, you want no green color at all; and # by using 255 for blue, you want a full blue color. The combined color # of 155/0/255 is a K-State purple. ### -N is a parameter regarding national (and for North America, state as # well) boundaries. -Na means you want all the boundaries (national # and state). The "1" following -Na/ is the thickness of the pen # to plot national and state boundaries. ### \ means you want to continue the same command in a # new line. Remeber: don't leave a space after \ ### -G is a paramter used to fill land areas with colors (or patterns). # Again, the 3 numbers following -G give the red/green/blue level # in the mixing. ### -S is similar to -G but is to fill the water bodies (lakes and oceans). ### >>tmp.ps means you want the output be written to tmp.ps. Note that # there are two ">"s. ################################# Step 4: #psxy -R -JM -O -K -Ss0.2 -G255/0/0 <>tmp.ps #-100 39 #-100 42 #END ### psxy is another very common GMT command to plot data with both x and # y values. ### -R is the same as the -R in pscoast or psbasemap ### -J is the same as the -J in pscoast or psbasemap ### -O and -K are the same as in pscoast or psbasemap ### -S asks you for what symbol you want to use. -Ss means you # want to plot a square; The number following -Ss gives # the size of the square (in inches). Therefore, -Ss0.2 means # you want a square of 0.2 inches in size. ### -G gives the color of the squares; ### <> tmp.ps means you want to write the output file to tmp.ps ### -100 39 gives the longitude and latitude of the first square ### -100 42 gives the longitude and latitude of the 2nd square. You can # put a lot more squares ### END means your input for psxy ends here. Note: Don't leave a # space after END ################################# Step 5: #pstext -R -JM -O -N <>tmp.ps #-100 32 15 0 5 MC Texas #END ### pstext is another common GMT command to write texts. ### -R, -JM, -O, <>tmp.ps have the same meaning as in psxy # Note that you should not put a "-K" here because pstext will # be the last GMT command and no future graphic file to add. #### There are 6 numbers for pstext. # The first one (-100 in the example), gives the x-coordinate of # the texts; # The 2nd one (32), gives the y-coordinates of the plot. # The 3rd one (15) gives the size of the texts (15 is normal). # The 4th one (0) gives the angle of the texts (90 will be vertical) # The 5th one (5) gives the font number (there are 22 or so fonts). # The 6th one (MC) means you want the texts be plotted at the Mid-Center # of the location given by the first 2 numbers. #### -N means you want the texts be plotted even if they are out of # the area given by -R. #################################### Step 6: #add a thick green great-circle arc line connecting two points #psxy -R -JM -O -K -W15/0/255/0 <>tmp.ps #-110 45 #-80 40 #END ### -W is the paramter for pen, same as the -W in Step 3. # One thing to remember is that in psxy, if you don't # define a symbol using the -S parameter, psxy will # plot a line connecting the points defined in the # input lines or the input file. ### -110 45 is the longitude and latitude of one end of the line ### -80 40 is the longitude and latitude of the other end of the line ####################################### Step 7 #plot a blue rectangle (e.g., my area of study) #psxy -R -JM -O -W9/0/0/255 <>tmp.ps #-108 40 #-108 38 #-103 38 #-103 40 #-108 40 #END ### Almost everything is the same as in Step 6. # The only difference is that the line connects # five points and these points happen to form # a rectangle. # Note: there is no -K in this step because it is the last # GMT command.