https://github.com/alphaparrot/ExoPlaSim
Revision 696ecbc37b1533896b4527bdb7e1c558ceded11d authored by Edilbert Kirk on 07 April 2017, 07:48:01 UTC, committed by Edilbert Kirk on 07 April 2017, 07:48:01 UTC
2 parent s adb891b + a9d0ba4
Raw File
Tip revision: 696ecbc37b1533896b4527bdb7e1c558ceded11d authored by Edilbert Kirk on 07 April 2017, 07:48:01 UTC
Merge branch 'master' of https://github.com/Edilbert/PLASIM
Tip revision: 696ecbc
graphics_grads.tex
In this section, visualisation using the graphics package GrADS is
described. A useful Internet site for reference and installation
instructions is
\begin{quote}
\verb#<http://grads.iges.org/grads/grads.html>#.
\end{quote}
Latest versions of \verb#GrADS# can handle data in \verb#NETCDF#
format (via the command
\verb#sdfopen#), \verb#GRIB#, \verb#HDF-SDS#, and in its native binary
format. The native format can
conveniently be derived from \verb#SERVICE# format.
In the following it is assumed that the \verb/PUMA/ output has been
 converted to \verb#SERVICE# format with the \verb#pumaburner# and the
resulting
file is called \verb/puma.srv/. Monthly mean data is either obtained
directly from the \verb#pumaburner# (\verb#namelist# parameter
\verb#MEAN=1#, see section \ref{Pumaburner}) or via a
\verb/PINGO/ command:
\begin{quote}
\verb/srv monmeans puma.srv puma_m.srv/
\end{quote}
\noindent Information on the \verb/PINGO/ package can be
found in DKRZ report 11 at
\begin{quote}
 \verb#<http://www.mad.zmaw.de/Pingo/repdl.html>#.
\end{quote}
The \verb#SERVICE# file has to be converted to
\verb#GrADS#'s native format by the command:
\begin{quote}
\verb#srv2gra puma_m.srv#
\end{quote}
\noindent which results in the files \verb/puma_m.gra/ and
\verb/puma_m.ctl/. The first file contains the data, the latter one
information on the grid, time steps, and variable names. The program
\verb#srv2gra# is one of the postprocessing tools available at
\begin{quote}
\verb#<http://puma.dkrz.de/puma/download/map/>#.
\end{quote}
If you chose to compile it yourself, please read the comments in the
first few lines of the program text.
Sometimes the
\verb/srv2gra/ tool has difficulties to calculate an appropriate time
increment from the date headers of the data records, so you should
check this. In this example the file \verb/puma_m.ctl/ should look like this:
\begin{verbatim}
DSET ^puma_m.gra
UNDEF 9e+09
XDEF     64 LINEAR   0.0000   5.6250
OPTIONS YREV
YDEF     32 LEVELS 
  -85.7606  -80.2688  -74.7445  -69.2130  -63.6786  -58.1430  -52.6065  -47.0696
  -41.5325  -35.9951  -30.4576  -24.9199  -19.3822  -13.8445   -8.3067   -2.7689
    2.7689    8.3067   13.8445   19.3822   24.9199   30.4576   35.9951   41.5325
   47.0696   52.6065   58.1430   63.6786   69.2130   74.7445   80.2688   85.7606
ZDEF  1 LINEAR 1 1
TDEF 12 LINEAR 00:00Z01jan0001        1mo
VARS  3
c139     0 99    139     0     0
c151     0 99    151     0     0
c175     0 99    175     0     0
ENDVARS
\end{verbatim}
Here, the line starting with \verb/TDEF/ ends with \verb/1mo/, since
we are handling monthly mean data. When the \verb/PUMA/ output is used
without averaging, this should correspond to the output interval given
by the \verb#nafter# variable used in the \verb#namelist# of your \verb#PUMA#
run (see section \ref{Namelist}). The number of variables
depends on how the pumaburner was
called. In this example, only 3 variables were processed, i.e.\ the
surface temperature (\verb/c139/), the sea level pressure
(\verb/c151/) and the albedo (\verb/c175/; refer to appendix
\ref{Pumacodes} for a list of codes).
\\
The GrADS program is started by typing \verb/grads/ in a terminal window. Then, data is visualised either by typing commands line-by-line, or, preferably, by using scripts. The following script, called \verb/tglob.gs/, displays the monthly mean surface temperature:
\begin{verbatim}
# tglob.gs
function pass(m)
'reinit'
'open puma_m'
'enable print print.mf'
'set t 'm
'c'
'set gxout shaded'
'd (c139-273.16)'
'cbar.gs'
'set gxout contour'
'd (c139-273.16)'
'draw title Surface Temperature (deg C) month 'm
'print'
'disable print'
'!gxps -i print.mf -o tglob'm'.ps'
\end{verbatim}
The variable \verb/m/ at the beginning of the script defines the month which should be displayed. It is passed from the terminal with the script call. Note that in this line, no quotation marks are present, since only \verb/GrADS/ specific commands are framed by quotation marks. Script commands, like variable definitions, if-clauses etc. are used without quotation marks. The script is executed by typing its name without the ending and the number of the month to be shown. For example, \verb/tglob 7/ displays the monthly mean surface temperature in July. The resulting output file is called \verb/tglob7.ps/. 
\par
\vspace{3mm}
The following script \verb/thh/ displays the time dependent surface temperature of Hamburg. Here, two variables are passed to \verb/GrADS/, the first and last day to plot (note that here, the file \verb/puma.gra/ is opened, which contains data on a daily basis). The call \verb/thh 91 180/ displays the surface temperature of Hamburg for the spring season from April 1st to June 30th.

\begin{verbatim}
# thh.gs
function pass(d1 d2)
'reinit'
'open puma'
'enable print print.mf'
'set lat 53'
'set lon 10'
'set t 'd1' 'd2
'c'
'd (c139-273.16)'
'draw title Surface Temperature (deg C) in Hamburg'
'print'
'disable print'
'!gxps -i print.mf -o thh.ps'
\end{verbatim}

\vspace{3mm}
It is possible to have more than one figure in a plot, which is illustrated in the following script. It plots seasonal means of the sea level pressure. The data file is prepared like this:

\begin{verbatim}
srv selcode,151 puma.srv slp.srv
srv seasmean slp.srv slp_sm.srv
srv2gra slp_sm.srv
\end{verbatim}

The commands \verb/set vpage/ sets virtual pages inside the graphic window. The full window is 11 inch wide and 8.5 inch high, so \verb/set vpage 0 5.5 4.25 8.5/ defines the upper left corner. If \verb/setlevs=1/ is specified, the pressure levels as given are used. Otherwise, \verb/GrADS/ defines contour levels depending on the data set.

\begin{verbatim}
# slp_sm.gs
setlevs=1
'reinit'
'open slp_sm'
'enable print print.mf'
'c'
'set vpage 0 5.5 4.25 8.5'
'set gxout contour'
if (setlevs=1)
'set clevs 990 995 1000 1005 1010 1015 1020'
endif
'set ccols 1'
'set grads off'
'set t 1'
'd c151/100'
'draw title SLP [hPa] yr 'ny' DJF'
'set vpage 5.5 11 4.25 8.5'
'set gxout contour'
if (setlevs=1)
'set clevs 990 995 1000 1005 1010 1015 1020'
endif
'set ccols 1'
'set grads off'
'set t 2'
'd c151/100'
'draw title yr 'ny' MAM'
'set vpage 0 5.5 0 4.25'
'set gxout contour'
if (setlevs=1)
'set clevs 990 995 1000 1005 1010 1015 1020'
endif
'set ccols 1'
'set grads off'
'set t 3'
'd c151/100'
'draw title yr 'ny' JJA'
'set vpage 5.5 11 0 4.25'
'set gxout contour'
if (setlevs=1)
'set clevs 990 995 1000 1005 1010 1015 1020'
endif
'set ccols 1'
'set grads off'
'set t 4'
'd c151/100'
'draw title yr 'ny' SON'
'print'
'disable print'
'!gxps -c -i print.mf -o slp_sm.ps'
\end{verbatim}
back to top