graphics_grads.tex 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. In this section, visualisation using the graphics package \verb#GrADS#
  2. ({\bf Gr}id {\bf A}nalysis and {\bf D}isplay {\bf S}ystem) is
  3. described. A useful Internet site for reference and for installation
  4. instructions is
  5. \begin{quote}
  6. {\url{http://grads.iges.org/grads/grads.html}}.
  7. \end{quote}
  8. The latest version of \verb#GrADS# can handle data in \verb#NetCDF#
  9. format via the command \verb#sdfopen#.
  10. Any file produced by the \verb#Pumaburner# with the option NETCDF=1
  11. can be read directly by \verb#GrADS#.
  12. For files in the \verb#SERVICE# format is possible to use
  13. a converter, which translates from the \verb#SERVICE# format into \verb#NetCDF#.
  14. But in the following it is assumed that the \verb/PUMA/ output has been
  15. postprocessed into the \verb#SERVICE# format with the \verb#Pumaburner# and that the
  16. resulting file is called \verb/puma.srv/. Using the option -g for the \verb#Pumaburner#
  17. creates the related GrADS control file \verb/puma.ctl/.
  18. Monthly mean data is either obtained
  19. directly from the \verb#Pumaburner# (\verb#namelist# parameter
  20. \verb#MEAN=1#, see section \ref{Pumaburner}) or via a
  21. \verb/CDO/ command:
  22. \begin{quote}
  23. \verb/cdo monmean puma.srv puma_m.srv/
  24. \end{quote}
  25. \noindent Information on the {\bf C}limate {\bf D}ata {\bf O}perators ({\bf CDO}'s)
  26. can be found in the \verb#CDO User's Guide# at
  27. \begin{quote}
  28. {\url{http://www.mpimet.mpg.de/fileadmin/software/cdo/}}.
  29. \end{quote}
  30. When the \verb#GrADS# control file was not created via the \verb#Pumaburner#
  31. option -g, it can be done by the command:
  32. \begin{quote}
  33. \verb#srvctl puma_m.srv#
  34. \end{quote}
  35. \noindent which creates the file \verb/puma_m.ctl/.
  36. It contains information on the grid, time steps, and variable names. The file
  37. \verb/puma_m.srv/ is still needed in addition.
  38. The program
  39. \verb#srvctl.f90# is one of the post-processing tools available at
  40. \begin{quote}
  41. {\url{http://mi.uni-hamburg.de/puma/}}.
  42. \end{quote}
  43. If you chose to compile it yourself, please read the comments in the
  44. first few lines of the program text. Sometimes the
  45. \verb/srvctl/ tool has difficulty calculating an appropriate time axis
  46. from the data headers of the data records, so you should check this.
  47. In particular the number of days per year is concerned: \verb#GrADS# may assume 365
  48. days per year even though the data header says 360 days per year.
  49. This is an example of what the \verb/puma_m.ctl/ should look like:
  50. \begin{verbatim}
  51. DSET ^puma_m.gra
  52. UNDEF 9e+09
  53. XDEF 64 LINEAR 0.0000 5.6250
  54. OPTIONS YREV
  55. YDEF 32 LEVELS
  56. -85.7606 -80.2688 -74.7445 -69.2130 -63.6786 -58.1430 -52.6065 -47.0696
  57. -41.5325 -35.9951 -30.4576 -24.9199 -19.3822 -13.8445 -8.3067 -2.7689
  58. 2.7689 8.3067 13.8445 19.3822 24.9199 30.4576 35.9951 41.5325
  59. 47.0696 52.6065 58.1430 63.6786 69.2130 74.7445 80.2688 85.7606
  60. ZDEF 5 LEVELS
  61. 20000
  62. 50000
  63. 70000
  64. 85000
  65. 100000
  66. TDEF 12 LINEAR 00:00Z01jan0001 1mo
  67. VARS 3
  68. c130 5 99 130 0 0
  69. c131 5 99 131 0 0
  70. c132 5 99 132 0 0
  71. ENDVARS
  72. \end{verbatim}
  73. Here, since we are handling monthly mean data, the line starting
  74. with \verb/TDEF/ ends with \verb/1mo/. When the \verb/PUMA/ output is used
  75. without averaging, this should correspond to the output interval given
  76. by the \verb#nwpd# variable used in the \verb#namelist# of your \verb#PUMA#
  77. run (see Appendix \ref{Namelist}). The number of variables
  78. depends on how the Pumaburner was
  79. called. In this example, only three variables were processed, i.e.\ the
  80. temperature (\verb/c130/), the zonal wind (\verb/c131/) and the meridional
  81. wind (\verb/c132/). Refer to Appendix \ref{Pumacodes} for a list of the codes.
  82. \\
  83. The GrADS program is started by typing \verb/grads/ in a terminal window.
  84. Then, the data is displayed either by typing commands line-by-line,
  85. or preferably by using scripts. The following script, called \verb/tglob.gs/,
  86. displays the monthly mean temperature at 500hPa:
  87. \begin{verbatim}
  88. # tglob.gs
  89. function pass(m)
  90. 'reinit'
  91. 'open puma_m'
  92. 'enable print print.mf'
  93. 'set t 'm
  94. 'set lev 50000'
  95. 'c'
  96. 'set gxout shaded'
  97. 'd (c130-273.16)'
  98. 'cbar.gs'
  99. 'set gxout contour'
  100. 'd (c130-273.16)'
  101. 'draw title Temperature (deg C) 500hPa month 'm
  102. 'print'
  103. 'disable print'
  104. '!gxps -i print.mf -o tglob'm'.ps'
  105. \end{verbatim}
  106. The variable \verb/m/ at the beginning of the script defines the month
  107. which should be displayed. It is passed from the terminal with the
  108. script call. Note that no quotation marks are present in this line,
  109. since only \verb/GrADS/ specific commands are framed by quotation marks.
  110. Script commands, variable definitions, if-clauses, etc. are used without
  111. quotation marks. The script is executed by typing its name, without
  112. the suffix \verb/.gs/, followed by the number of the month to be shown.
  113. For example, \verb/tglob 7/ displays the monthly mean temperature at 500hPa
  114. in July. The resulting output file is called \verb/tglob7.ps/.
  115. \par
  116. \vspace{3mm}
  117. The following script \verb/thh/ displays the time dependent
  118. temperature (in 1000hPa) of Hamburg. Here, two variables are passed to \verb/GrADS/ to plot,
  119. the first day and the last day. (Note that here, the file \verb/puma.gra/
  120. is opened, which contains data on a daily basis). The call \verb/thh 91 180/
  121. displays the temperature in 1000hPa of Hamburg for the spring season
  122. from April 1st to June 30th.
  123. \begin{verbatim}
  124. # thh.gs
  125. function pass(d1 d2)
  126. 'reinit'
  127. 'open puma'
  128. 'enable print print.mf'
  129. 'set lat 53'
  130. 'set lon 10'
  131. 'set lev 100000'
  132. 'set t 'd1' 'd2
  133. 'c'
  134. 'd (c130-273.16)'
  135. 'draw title Temperature (deg C) 1000hPa in Hamburg'
  136. 'print'
  137. 'disable print'
  138. '!gxps -i print.mf -o thh.ps'
  139. \end{verbatim}
  140. \vspace{3mm}
  141. It is possible to have more than one figure in a plot, which is
  142. illustrated in the following script. It plots the seasonal means
  143. of the sea level pressure. The data file is prepared like this:
  144. \begin{verbatim}
  145. cdo selcode,151 puma.srv slp.srv #code 151 has to be in puma.srv
  146. cdo seasmean slp.srv slp_sm.srv
  147. srv2gra slp_sm.srv
  148. \end{verbatim}
  149. The command \verb/set vpage/ sets a virtual page inside the graphic
  150. window. The full window is 11 inch wide and 8.5 inch high, so
  151. \verb/set vpage 0 5.5 4.25 8.5/ defines the upper left corner.
  152. If \verb/setlevs=1/ is specified, then the pressure levels as given are used.
  153. Otherwise, \verb/GrADS/ defines contour levels depending on the data set.
  154. \begin{verbatim}
  155. # slp_sm.gs
  156. setlevs=1
  157. 'reinit'
  158. 'open slp_sm'
  159. 'enable print print.mf'
  160. 'c'
  161. 'set vpage 0 5.5 4.25 8.5'
  162. 'set gxout contour'
  163. if (setlevs=1)
  164. 'set clevs 990 995 1000 1005 1010 1015 1020'
  165. endif
  166. 'set ccols 1'
  167. 'set grads off'
  168. 'set t 1'
  169. 'd c151/100'
  170. 'draw title SLP [hPa] yr 'ny' DJF'
  171. 'set vpage 5.5 11 4.25 8.5'
  172. 'set gxout contour'
  173. if (setlevs=1)
  174. 'set clevs 990 995 1000 1005 1010 1015 1020'
  175. endif
  176. 'set ccols 1'
  177. 'set grads off'
  178. 'set t 2'
  179. 'd c151/100'
  180. 'draw title yr 'ny' MAM'
  181. 'set vpage 0 5.5 0 4.25'
  182. 'set gxout contour'
  183. if (setlevs=1)
  184. 'set clevs 990 995 1000 1005 1010 1015 1020'
  185. endif
  186. 'set ccols 1'
  187. 'set grads off'
  188. 'set t 3'
  189. 'd c151/100'
  190. 'draw title yr 'ny' JJA'
  191. 'set vpage 5.5 11 0 4.25'
  192. 'set gxout contour'
  193. if (setlevs=1)
  194. 'set clevs 990 995 1000 1005 1010 1015 1020'
  195. endif
  196. 'set ccols 1'
  197. 'set grads off'
  198. 'set t 4'
  199. 'd c151/100'
  200. 'draw title yr 'ny' SON'
  201. 'print'
  202. 'disable print'
  203. '!gxps -c -i print.mf -o slp_sm.ps'
  204. \end{verbatim}