1 | %$Id: ncl.tex 1080 2012-12-13 13:39:39Z fricke $ |
---|
2 | \input{header_tmp.tex} |
---|
3 | %\input{../header_lectures.tex} |
---|
4 | |
---|
5 | \usepackage[utf8]{inputenc} |
---|
6 | \usepackage{ngerman} |
---|
7 | \usepackage{pgf} |
---|
8 | \usetheme{Dresden} |
---|
9 | \usepackage{subfigure} |
---|
10 | \usepackage{units} |
---|
11 | \usepackage{multimedia} |
---|
12 | \usepackage{hyperref} |
---|
13 | \newcommand{\event}[1]{\newcommand{\eventname}{#1}} |
---|
14 | \usepackage{xmpmulti} |
---|
15 | \usepackage{tikz} |
---|
16 | \usetikzlibrary{shapes,arrows,positioning} |
---|
17 | \usetikzlibrary{calc} %neues paket |
---|
18 | \usetikzlibrary{decorations.markings} %neues paket |
---|
19 | \usetikzlibrary{decorations.pathreplacing} %neues paket |
---|
20 | \def\Tiny{\fontsize{4pt}{4pt}\selectfont} |
---|
21 | \usepackage{amsmath} |
---|
22 | \usepackage{amssymb} |
---|
23 | \usepackage{multicol} |
---|
24 | \usepackage{pdfcomment} |
---|
25 | \usepackage{graphicx} |
---|
26 | \usepackage{listings} |
---|
27 | \lstset{showspaces=false,language=fortran,basicstyle= |
---|
28 | \ttfamily,showstringspaces=false,captionpos=b} |
---|
29 | |
---|
30 | \institute{Institut fÌr Meteorologie und Klimatologie, Leibniz UniversitÀt Hannover} |
---|
31 | \date{last update: \today} |
---|
32 | \event{PALM Seminar} |
---|
33 | \setbeamertemplate{navigation symbols}{} |
---|
34 | |
---|
35 | \setbeamertemplate{footline} |
---|
36 | { |
---|
37 | \begin{beamercolorbox}[rightskip=-0.1cm]& |
---|
38 | {\includegraphics[height=0.65cm]{imuk_logo.pdf}\hfill \includegraphics[height=0.65cm]{luh_logo.pdf}} |
---|
39 | \end{beamercolorbox} |
---|
40 | \begin{beamercolorbox}[ht=2.5ex,dp=1.125ex, |
---|
41 | leftskip=.3cm,rightskip=0.3cm plus1fil]{title in head/foot} |
---|
42 | {\leavevmode{\usebeamerfont{author in head/foot}\insertshortauthor} \hfill \eventname \hfill \insertframenumber \; / \inserttotalframenumber} |
---|
43 | \end{beamercolorbox} |
---|
44 | \begin{beamercolorbox}[colsep=1.5pt]{lower separation line foot} |
---|
45 | \end{beamercolorbox} |
---|
46 | } |
---|
47 | %\logo{\includegraphics[width=0.3\textwidth]{luhimuk_logo.pdf}} |
---|
48 | |
---|
49 | \title[Introduction to NCL]{Introduction to NCL} |
---|
50 | \author{Siegfried Raasch} |
---|
51 | |
---|
52 | \begin{document} |
---|
53 | |
---|
54 | % Folie 1 |
---|
55 | \begin{frame} |
---|
56 | \titlepage |
---|
57 | \end{frame} |
---|
58 | |
---|
59 | \section{Introduction to NCL} |
---|
60 | \subsection{Introduction to NCL} |
---|
61 | |
---|
62 | % Folie 2 |
---|
63 | \begin{frame} |
---|
64 | \frametitle{Visualization of PALM Output Data} |
---|
65 | \small |
---|
66 | \begin{itemize} |
---|
67 | \item<1-> There are several ways how you can visualize netCDF data |
---|
68 | \item<1-> If you are lacking experience in the visualization of netCDF data or if you have not yet found your favourite way how to visualize netCDF data, here is one recommendation: |
---|
69 | \item<2-> NCL â The \textbf{N}CAR \textbf{C}ommand \textbf{L}anguage |
---|
70 | \item<2-> Developed by the Computational \& Information Systems Laboratory at the NCAR (continuously updated) |
---|
71 | \item<2-> Detailed information is available under http://www.ncl.ucar.edu |
---|
72 | \item<3-> With the information revealed in this talk you will be able to visualize the output of this week's simulations |
---|
73 | \end{itemize} |
---|
74 | \end{frame} |
---|
75 | |
---|
76 | % Folie 3 |
---|
77 | \begin{frame} |
---|
78 | \frametitle{What is NCL and Which are its Advantages? (I)} |
---|
79 | \small |
---|
80 | \begin{itemize} |
---|
81 | \item<1-> Interpreted language designed specifically for scientific data processing and visualization, free available |
---|
82 | \item<2-> Portable: it is running on many different operating systems including Solaris, AIX, IRIX, Linux, MacOSX, DecAlpha, Cygwin/Windows |
---|
83 | \item<3-> It's a powerful tool for file input and output, visualization and data analysis (but please \textbf{avoid the excessive usage of loops}, as NCL is an interpreted language) $\rightarrow$ integrated processing environment |
---|
84 | \end{itemize} |
---|
85 | \centering |
---|
86 | \onslide<3-> \includegraphics[scale=0.28]{ncl_figures/ncl.png} |
---|
87 | |
---|
88 | \end{frame} |
---|
89 | |
---|
90 | % Folie 4 |
---|
91 | \begin{frame} |
---|
92 | \frametitle{What is NCL and Which are its Advantages? (II)} |
---|
93 | \small |
---|
94 | \begin{itemize} |
---|
95 | \item<1-> Supports calling C and FORTRAN extended routines |
---|
96 | \item<1-> Over 600 functions and procedures for visualization and data analysis are provided with NCL |
---|
97 | \item<2-> Interactive mode: \texttt{\$ ncl}\\ |
---|
98 | \texttt{ncl 0>} |
---|
99 | \item<3-> each line is interpreted as it is entered |
---|
100 | \item<1-> Batch mode: \texttt{\$ ncl ncl\underline{ }script.ncl}\\ |
---|
101 | interpreter of complete scripts, variables within the NCL script can\\ |
---|
102 | be steered by providing additional parameters with the ncl call\\ |
---|
103 | \texttt{\$ ncl ncl\underline{ }script.ncl parameter1=value} |
---|
104 | \texttt{'parameter2=\dq string\dq ' ...} |
---|
105 | \end{itemize} |
---|
106 | |
---|
107 | \end{frame} |
---|
108 | |
---|
109 | % Folie 5 |
---|
110 | \begin{frame} |
---|
111 | \frametitle{What is NCL and Which are its Advantages? (III)} |
---|
112 | |
---|
113 | \begin{itemize} |
---|
114 | \item<1-> Complete Programming Language |
---|
115 | \begin{itemize} |
---|
116 | \footnotesize |
---|
117 | \item<1-> data types |
---|
118 | \item<1-> variables |
---|
119 | \item<1-> operators |
---|
120 | \item<1-> expressions |
---|
121 | \item<1-> loops |
---|
122 | \item<1-> functions/procedures/graphics |
---|
123 | \end{itemize} |
---|
124 | \item<2-> Features |
---|
125 | \begin{itemize} |
---|
126 | \footnotesize |
---|
127 | \item<2-> query / manipulate meta data |
---|
128 | \item<2-> import data in a variety of formats |
---|
129 | \item<2-> array syntax / operations |
---|
130 | \item<2-> can use user FORTRAN/C codes and commercial libraries |
---|
131 | \item<2-> most functions/procedures ignore missing data |
---|
132 | \end{itemize} |
---|
133 | \end{itemize} |
---|
134 | |
---|
135 | \end{frame} |
---|
136 | |
---|
137 | % Folie 6 |
---|
138 | \begin{frame} |
---|
139 | \frametitle{How to Install NCL (Under Linux) (I)?} |
---|
140 | \small |
---|
141 | \begin{itemize} |
---|
142 | \item<1-> Detailed information is available under\\ |
---|
143 | \underline{http://www.ncl.ucar.edu/Download/index.shtml} |
---|
144 | \item<1-> Request an Earth System Grid account |
---|
145 | \underline{http://www.earthsystemgrid.org/} |
---|
146 | \item<2-> Download the appropriate binaries e.g. \texttt{A.tar.gz} for your system e.g. to \texttt{\$HOME} |
---|
147 | \item<2-> \texttt{\% gunzip \$HOME/A.tar.gz} |
---|
148 | \item<2-> \texttt{\% mkdir -p /usr/local}\\ |
---|
149 | \quad \texttt{\% cd /usr/local}\\ |
---|
150 | \quad \texttt{\% tar -xvf \$HOME/A.tar} |
---|
151 | \end{itemize} |
---|
152 | |
---|
153 | \end{frame} |
---|
154 | |
---|
155 | % Folie 7 |
---|
156 | \begin{frame} |
---|
157 | \frametitle{How to Install NCL (Under Linux) (II)?} |
---|
158 | \footnotesize |
---|
159 | \begin{itemize} |
---|
160 | \item<1-> Set the \texttt{NCARG\underline{ }ROOT} environment variable and your search path to where NCL/NCARG resides\\ |
---|
161 | csh: \texttt{setenv NCARG\underline{ }ROOT /usr/local/}\\ |
---|
162 | \hspace{1.6em} \texttt{setenv PATH /usr/local/bin:\$PATH}\\ |
---|
163 | bash/ksh: \texttt{export NCARG\underline{ }ROOT=/usr/local/}\\ |
---|
164 | \hspace{4.1em} \texttt{export PATH=/usr/local/bin:\$PATH}\\ |
---|
165 | \vspace{3mm} |
---|
166 | \item<2-> Set the DISPLAY environment variable to indicate where to display graphics as for any X11 Windows application that you run\\ |
---|
167 | e.g. ksh: \texttt{export DISPLAY=localhost:13.0}, or use \texttt{ssh -X} to tunnel X-communication.\\ |
---|
168 | \vspace{3mm} |
---|
169 | \item<3-> Test your NCL installation\\ |
---|
170 | \quad \texttt{\% ng4ex gsun01}\\ |
---|
171 | NCL script gsun01n.ncl is copied to your working directory and run through NCL. An X11 window should pop up. |
---|
172 | \end{itemize} |
---|
173 | |
---|
174 | \end{frame} |
---|
175 | |
---|
176 | % Folie 8 |
---|
177 | \begin{frame} |
---|
178 | \frametitle{NCL Scripts Delivered with PALM (I)} |
---|
179 | \footnotesize |
---|
180 | \begin{itemize} |
---|
181 | \item<1-> Together with the PALM installation you have also received four NCL scripts, a configuration file and a manual; they can be found in the directory\\ |
---|
182 | \texttt{\$HOME/palm/current\underline{ }version/trunk/SCRIPTS/NCL/} |
---|
183 | \item<2-> All standard netCDF data output of PALM can be visualized by one of the scripts: |
---|
184 | \begin{itemize} |
---|
185 | \scriptsize |
---|
186 | \item[-]<2-> \texttt{cross\underline{ }sections.ncl} (2D/3D data, e.g. contour or vector plots) |
---|
187 | \item[-]<2-> \texttt{profiles.ncl} (profile data) |
---|
188 | \item[-]<2-> \texttt{timeseries.ncl} (time series data) |
---|
189 | \item[-]<2-> \texttt{spectra.ncl} (spectra data) |
---|
190 | \end{itemize} |
---|
191 | \item<3-> To run these NCL scripts you can use the shell script \texttt{palmplot} which can be found in the directory\\ |
---|
192 | \texttt{\$HOME/palm/current\underline{ }version/trunk/SCRIPTS} |
---|
193 | \item<4-> The output of the plots can be changed with several parameters; these parameters can be either written in the prompt (when calling the shell script \texttt{palmplot}) or modified within the configuration file \texttt{.ncl.config} |
---|
194 | \end{itemize} |
---|
195 | |
---|
196 | \end{frame} |
---|
197 | |
---|
198 | % Folie 9 |
---|
199 | \begin{frame} |
---|
200 | \frametitle{NCL Scripts Delivered with PALM (II)} |
---|
201 | |
---|
202 | Using \texttt{.ncl.config} |
---|
203 | \small |
---|
204 | \begin{itemize} |
---|
205 | \item[-]<1-> Please create a personal configuration file by copying the default configuration file \texttt{.ncl.config.default} to the PALM working directory \texttt{\$HOME/palm/current\underline{ }version} and naming it \texttt{.ncl.config} |
---|
206 | \item[-]<2-> \texttt{.ncl.config} is used by NCL directly, thus the parameters have to be written according to the rules of the scripting language NCL |
---|
207 | \item[-]<3-> The configuration file contains all steering parameters with a short description and can be modified to personal needs |
---|
208 | \end{itemize} |
---|
209 | |
---|
210 | \end{frame} |
---|
211 | |
---|
212 | % Folie 10 |
---|
213 | \begin{frame} |
---|
214 | \frametitle{NCL Scripts Delivered with PALM (III)} |
---|
215 | |
---|
216 | Using \texttt{palmplot} (I) |
---|
217 | \footnotesize |
---|
218 | \begin{itemize} |
---|
219 | \item[-]<1-> The shell script is used as follows:\\ |
---|
220 | \texttt{palmplot <plot\underline{ }identifier>} |
---|
221 | \item[-]<1-> \texttt{<plot\underline{ }identifier>} has to be \texttt{xy}, \texttt{xz}, \texttt{yz}, \texttt{pr}, \texttt{sp} or \texttt{ts} depending on the data to be plotted |
---|
222 | \end{itemize} |
---|
223 | \vspace{3mm} |
---|
224 | \onslide<2->\begin{tabular}{ccc} |
---|
225 | \textbf{plot\underline{ }identifier} & \textbf{data used} & \textbf{ncl script}\\ |
---|
226 | xy & instantaneous or time-averaged xy or 3D data & cross\underline{ }sections.ncl\\ |
---|
227 | xz & instantaneous or time-averaged xz or 3D data & cross\underline{ }sections.ncl\\ |
---|
228 | yz & instantaneous or time-averaged yz or 3D data & cross\underline{ }sections.ncl\\ |
---|
229 | pr & profile or 3D data & profiles.ncl\\ |
---|
230 | sp & spectra data & spectra.ncl\\ |
---|
231 | ts & time series data & timeseries.ncl\\ |
---|
232 | \end{tabular} |
---|
233 | |
---|
234 | \end{frame} |
---|
235 | |
---|
236 | % Folie 11 |
---|
237 | \begin{frame} |
---|
238 | \frametitle{NCL Scripts Delivered with PALM (IV)} |
---|
239 | |
---|
240 | Using \texttt{palmplot} (II) |
---|
241 | \footnotesize |
---|
242 | \begin{itemize} |
---|
243 | \item[-]<1-> To change the output of the plot you can also use:\\ |
---|
244 | \scriptsize \texttt{palmplot \textbf{plot\underline{ }identifier} parameter=value parameter=string ...} |
---|
245 | \footnotesize \\ |
---|
246 | \vspace{2mm} |
---|
247 | \item[-]<2-> A list of all available parameters can be found in the configuration file \texttt{.ncl.config} or in the documentation:\\ |
---|
248 | \uncover<3->{\texttt{http://palm.muk.uni-hannover.de/wiki/doc/app/nclparlist}}\\ |
---|
249 | \vspace{2mm} |
---|
250 | \item[-]<4-> Parameters specified in the prompt override parameters given in the configuration file\\ |
---|
251 | \vspace{2mm} |
---|
252 | \item[-]<5-> String parameters which can contain lists (\texttt{var}, \texttt{c\underline{ }var}, \texttt{vec1}, \texttt{vec2}, \texttt{plotvec}) have to be set in single quotes and the list itself has to be separated by blanks, e.g. \texttt{var='pt u w'}\\ |
---|
253 | \vspace{2mm} |
---|
254 | \item[-]<1-> A short introduction for using the shell script is given by typing\\ |
---|
255 | \texttt{palmplot ?} |
---|
256 | \end{itemize} |
---|
257 | |
---|
258 | \end{frame} |
---|
259 | |
---|
260 | % Folie 12 |
---|
261 | \begin{frame} |
---|
262 | \frametitle{Application Example: Visualization of the Output of the Example Run (example\underline{ }cbl) (I)} |
---|
263 | \small |
---|
264 | \begin{itemize} |
---|
265 | \item<1-> Starting the example run with the command\\ |
---|
266 | \vspace{2mm} |
---|
267 | \texttt{mrun -d example\underline{ }cbl ... -r 'd3\# pr\# ts\# xy\# xz\#'}\\ |
---|
268 | \vspace{2mm} |
---|
269 | results in the following output files in\\ |
---|
270 | \vspace{2mm} |
---|
271 | \texttt{\$HOME/palm/current\underline{ }version/JOBS/example\underline{ }cbl/OUTPUT/}:\\ |
---|
272 | \texttt{example\underline{ }cbl\underline{ }pr.nc}, \texttt{example\underline{ }cbl\underline{ }xy.nc}, \texttt{example\underline{ }cbl\underline{ }xz.nc},\\ |
---|
273 | \texttt{example\underline{ }cbl\underline{ }ts.nc} |
---|
274 | \item<2-> Example: Visualization of the time series data\\ |
---|
275 | \vspace{2mm} |
---|
276 | Goal: Output as eps-file \texttt{timeseries.eps} (by default the plot would be output to an X11 window) |
---|
277 | \end{itemize} |
---|
278 | |
---|
279 | \end{frame} |
---|
280 | |
---|
281 | % Folie 13 |
---|
282 | \begin{frame} |
---|
283 | \frametitle{Application Example: Visualization of the Output of the Example Run (example\underline{ }cbl) (II)} |
---|
284 | \small |
---|
285 | \begin{itemize} |
---|
286 | \item<1-> In order to reach the goal you can either ... |
---|
287 | \item<1-> ... Change to the directory\\ |
---|
288 | \texttt{\$HOME/palm/current\underline{ }version/JOBS/example\underline{ }cbl/OUTPUT/}\\ |
---|
289 | and use the shell script with the command\\ |
---|
290 | \vspace{2mm} |
---|
291 | \texttt{palmplot ts file\underline{ }1=example\underline{ }cbl\underline{ }ts.nc format\underline{ }out=eps file\underline{ }out=timeseries}\\ |
---|
292 | \vspace{2mm} |
---|
293 | Thus, the script \texttt{timeseries.ncl} is called and some of the parameters in the configuration file \texttt{.ncl.config} are directly set by specifying the related parameters in the command line,\\ |
---|
294 | \vspace{2mm} |
---|
295 | \onslide<2-> e.g. \texttt{file\underline{ }1 = <netCDF file>} \textbf{(Note: the input file has always to be specified!)}, \texttt{file\underline{ }out = <output file>} |
---|
296 | \end{itemize} |
---|
297 | |
---|
298 | \end{frame} |
---|
299 | |
---|
300 | % Folie 14 |
---|
301 | \begin{frame} |
---|
302 | \frametitle{Application Example: Visualization of the Output of the Example Run (example\underline{ }cbl) (III)} |
---|
303 | \footnotesize |
---|
304 | ... or you can modify the configuration file \texttt{.ncl.config}, e.g.\\ |
---|
305 | \vspace{2mm} |
---|
306 | \texttt{if(.not. isvar(\dq file\underline{ }1\dq))then}\\ |
---|
307 | \quad \quad \texttt{file\underline{ }1 = \dq File in\dq}\\ |
---|
308 | \texttt{end if}\\ |
---|
309 | \vspace{2mm} |
---|
310 | \onslide<2-> has to be changed to\\ |
---|
311 | \vspace{2mm} |
---|
312 | \texttt{if(.not. isvar(\dq file\underline{ }1\dq))then}\\ |
---|
313 | \quad \quad \texttt{file\underline{ }1 = \dq \$HOME/palm/current\underline{ }version/JOBS/example\underline{ }cbl/OUTPUT/example\underline{ }cbl\underline{ }ts.nc\dq}\\ |
---|
314 | \texttt{end if} |
---|
315 | |
---|
316 | \end{frame} |
---|
317 | |
---|
318 | % Folie 15 |
---|
319 | \begin{frame} |
---|
320 | \frametitle{Application Example: Visualization of the Output of the Example Run (example\underline{ }cbl) (IV)} |
---|
321 | \footnotesize |
---|
322 | \begin{itemize} |
---|
323 | \item<1-> Both ways will lead to the creation of a new file called \texttt{timeseries.eps} in the directory\\ |
---|
324 | \texttt{\$HOME/palm/current\underline{ }version/JOBS/example\underline{ }cbl/OUTPUT/} |
---|
325 | \end{itemize} |
---|
326 | \centering |
---|
327 | \onslide<2->\includegraphics[scale=0.4]{ncl_figures/vis1.png} |
---|
328 | |
---|
329 | \end{frame} |
---|
330 | |
---|
331 | % Folie 16 |
---|
332 | \begin{frame} |
---|
333 | \frametitle{Application Example: Visualization of the Output of the Example Run (example\underline{ }cbl) (V)} |
---|
334 | \footnotesize |
---|
335 | \begin{itemize} |
---|
336 | \item<1-> If you only want to get the plot of the time series of one variable, e.g. the maximum of the velocity component u, you can add the command line parameter \texttt{var='umax'} or modify the configuration file respectively, e.g.\\ |
---|
337 | \vspace{2mm} |
---|
338 | \texttt{if(.not. isvar(\dq var\dq ))then}\\ |
---|
339 | \quad \quad \texttt{var = \dq ,umax,\dq }\\ |
---|
340 | \texttt{end if} |
---|
341 | \end{itemize} |
---|
342 | \centering |
---|
343 | \onslide<2->\includegraphics[scale=0.7]{ncl_figures/vis2.png} |
---|
344 | |
---|
345 | \end{frame} |
---|
346 | |
---|
347 | % Folie 17 |
---|
348 | \begin{frame}[t] |
---|
349 | \tikzstyle{plain} = [rectangle, text width=0.27\textwidth, font=\small] |
---|
350 | \frametitle{Application Example: Visualization of the Output of the Example Run (example\underline{ }cbl) (VI)} |
---|
351 | \footnotesize |
---|
352 | Plot profiles with the command\\ |
---|
353 | \quad \texttt{palmplot pr file\underline{ }1=example\underline{ }cbl\underline{ }pr.nc}\\ |
---|
354 | \vspace{3mm} |
---|
355 | Profiles of same dimension are plotted\\ |
---|
356 | together, e.g. total, resolved and\\ |
---|
357 | subgridscale temperature flux (default)\\ |
---|
358 | \vspace{3mm} |
---|
359 | (This composition is written to the\\ |
---|
360 | NetCDF header by the \texttt{d3par}\\ |
---|
361 | parameter \texttt{cross\underline{ }profiles})\\ |
---|
362 | \vspace{3mm} |
---|
363 | If you add the parameter var=all to\\ |
---|
364 | the command, all profiles will be plotted\\ |
---|
365 | separately |
---|
366 | \begin{tikzpicture}[remember picture, overlay] |
---|
367 | \node at (current page.north west){% |
---|
368 | \begin{tikzpicture}[overlay] |
---|
369 | \node[plain,anchor=west] at (72mm,-51.5mm) {\includegraphics[scale=0.32]{ncl_figures/vis3.png}}; |
---|
370 | \end{tikzpicture} |
---|
371 | }; |
---|
372 | \end{tikzpicture} |
---|
373 | |
---|
374 | \end{frame} |
---|
375 | |
---|
376 | % Folie 18 |
---|
377 | \begin{frame} |
---|
378 | \frametitle{More Comments} |
---|
379 | \small |
---|
380 | \begin{itemize} |
---|
381 | \item<1-> The other NCL scripts delivered with PALM can be used in a similar way, however the parameters that can be specified differ from script to script |
---|
382 | \item<2-> There are plenty of parameters for each script. Please have a look to the NCL documentation (\texttt{http://palm.muk.uni-hannover.de/wiki/doc/app/nclparlist}) for detailed information |
---|
383 | \item<1-> If one of the program aborts and there is no comment, check the configuration file - the scripts should not abort with the default values. Be sure to use the right data type (e.g.: integer = 2; float = 2.0; double = 2.0d; string = \dq name\dq ) |
---|
384 | \end{itemize} |
---|
385 | \end{frame} |
---|
386 | |
---|
387 | |
---|
388 | |
---|
389 | |
---|
390 | |
---|
391 | |
---|
392 | |
---|
393 | |
---|
394 | \end{document} |
---|