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

Last change on this file since 1520 was 1515, checked in by boeske, 10 years ago

several updates in the tutorial

  • Property svn:keywords set to Id
File size: 17.7 KB
RevLine 
[1080]1%$Id: ncl.tex 1515 2015-01-02 11:35:51Z hoffmann $
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}     
[1515]81      \item<1-> Interpreted language designed specifically for scientific
82                data processing and visualization, freely available
83      \item<2-> Portable: it is running on many different operating systems
84                including AIX, Linux, MacOSX, Cygwin/Windows
85      \item<3-> It's a powerful tool for file input and output, visualization
86                and data analysis (but please \textbf{avoid the excessive usage
87                of loops}, as NCL is an interpreted language) $\rightarrow$ 
88                integrated processing environment
[1080]89   \end{itemize} 
90   \centering
91   \onslide<3-> \includegraphics[scale=0.28]{ncl_figures/ncl.png}
92   
93\end{frame}
94
95% Folie 4
96\begin{frame}
97   \frametitle{What is NCL and Which are its Advantages? (II)}
98   \small
99   \begin{itemize}     
100           \item<1-> Supports calling C and FORTRAN extended routines
[1515]101           \item<1-> Over 600 functions and procedures for visualization and
102                     data analysis are provided with NCL
[1080]103           \item<2-> Interactive mode: \texttt{\$ ncl}\\
104      \texttt{ncl 0>}
105      \item<3-> each line is interpreted as it is entered
[1515]106      \item<4-> Batch mode: \texttt{\$ ncl ncl\underline{ }script.ncl}\\
[1080]107      interpreter of complete scripts, variables within the NCL script can\\
108      be steered by providing additional parameters with the ncl call\\
109      \texttt{\$ ncl ncl\underline{ }script.ncl parameter1=value}
110      \texttt{'parameter2=\dq string\dq ' ...}
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
124              \item<1-> variables
125              \item<1-> operators
126              \item<1-> expressions
127              \item<1-> loops
128              \item<1-> functions/procedures/graphics
129      \end{itemize} 
130           \item<2-> Features
131           \begin{itemize}   
132              \footnotesize
133              \item<2-> query / manipulate meta data
134              \item<2-> import data in a variety of formats
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}     
[1515]148      \item<1-> Detailed information is available under\\
149                \underline{http://www.ncl.ucar.edu/Download/index.shtml}
150      \item<1-> 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}
[1080]154      \item<2-> \texttt{\% gunzip \$HOME/A.tar.gz}
155      \item<2-> \texttt{\% mkdir -p /usr/local}\\
156      \quad \texttt{\% cd /usr/local}\\
157      \quad \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}     
[1515]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}\\
[1080]173      \vspace{3mm}
[1515]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                e.g. ksh: \texttt{export DISPLAY=localhost:13.0}, or use
178                \texttt{ssh -X} to tunnel X-communication.\\
179      \vspace{3mm}
[1080]180      \item<3-> Test your NCL installation\\
[1515]181                \quad \texttt{\% ng4ex gsun01}\\
182                NCL script gsun01n.ncl is copied to your working directory and
183                run through NCL. An X11 window should pop up.
[1080]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}     
[1515]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                                (2D/3D data, e.g. contour or vector plots)
201                   \item[-]<2-> \texttt{profiles.ncl} (profile 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}
[1080]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}     
[1515]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
[1080]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}     
[1515]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
[1080]249   \end{itemize}     
250   \vspace{3mm}
[1515]251   \onslide<2->
252      \begin{tabular}{ccc}
253         \textbf{plot\underline{ }identifier} & \textbf{data used} & \textbf{ncl script}\\
254         xy & instantaneous or time-averaged xy or 3D data & cross\underline{ }sections.ncl\\
255         xz & instantaneous or time-averaged xz or 3D data & cross\underline{ }sections.ncl\\
256         yz & instantaneous or time-averaged yz or 3D data & cross\underline{ }sections.ncl\\
257         pr & profile or 3D data & profiles.ncl\\
258         sp & spectra data & spectra.ncl\\
259         ts & time series data & timeseries.ncl\\ 
[1080]260   \end{tabular}
261
262\end{frame}
263
264% Folie 11
265\begin{frame}
266   \frametitle{NCL Scripts Delivered with PALM (IV)}
267
268   Using \texttt{palmplot} (II)
269   \footnotesize
270   \begin{itemize}     
[1515]271      \item[-]<1-> To change the output of the plot you can also use:\\
272                   \scriptsize 
273                   \texttt{palmplot \textbf{plot\underline{ }identifier} 
274                   parameter=value parameter=string ...} 
[1080]275      \footnotesize \\
276      \vspace{2mm}
[1515]277      \item[-]<2-> A list of all available parameters can be found in the
278                   configuration file \texttt{.ncl.config} or in the
279                   documentation:\\
280                   \uncover<3->{\texttt{http://palm.muk.uni-hannover.de/wiki/doc/app/nclparlist}}\\
[1080]281      \vspace{2mm}
[1515]282      \item[-]<4-> Parameters specified in the prompt override parameters given
283                   in the configuration file\\
[1080]284      \vspace{2mm}
[1515]285      \item[-]<5-> String parameters which can contain lists (\texttt{var},
286                   \texttt{c\underline{ }var}, \texttt{vec1}, \texttt{vec2},
287                   \texttt{plotvec}) have to be set in single quotes and the
288                   list itself has to be separated by blanks, e.g.
289                   \texttt{var='pt u w'}\\
[1080]290      \vspace{2mm}
[1515]291      \item[-]<6-> A short introduction for using the shell script is given by
292                   typing\\
293                   \texttt{palmplot ?}
[1080]294   \end{itemize}     
295
296\end{frame}
297
298% Folie 12
299\begin{frame}
[1515]300   \frametitle{Application Example: Visualization of the Output of the Example
301               Run (example\underline{ }cbl) (I)}
[1080]302   \small
303   \begin{itemize}     
[1515]304      \item<1-> Starting the example run with the command\\
305                \vspace{2mm}
306                \texttt{mrun -d example\underline{ }cbl ... -r
307                        'd3\# pr\# ts\# xy\# xz\#'}\\
308                \vspace{2mm}
309                results in the following output files in\\
310                \vspace{2mm}
311                \texttt{\$HOME/palm/current\underline{ }version/JOBS/example\underline{ }cbl/OUTPUT/}:\\
312                \texttt{example\underline{ }cbl\underline{ }pr.nc}, \texttt{example\underline{ }cbl\underline{ }xy.nc}, \texttt{example\underline{ }cbl\underline{ }xz.nc},\\
313                \texttt{example\underline{ }cbl\underline{ }ts.nc}
[1080]314      \item<2-> Example: Visualization of the time series data\\
[1515]315                \vspace{2mm}
316                Goal: Output as eps-file \texttt{timeseries.eps} (by default the
317                plot would be output to an X11 window)
[1080]318   \end{itemize}     
319
320\end{frame}
321
322% Folie 13
323\begin{frame}
[1515]324   \frametitle{Application Example: Visualization of the Output of the Example
325               Run (example\underline{ }cbl) (II)}
[1080]326   \small
327   \begin{itemize}     
[1515]328      \item<1-> In order to reach the goal you can either ...
[1080]329      \item<1-> ... Change to the directory\\
[1515]330                \texttt{\$HOME/palm/current\underline{ }version/JOBS/example\underline{ }cbl/OUTPUT/}\\
331                and use the shell script with the command\\
332                \vspace{2mm}
333                \texttt{palmplot ts file\underline{ }1=example\underline{ }cbl\underline{ }ts.nc format\underline{ }out=eps file\underline{ }out=timeseries}\\
334                \vspace{2mm}
335                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,\\
336                \vspace{2mm}
337                \onslide<2-> e.g. \texttt{file\underline{ }1 = <netCDF file>} 
338                \textbf{(Note: the input file has always to be specified!)}, \texttt{file\underline{ }out = <output file>}
[1080]339   \end{itemize}     
340
341\end{frame}
342
343% Folie 14
344\begin{frame}
[1515]345   \frametitle{Application Example: Visualization of the Output of the Example
346               Run (example\underline{ }cbl) (III)}
[1080]347   \footnotesize
348   ... or you can modify the configuration file \texttt{.ncl.config}, e.g.\\
349   \vspace{2mm}
350   \texttt{if(.not. isvar(\dq file\underline{ }1\dq))then}\\
351   \quad \quad \texttt{file\underline{ }1 = \dq File in\dq}\\
352   \texttt{end if}\\
353   \vspace{2mm}
354   \onslide<2-> has to be changed to\\
355   \vspace{2mm}
356\texttt{if(.not. isvar(\dq file\underline{ }1\dq))then}\\
357   \quad \quad \texttt{file\underline{ }1 = \dq \$HOME/palm/current\underline{ }version/JOBS/example\underline{ }cbl/OUTPUT/example\underline{ }cbl\underline{ }ts.nc\dq}\\
358   \texttt{end if}
359
360\end{frame}
361
362% Folie 15
363\begin{frame}
[1515]364   \frametitle{Application Example: Visualization of the Output of the Example
365               Run (example\underline{ }cbl) (IV)}
[1080]366   \footnotesize
367   \begin{itemize}
[1515]368      \item<1-> Both ways will create a new file called \texttt{timeseries.eps} 
369                in the directory\\
370               \texttt{\$HOME/palm/current\underline{ }version/JOBS/example\underline{ }cbl/OUTPUT/}
[1080]371   \end{itemize}
372   \centering
[1515]373   \onslide<2->\includegraphics[scale=0.25]{ncl_figures/vis1.png}
[1080]374   
375\end{frame}
376
377% Folie 16
378\begin{frame}
[1515]379   \frametitle{Application Example: Visualization of the Output of the Example
380               Run (example\underline{ }cbl) (V)}
[1080]381   \footnotesize
382   \begin{itemize}
383      \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.\\
384      \vspace{2mm}
385      \texttt{if(.not. isvar(\dq var\dq ))then}\\
386      \quad \quad \texttt{var = \dq ,umax,\dq }\\       
387      \texttt{end if}
388   \end{itemize}
389   \centering
[1515]390   \onslide<2->\includegraphics[scale=0.3]{ncl_figures/vis2.png}
[1080]391   
392\end{frame}
393
394% Folie 17
395\begin{frame}[t]
396   \tikzstyle{plain} = [rectangle, text width=0.27\textwidth, font=\small]
[1515]397   \frametitle{Application Example: Visualization of the Output of the Example
398               Run (example\underline{ }cbl) (VI)}
[1080]399   \footnotesize
400   Plot profiles with the command\\
401   \quad \texttt{palmplot pr file\underline{ }1=example\underline{ }cbl\underline{ }pr.nc}\\
402   \vspace{3mm}
403   Profiles of same dimension are plotted\\
404   together, e.g. total, resolved and\\
405   subgridscale temperature flux (default)\\
406   \vspace{3mm}
407   (This composition is written to the\\
408   NetCDF header by the \texttt{d3par}\\
409   parameter \texttt{cross\underline{ }profiles})\\
410   \vspace{3mm}
411   If you add the parameter var=all to\\
412   the command, all profiles will be plotted\\
413   separately
414   \begin{tikzpicture}[remember picture, overlay]
415      \node at (current page.north west){%
416      \begin{tikzpicture}[overlay]
[1515]417         \node[plain,anchor=west] at (72mm,-51.5mm)
418              {\includegraphics[scale=0.32]{ncl_figures/vis3.png}};
[1080]419      \end{tikzpicture}
420      };
421   \end{tikzpicture}
422   
423\end{frame}
424
425% Folie 18
426\begin{frame}
427   \frametitle{More Comments}
428   \small
429   \begin{itemize}     
[1515]430      \item<1-> The other NCL scripts delivered with PALM can be used in
431                a similar way, however the parameters that can be specified
432                differ from script to script
433      \item<2-> There are plenty of parameters for each script. Please have a
434                look to the NCL documentation
435                (\texttt{http://palm.muk.uni-hannover.de/wiki/doc/app/nclparlist})
436                for detailed information
437      \item<3-> If one of the program aborts and there is no comment,
438                check the configuration file - the scripts should not abort with
439                the default values. Be sure to use the right data type
440                (e.g.: integer = 2; float = 2.0; double = 2.0d;
441                string = \dq name\dq ) 
[1080]442   \end{itemize}   
443\end{frame}
444
445
446
447
448
449
450
451
452\end{document}
Note: See TracBrowser for help on using the repository browser.