source: palm/trunk/TUTORIAL/SOURCE/ncl.tex @ 1701

Last change on this file since 1701 was 1649, checked in by knoop, 9 years ago

Latex lecture update for PALM seminar in Hong Kong

  • Property svn:keywords set to Id
File size: 18.0 KB
Line 
1%$Id: ncl.tex 1649 2015-09-15 16:34:42Z maronga $
2\input{header_tmp.tex}
3%\input{header_lectures.tex}
4
5\usepackage[utf8]{inputenc}
6\usepackage{ngerman}
7\usepackage{pgf}
8\usepackage{subfigure}
9\usepackage{units}
10\usepackage{multimedia}
11\usepackage{hyperref}
12\newcommand{\event}[1]{\newcommand{\eventname}{#1}}
13\usepackage{xmpmulti}
14\usepackage{tikz}
15\usetikzlibrary{shapes,arrows,positioning}
16\usetikzlibrary{calc}                             %neues paket
17\usetikzlibrary{decorations.markings}             %neues paket
18\usetikzlibrary{decorations.pathreplacing}        %neues paket
19\def\Tiny{\fontsize{4pt}{4pt}\selectfont}
20\usepackage{amsmath}
21\usepackage{amssymb}
22\usepackage{multicol}
23\usepackage{pdfcomment}
24\usepackage{graphicx}
25\usepackage{listings}
26\lstset{showspaces=false,language=fortran,basicstyle=
27        \ttfamily,showstringspaces=false,captionpos=b}
28
29\institute{Institute of Meteorology and Climatology, Leibniz Universit{\"a}t Hannover}
30\selectlanguage{english}
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{PALM group}
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           
70           \begin{center}NCL -- The \textbf{N}CAR \textbf{C}ommand \textbf{L}anguage\end{center}
71      \item<2-> Developed at the NCAR (and continuously updated)
72      \item<2-> Detailed information is available under http://www.ncl.ucar.edu
73      \item<3-> With the information revealed in this talk you will be able to visualize the output of this week's simulations
74   \end{itemize}   
75\end{frame}
76
77% Folie 3
78\begin{frame}
79   \frametitle{What is NCL and Which are its Advantages? (I)}
80   \small
81   \begin{itemize}     
82      \item<1-> Interpreted language designed specifically for scientific
83                data processing and visualization, freely available
84      \item<2-> Portable: it is running on many different operating systems
85                including Linux, Mac OS X, Windows, ...
86      \item<3-> It's a powerful tool for file input and output, visualization and data analysis $\rightarrow$ integrated processing environment
87      \vspace{-0.2cm}
88                  \begin{center}
89                   \onslide<3-> \includegraphics[scale=0.315]{ncl_figures/ncl.png}
90                   \end{center}
91      \end{itemize} 
92
93   
94\end{frame}
95
96% Folie 4
97\begin{frame}
98   \frametitle{What is NCL and Which are its Advantages? (II)}
99   \small
100   \begin{itemize}     
101           \item<1-> Supports calling of C and FORTRAN routines
102           \item<1-> Over 600 functions and procedures for visualization and
103                     data analysis are provided with NCL
104           \item<2-> \textbf{Interactive mode}: \texttt{\$ ncl}\\         
105      \hspace{2.95cm}\texttt{ncl 0> ...}
106      \item<2-> Each line is interpreted as it is entered
107      \item<3-> \textbf{Batch mode}: \texttt{\$ ncl ncl\underline{ }script.ncl}
108      \item<3-> Interpreter of complete scripts, variables within the NCL script can be steered by providing additional parameters with the NCL call:\\
109      \texttt{\$ ncl ncl\underline{ }script.ncl parameter1=value ...}
110       \item<4-> Since NCL is an interpreted language, \textbf{the excessive usage of loops seriously decrease the performance of NCL!}
111   \end{itemize} 
112
113\end{frame}
114
115% Folie 5
116\begin{frame}
117   \frametitle{What is NCL and Which are its Advantages? (III)}
118
119   \begin{itemize}     
120           \item<1-> Complete Programming Language
121           \begin{itemize}   
122              \footnotesize
123              \item<1-> data types (float, double, integer, logical, ...)
124              \item<1-> variables
125              \item<1-> operators
126              \item<1-> expressions
127              \item<1-> loops
128              \item<1-> functions and procedures (e.g., \texttt{dim\_stat4(data\_array)})
129      \end{itemize} 
130           \item<2-> Features
131           \begin{itemize}   
132              \footnotesize
133              \item<2-> manipulate meta data
134              \item<2-> import data in a variety of formats (netCDF, ASCII, ...)
135              \item<2-> array syntax / operations
136              \item<2-> can use user FORTRAN/C codes and commercial libraries
137              \item<2-> most functions/procedures ignore missing data
138      \end{itemize} 
139   \end{itemize} 
140
141\end{frame}
142
143% Folie 6
144\begin{frame}
145   \frametitle{How to Install NCL (Under Linux) (I)?}
146   \small
147   \begin{itemize}     
148      \item<1-> Detailed information is available under:\\
149                \underline{http://www.ncl.ucar.edu/Download/index.shtml}
150      \item<1-> For downloading, request an Earth System Grid account:\\
151                \underline{http://www.earthsystemgrid.org/}
152      \item<2-> Download the appropriate binaries e.g. \texttt{A.tar.gz} 
153                for your system e.g. to \texttt{\$HOME}
154      \item<2-> \texttt{\% gunzip \$HOME/A.tar.gz}
155      \item<2-> \texttt{\% mkdir -p /usr/local}\\
156      \texttt{\% cd /usr/local}\\
157      \texttt{\% tar -xvf \$HOME/A.tar}
158   \end{itemize} 
159
160\end{frame}
161
162% Folie 7
163\begin{frame}
164   \frametitle{How to Install NCL (Under Linux) (II)?}
165   \footnotesize 
166   \begin{itemize}     
167      \item<1-> Set the \texttt{NCARG\underline{ }ROOT} environment variable and
168                your search path to where NCL/NCARG resides:\\
169                csh: \texttt{setenv NCARG\underline{ }ROOT /usr/local/}\\
170                \hspace{1.6em} \texttt{setenv PATH /usr/local/bin:\$PATH}\\
171                bash/ksh: \texttt{export NCARG\underline{ }ROOT=/usr/local/}\\
172                \hspace{4.1em} \texttt{export PATH=/usr/local/bin:\$PATH}\\
173      \vspace{3mm}
174      \item<2-> Set the DISPLAY environment variable to indicate where to
175                display graphics (as for any X11 Windows application that you
176                run):\\
177                ksh: \texttt{export DISPLAY=localhost:13.0}, \\
178                or use \texttt{ssh -X} to tunnel X-communication
179      \vspace{3mm}
180      \item<3-> Test your NCL installation:\\
181                \quad \texttt{\% ng4ex gsun01n}\\
182                The NCL script gsun01n.ncl is copied to your working directory and
183                executed by NCL. An X11 window should pop up.
184   \end{itemize} 
185
186\end{frame}
187
188% Folie 8
189\begin{frame}
190   \frametitle{NCL Scripts Delivered with PALM (I)}
191   \footnotesize 
192   \begin{itemize}     
193      \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:\\
194                \texttt{\$HOME/palm/current\underline{ }version/trunk/SCRIPTS/NCL/}
195      \item<2-> All standard netCDF data output of PALM can be visualized by one
196                of the scripts:
197                \begin{itemize}
198                   \scriptsize
199                   \item[-]<2-> \texttt{cross\underline{ }sections.ncl} 
200                                (contour or vector plots from 2D/3D data)
201                   \item[-]<2-> \texttt{profiles.ncl} (profiles from profiles/3D data)
202                   \item[-]<2-> \texttt{timeseries.ncl} (time series data)
203                   \item[-]<2-> \texttt{spectra.ncl} (spectra data)
204                \end{itemize} 
205      \item<3-> To run these NCL scripts you can use the shell script
206                \texttt{palmplot} which can be found in the directory:\\
207                \texttt{\$HOME/palm/current\underline{ }version/trunk/SCRIPTS}
208      \item<4-> The output of the plots can be changed with several parameters;
209                these parameters can be either written in the prompt
210                (when calling the shell script \texttt{palmplot}) or set
211                within the configuration file \texttt{.ncl.config}
212   \end{itemize} 
213
214\end{frame}
215
216% Folie 9
217\begin{frame}
218   \frametitle{NCL Scripts Delivered with PALM (II)}
219
220   Using \texttt{.ncl.config}:
221   \small
222   \begin{itemize}     
223      \item<1-> Please create a personal configuration file by copying
224                   the default configuration file
225                   \texttt{.ncl.config.default} to the PALM working
226                   directory \texttt{\$HOME/palm/current\underline{ }version}
227                   and naming it \texttt{.ncl.config}
228      \item<2-> \texttt{.ncl.config} is used by NCL directly, thus the
229                   parameters have to be written according to the rules of the
230                   scripting language NCL
231      \item<3-> The configuration file contains all steering parameters with
232                   a short description and can be adjusted to personal needs
233   \end{itemize} 
234
235\end{frame}
236
237% Folie 10
238\begin{frame}
239   \frametitle{NCL Scripts Delivered with PALM (III)}
240
241   Using \texttt{palmplot} (I)
242   \footnotesize
243   \begin{itemize}     
244      \item<1-> The shell script is used as follows:\\
245                   \texttt{palmplot <plot\underline{ }identifier>}
246      \item<1-> \texttt{<plot\underline{ }identifier>} has to be \texttt{xy},
247                   \texttt{xz}, \texttt{yz}, \texttt{pr}, \texttt{sp} or
248                   \texttt{ts} depending on the data to be plotted
249   \end{itemize}     
250   \vspace{3mm}
251   \onslide<2->
252   \begin{center}
253      \begin{tabular}{ccc}
254         \textbf{plot\underline{ }identifier} & \textbf{data used} & \textbf{ncl script}\\
255         xy & xy or 3D data & cross\underline{ }sections.ncl\\
256         xz & xz or 3D data & cross\underline{ }sections.ncl\\
257         yz & yz or 3D data & cross\underline{ }sections.ncl\\
258         pr & profile or 3D data & profiles.ncl\\
259         sp & spectra data & spectra.ncl\\
260         ts & time series data & timeseries.ncl\\ 
261   \end{tabular}
262   \end{center}
263
264\end{frame}
265
266% Folie 11
267\begin{frame}
268   \frametitle{NCL Scripts Delivered with PALM (IV)}
269
270   Using \texttt{palmplot} (II)
271   \footnotesize
272   \begin{itemize}     
273      \item<1-> To change the output of the plot you can also use the prompt:\\
274                   \scriptsize 
275                   \texttt{palmplot \textbf{plot\underline{ }identifier} 
276                   parameter=value parameter='string' ...} 
277      \footnotesize \\
278      \vspace{2mm}
279      \item<2-> A list of all available parameters can be found in the
280                   configuration file \texttt{.ncl.config} or in the
281                   documentation:\\
282                   \uncover<3->{\texttt{http://palm.muk.uni-hannover.de/trac/wiki/doc/app/nclparlist}}\\
283      \vspace{2mm}
284      \item<4-> Parameters specified in the prompt override parameters given
285                   in the configuration file\\
286      \vspace{2mm}
287      \item<5-> String parameters which can contain lists (\texttt{var},
288                   \texttt{c\underline{ }var}, \texttt{vec1}, \texttt{vec2},
289                   \texttt{plotvec}) have to be set in single quotes and the
290                   list itself has to be separated by blanks, e.g.
291                   \texttt{var='pt u w'}\\
292      \vspace{2mm}
293      \item<6-> A short introduction for using the shell script is given by
294                   typing\\
295                   \texttt{palmplot ?}
296   \end{itemize}     
297
298\end{frame}
299
300% Folie 12
301\begin{frame}
302   \frametitle{Application Example: Visualization of the Output of the Example
303               Run (example\underline{ }cbl) (I)}
304   \small
305   \begin{itemize}     
306      \item<1-> Starting the example run with the command\\
307                \vspace{2mm}
308                \hspace{0.5cm}\texttt{mrun -d example\underline{ }cbl ... -r
309                        'd3\# pr\# ts\# xy\# xz\#'}\\
310                \vspace{2mm}
311                results in the following output files
312               
313                \hspace{0.5cm}\texttt{example\underline{ }cbl\underline{ }pr.nc}, \texttt{example\underline{ }cbl\underline{ }xy.nc},\\
314                 \hspace{0.5cm}\texttt{example\underline{ }cbl\underline{ }xz.nc}, \texttt{example\underline{ }cbl\underline{ }ts.nc}
315               
316                located in
317               
318                \hspace{0.5cm}\texttt{\$HOME/palm/current\underline{ }version/JOBS/example\underline{ }cbl/OUTPUT/}
319
320               
321      \item<2-> Example: Visualization of time series data\\
322                \vspace{2mm}
323       \item<3-> Goal: Output the eps-file \texttt{timeseries.eps} (by default the
324                plot would be output to an X11 window)
325   \end{itemize}     
326
327\end{frame}
328
329% Folie 13
330\begin{frame}
331   \frametitle{Application Example: Visualization of the Output of the Example
332               Run (example\underline{ }cbl) (II)}
333   \small
334   \begin{itemize}     
335      \item<1-> In order to reach the goal you can either ...
336      \item<1-> ... change to the directory\\
337                \texttt{\$HOME/palm/current\underline{ }version/JOBS/example\underline{ }cbl/OUTPUT/}\\
338                and use the shell script with the command:\\
339                \hspace{0.5cm}\texttt{palmplot ts file\underline{ }1=example\underline{ }cbl\underline{ }ts.nc format\underline{ }out=eps}\\ 
340                \hspace{0.5cm}\texttt{file\underline{ }out=timeseries}\\
341                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, e.\,g.,\\
342                \onslide<2-> \hspace{0.5cm}\texttt{file\underline{ }1 = <netCDF file> file\underline{ }out = <output file>}
343   \end{itemize}     
344
345\end{frame}
346
347% Folie 14
348\begin{frame}
349   \frametitle{Application Example: Visualization of the Output of the Example
350               Run (example\underline{ }cbl) (III)}
351   \footnotesize
352   \begin{itemize}
353   \item<1-> ... or you can modify the configuration file \texttt{.ncl.config}, e.\,g.,\\
354   \vspace{2mm}
355   \texttt{if(.not. isvar(\dq file\underline{ }1\dq))then}\\
356   \quad \quad \texttt{file\underline{ }1 = \dq File in\dq}\\
357   \texttt{end if}\\
358   \vspace{2mm}
359   \onslide<2-> has to be changed to\\
360   \vspace{2mm}
361\texttt{if(.not. isvar(\dq file\underline{ }1\dq))then}\\
362   \quad \quad \texttt{file\underline{ }1 = \dq \$HOME/palm/current\underline{ }version/JOBS/...}\\
363   \hspace{+2.3cm}\texttt{...example\underline{ }cbl/OUTPUT/example\underline{ }cbl\underline{ }ts.nc\dq}\\
364   \texttt{end if}
365\end{itemize}
366\end{frame}
367
368% Folie 15
369\begin{frame}
370   \frametitle{Application Example: Visualization of the Output of the Example
371               Run (example\underline{ }cbl) (IV)}
372   \footnotesize
373   \begin{itemize}
374      \item<1-> Both ways will create a new file called \texttt{timeseries.eps} 
375                in the directory\\
376               \texttt{\$HOME/palm/current\underline{ }version/JOBS/example\underline{ }cbl/OUTPUT/}
377   \end{itemize}
378   \centering
379   \onslide<2->\includegraphics[scale=0.23]{ncl_figures/vis1.png}
380   
381\end{frame}
382
383% Folie 16
384\begin{frame}
385   \frametitle{Application Example: Visualization of the Output of the Example
386               Run (example\underline{ }cbl) (V)}
387   \footnotesize
388   \begin{itemize}
389      \item<1-> If you only want to get the plot of the time series of just 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.,\\
390      \vspace{2mm}
391      \texttt{if(.not. isvar(\dq var\dq ))then}\\
392      \quad \quad \texttt{var = \dq ,umax,\dq }\\       
393      \texttt{end if}
394   \end{itemize}
395   \vspace{+0.2cm}
396   \centering
397   \onslide<2->\includegraphics[scale=0.3]{ncl_figures/vis2.png}
398   
399\end{frame}
400
401% Folie 17
402\begin{frame}[t]
403   \tikzstyle{plain} = [rectangle, text width=0.27\textwidth, font=\small]
404   \frametitle{Application Example: Visualization of the Output of the Example
405               Run (example\underline{ }cbl) (VI)}
406   %\footnotesize
407   \begin{itemize}
408   \item Plot profiles with the command\\
409   \quad \texttt{palmplot pr}\\
410   \quad \texttt{file\underline{ }1=example\underline{ }cbl\underline{ }pr.nc}
411   \item Profiles of same dimension are\\ 
412            plotted together, e.\,g., total, \\
413            resolved and sub-grid scale \\
414            temperature flux (default)
415    \item If you add the parameter \\
416            \texttt{var='all'} to the command,\\
417            all profiles are plotted separately
418   \end{itemize}
419   \begin{tikzpicture}[remember picture, overlay]
420      \node at (current page.north west){%
421      \begin{tikzpicture}[overlay]
422         \node[plain,anchor=west] at (72mm,-51.5mm)
423              {\includegraphics[scale=0.32]{ncl_figures/vis3.png}};
424      \end{tikzpicture}
425      };
426   \end{tikzpicture}
427   
428\end{frame}
429
430% Folie 18
431\begin{frame}
432   \frametitle{More Comments}
433   \footnotesize
434   \begin{itemize}     
435      \item<1-> The other NCL scripts delivered with PALM can be used in
436                a similar way, however the parameters that can be specified
437                differ from script to script
438      \item<2-> There are plenty of parameters for each script. Please have a
439                look to the NCL documentation\\
440               
441                \quad \texttt{http://palm.muk.uni-hannover.de/trac/wiki/doc/app/nclparlist}\\
442               
443                for detailed information
444      \item<3-> If one of the programs aborts and there is no comment,
445                check the configuration file! The scripts should not abort with
446                default values. Be sure to use the right data type
447                (e.\,g., \texttt{integer = 2}, \texttt{float = 2.0}, \texttt{double = 2.0d},
448                \texttt{string = \dq name\dq})!
449   \end{itemize}   
450\end{frame}
451
452
453
454
455
456
457
458
459\end{document}
Note: See TracBrowser for help on using the repository browser.