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

Last change on this file since 1711 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
RevLine 
[1080]1%$Id: ncl.tex 1649 2015-09-15 16:34:42Z raasch $
2\input{header_tmp.tex}
[1532]3%\input{header_lectures.tex}
[1080]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
[1532]29\institute{Institute of Meteorology and Climatology, Leibniz Universit{\"a}t Hannover}
30\selectlanguage{english}
[1080]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}
[1532]50\author{PALM group}
[1080]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:
[1532]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)
[1080]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}     
[1515]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
[1532]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
[1080]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}     
[1532]101           \item<1-> Supports calling of C and FORTRAN routines
[1515]102           \item<1-> Over 600 functions and procedures for visualization and
103                     data analysis are provided with NCL
[1532]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!}
[1080]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
[1532]123              \item<1-> data types (float, double, integer, logical, ...)
[1080]124              \item<1-> variables
125              \item<1-> operators
126              \item<1-> expressions
127              \item<1-> loops
[1532]128              \item<1-> functions and procedures (e.g., \texttt{dim\_stat4(data\_array)})
[1080]129      \end{itemize} 
130           \item<2-> Features
131           \begin{itemize}   
132              \footnotesize
[1532]133              \item<2-> manipulate meta data
134              \item<2-> import data in a variety of formats (netCDF, ASCII, ...)
[1080]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}     
[1532]148      \item<1-> Detailed information is available under:\\
[1515]149                \underline{http://www.ncl.ucar.edu/Download/index.shtml}
[1532]150      \item<1-> For downloading, request an Earth System Grid account:\\
[1515]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}\\
[1532]156      \texttt{\% cd /usr/local}\\
157      \texttt{\% tar -xvf \$HOME/A.tar}
[1080]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
[1532]168                your search path to where NCL/NCARG resides:\\
[1515]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
[1532]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
[1515]179      \vspace{3mm}
[1532]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.
[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}     
[1532]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:\\
[1515]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} 
[1532]200                                (contour or vector plots from 2D/3D data)
201                   \item[-]<2-> \texttt{profiles.ncl} (profiles from profiles/3D data)
[1515]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
[1532]206                \texttt{palmplot} which can be found in the directory:\\
[1515]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
[1532]220   Using \texttt{.ncl.config}:
[1080]221   \small
222   \begin{itemize}     
[1532]223      \item<1-> Please create a personal configuration file by copying
[1515]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}
[1532]228      \item<2-> \texttt{.ncl.config} is used by NCL directly, thus the
[1515]229                   parameters have to be written according to the rules of the
230                   scripting language NCL
[1532]231      \item<3-> The configuration file contains all steering parameters with
[1515]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}     
[1532]244      \item<1-> The shell script is used as follows:\\
[1515]245                   \texttt{palmplot <plot\underline{ }identifier>}
[1532]246      \item<1-> \texttt{<plot\underline{ }identifier>} has to be \texttt{xy},
[1515]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->
[1532]252   \begin{center}
[1515]253      \begin{tabular}{ccc}
254         \textbf{plot\underline{ }identifier} & \textbf{data used} & \textbf{ncl script}\\
[1532]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\\
[1515]258         pr & profile or 3D data & profiles.ncl\\
259         sp & spectra data & spectra.ncl\\
260         ts & time series data & timeseries.ncl\\ 
[1080]261   \end{tabular}
[1532]262   \end{center}
[1080]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}     
[1532]273      \item<1-> To change the output of the plot you can also use the prompt:\\
[1515]274                   \scriptsize 
275                   \texttt{palmplot \textbf{plot\underline{ }identifier} 
[1532]276                   parameter=value parameter='string' ...} 
[1080]277      \footnotesize \\
278      \vspace{2mm}
[1532]279      \item<2-> A list of all available parameters can be found in the
[1515]280                   configuration file \texttt{.ncl.config} or in the
281                   documentation:\\
[1649]282                   \uncover<3->{\texttt{http://palm.muk.uni-hannover.de/trac/wiki/doc/app/nclparlist}}\\
[1080]283      \vspace{2mm}
[1532]284      \item<4-> Parameters specified in the prompt override parameters given
[1515]285                   in the configuration file\\
[1080]286      \vspace{2mm}
[1532]287      \item<5-> String parameters which can contain lists (\texttt{var},
[1515]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'}\\
[1080]292      \vspace{2mm}
[1532]293      \item<6-> A short introduction for using the shell script is given by
[1515]294                   typing\\
295                   \texttt{palmplot ?}
[1080]296   \end{itemize}     
297
298\end{frame}
299
300% Folie 12
301\begin{frame}
[1515]302   \frametitle{Application Example: Visualization of the Output of the Example
303               Run (example\underline{ }cbl) (I)}
[1080]304   \small
305   \begin{itemize}     
[1515]306      \item<1-> Starting the example run with the command\\
307                \vspace{2mm}
[1532]308                \hspace{0.5cm}\texttt{mrun -d example\underline{ }cbl ... -r
[1515]309                        'd3\# pr\# ts\# xy\# xz\#'}\\
310                \vspace{2mm}
[1532]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\\
[1515]322                \vspace{2mm}
[1532]323       \item<3-> Goal: Output the eps-file \texttt{timeseries.eps} (by default the
[1515]324                plot would be output to an X11 window)
[1080]325   \end{itemize}     
326
327\end{frame}
328
329% Folie 13
330\begin{frame}
[1515]331   \frametitle{Application Example: Visualization of the Output of the Example
332               Run (example\underline{ }cbl) (II)}
[1080]333   \small
334   \begin{itemize}     
[1515]335      \item<1-> In order to reach the goal you can either ...
[1532]336      \item<1-> ... change to the directory\\
[1515]337                \texttt{\$HOME/palm/current\underline{ }version/JOBS/example\underline{ }cbl/OUTPUT/}\\
[1532]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>}
[1080]343   \end{itemize}     
344
345\end{frame}
346
347% Folie 14
348\begin{frame}
[1515]349   \frametitle{Application Example: Visualization of the Output of the Example
350               Run (example\underline{ }cbl) (III)}
[1080]351   \footnotesize
[1532]352   \begin{itemize}
353   \item<1-> ... or you can modify the configuration file \texttt{.ncl.config}, e.\,g.,\\
[1080]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}\\
[1532]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}\\
[1080]364   \texttt{end if}
[1532]365\end{itemize}
[1080]366\end{frame}
367
368% Folie 15
369\begin{frame}
[1515]370   \frametitle{Application Example: Visualization of the Output of the Example
371               Run (example\underline{ }cbl) (IV)}
[1080]372   \footnotesize
373   \begin{itemize}
[1515]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/}
[1080]377   \end{itemize}
378   \centering
[1532]379   \onslide<2->\includegraphics[scale=0.23]{ncl_figures/vis1.png}
[1080]380   
381\end{frame}
382
383% Folie 16
384\begin{frame}
[1515]385   \frametitle{Application Example: Visualization of the Output of the Example
386               Run (example\underline{ }cbl) (V)}
[1080]387   \footnotesize
388   \begin{itemize}
[1532]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.,\\
[1080]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}
[1532]395   \vspace{+0.2cm}
[1080]396   \centering
[1515]397   \onslide<2->\includegraphics[scale=0.3]{ncl_figures/vis2.png}
[1080]398   
399\end{frame}
400
401% Folie 17
402\begin{frame}[t]
403   \tikzstyle{plain} = [rectangle, text width=0.27\textwidth, font=\small]
[1515]404   \frametitle{Application Example: Visualization of the Output of the Example
405               Run (example\underline{ }cbl) (VI)}
[1532]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}
[1080]419   \begin{tikzpicture}[remember picture, overlay]
420      \node at (current page.north west){%
421      \begin{tikzpicture}[overlay]
[1515]422         \node[plain,anchor=west] at (72mm,-51.5mm)
423              {\includegraphics[scale=0.32]{ncl_figures/vis3.png}};
[1080]424      \end{tikzpicture}
425      };
426   \end{tikzpicture}
427   
428\end{frame}
429
430% Folie 18
431\begin{frame}
432   \frametitle{More Comments}
[1532]433   \footnotesize
[1080]434   \begin{itemize}     
[1515]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
[1532]439                look to the NCL documentation\\
440               
[1649]441                \quad \texttt{http://palm.muk.uni-hannover.de/trac/wiki/doc/app/nclparlist}\\
[1532]442               
[1515]443                for detailed information
[1532]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})!
[1080]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.