Ignore:
Timestamp:
Jan 26, 2015 1:59:17 PM (9 years ago)
Author:
hoffmann
Message:

updated tutorial (ncl, particle model), new exercise (bulk cloud physics)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/TUTORIAL/SOURCE/ncl.tex

    r1515 r1532  
    11%$Id$
    22\input{header_tmp.tex}
    3 %\input{../header_lectures.tex}
     3%\input{header_lectures.tex}
    44
    55\usepackage[utf8]{inputenc}
    66\usepackage{ngerman}
    77\usepackage{pgf}
    8 \usetheme{Dresden}
    98\usepackage{subfigure}
    109\usepackage{units}
     
    2827        \ttfamily,showstringspaces=false,captionpos=b}
    2928
    30 \institute{Institut fÃŒr Meteorologie und Klimatologie, Leibniz UniversitÀt Hannover}
     29\institute{Institute of Meteorology and Climatology, Leibniz Universit{\"a}t Hannover}
     30\selectlanguage{english}
    3131\date{last update: \today}
    3232\event{PALM Seminar}
     
    4848
    4949\title[Introduction to NCL]{Introduction to NCL}
    50 \author{Siegfried Raasch}
     50\author{PALM group}
    5151
    5252\begin{document}
     
    6767           \item<1-> There are several ways how you can visualize netCDF data
    6868           \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)
     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)
    7172      \item<2-> Detailed information is available under http://www.ncl.ucar.edu
    7273      \item<3-> With the information revealed in this talk you will be able to visualize the output of this week's simulations
     
    8283                data processing and visualization, freely available
    8384      \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
    89    \end{itemize} 
    90    \centering
    91    \onslide<3-> \includegraphics[scale=0.28]{ncl_figures/ncl.png}
     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
    9293   
    9394\end{frame}
     
    9899   \small
    99100   \begin{itemize}     
    100            \item<1-> Supports calling C and FORTRAN extended routines
     101           \item<1-> Supports calling of C and FORTRAN routines
    101102           \item<1-> Over 600 functions and procedures for visualization and
    102103                     data analysis are provided with NCL
    103            \item<2-> Interactive mode: \texttt{\$ ncl}\\
    104       \texttt{ncl 0>}
    105       \item<3-> each line is interpreted as it is entered
    106       \item<4-> Batch mode: \texttt{\$ ncl ncl\underline{ }script.ncl}\\
    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 ' ...}
     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!}
    111111   \end{itemize} 
    112112
     
    121121           \begin{itemize}   
    122122              \footnotesize
    123               \item<1-> data types
     123              \item<1-> data types (float, double, integer, logical, ...)
    124124              \item<1-> variables
    125125              \item<1-> operators
    126126              \item<1-> expressions
    127127              \item<1-> loops
    128               \item<1-> functions/procedures/graphics
     128              \item<1-> functions and procedures (e.g., \texttt{dim\_stat4(data\_array)})
    129129      \end{itemize} 
    130130           \item<2-> Features
    131131           \begin{itemize}   
    132132              \footnotesize
    133               \item<2-> query / manipulate meta data
    134               \item<2-> import data in a variety of formats
     133              \item<2-> manipulate meta data
     134              \item<2-> import data in a variety of formats (netCDF, ASCII, ...)
    135135              \item<2-> array syntax / operations
    136136              \item<2-> can use user FORTRAN/C codes and commercial libraries
     
    146146   \small
    147147   \begin{itemize}     
    148       \item<1-> Detailed information is available under\\
     148      \item<1-> Detailed information is available under:\\
    149149                \underline{http://www.ncl.ucar.edu/Download/index.shtml}
    150       \item<1-> Request an Earth System Grid account
     150      \item<1-> For downloading, request an Earth System Grid account:\\
    151151                \underline{http://www.earthsystemgrid.org/}
    152152      \item<2-> Download the appropriate binaries e.g. \texttt{A.tar.gz}
     
    154154      \item<2-> \texttt{\% gunzip \$HOME/A.tar.gz}
    155155      \item<2-> \texttt{\% mkdir -p /usr/local}\\
    156       \quad \texttt{\% cd /usr/local}\\
    157       \quad \texttt{\% tar -xvf \$HOME/A.tar}
     156      \texttt{\% cd /usr/local}\\
     157      \texttt{\% tar -xvf \$HOME/A.tar}
    158158   \end{itemize} 
    159159
     
    166166   \begin{itemize}     
    167167      \item<1-> Set the \texttt{NCARG\underline{ }ROOT} environment variable and
    168                 your search path to where NCL/NCARG resides\\
     168                your search path to where NCL/NCARG resides:\\
    169169                csh: \texttt{setenv NCARG\underline{ }ROOT /usr/local/}\\
    170170                \hspace{1.6em} \texttt{setenv PATH /usr/local/bin:\$PATH}\\
     
    173173      \vspace{3mm}
    174174      \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.\\
     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
    179179      \vspace{3mm}
    180       \item<3-> Test your NCL installation\\
    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.
     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.
    184184   \end{itemize} 
    185185
     
    191191   \footnotesize
    192192   \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\\
     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:\\
    194194                \texttt{\$HOME/palm/current\underline{ }version/trunk/SCRIPTS/NCL/}
    195195      \item<2-> All standard netCDF data output of PALM can be visualized by one
     
    198198                   \scriptsize
    199199                   \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)
     200                                (contour or vector plots from 2D/3D data)
     201                   \item[-]<2-> \texttt{profiles.ncl} (profiles from profiles/3D data)
    202202                   \item[-]<2-> \texttt{timeseries.ncl} (time series data)
    203203                   \item[-]<2-> \texttt{spectra.ncl} (spectra data)
    204204                \end{itemize} 
    205205      \item<3-> To run these NCL scripts you can use the shell script
    206                 \texttt{palmplot} which can be found in the directory\\
     206                \texttt{palmplot} which can be found in the directory:\\
    207207                \texttt{\$HOME/palm/current\underline{ }version/trunk/SCRIPTS}
    208208      \item<4-> The output of the plots can be changed with several parameters;
     
    218218   \frametitle{NCL Scripts Delivered with PALM (II)}
    219219
    220    Using \texttt{.ncl.config}
    221    \small
    222    \begin{itemize}     
    223       \item[-]<1-> Please create a personal configuration file by copying
     220   Using \texttt{.ncl.config}:
     221   \small
     222   \begin{itemize}     
     223      \item<1-> Please create a personal configuration file by copying
    224224                   the default configuration file
    225225                   \texttt{.ncl.config.default} to the PALM working
    226226                   directory \texttt{\$HOME/palm/current\underline{ }version}
    227227                   and naming it \texttt{.ncl.config}
    228       \item[-]<2-> \texttt{.ncl.config} is used by NCL directly, thus the
     228      \item<2-> \texttt{.ncl.config} is used by NCL directly, thus the
    229229                   parameters have to be written according to the rules of the
    230230                   scripting language NCL
    231       \item[-]<3-> The configuration file contains all steering parameters with
     231      \item<3-> The configuration file contains all steering parameters with
    232232                   a short description and can be adjusted to personal needs
    233233   \end{itemize} 
     
    242242   \footnotesize
    243243   \begin{itemize}     
    244       \item[-]<1-> The shell script is used as follows:\\
     244      \item<1-> The shell script is used as follows:\\
    245245                   \texttt{palmplot <plot\underline{ }identifier>}
    246       \item[-]<1-> \texttt{<plot\underline{ }identifier>} has to be \texttt{xy},
     246      \item<1-> \texttt{<plot\underline{ }identifier>} has to be \texttt{xy},
    247247                   \texttt{xz}, \texttt{yz}, \texttt{pr}, \texttt{sp} or
    248248                   \texttt{ts} depending on the data to be plotted
     
    250250   \vspace{3mm}
    251251   \onslide<2->
     252   \begin{center}
    252253      \begin{tabular}{ccc}
    253254         \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\\
     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\\
    257258         pr & profile or 3D data & profiles.ncl\\
    258259         sp & spectra data & spectra.ncl\\
    259260         ts & time series data & timeseries.ncl\\
    260261   \end{tabular}
     262   \end{center}
    261263
    262264\end{frame}
     
    269271   \footnotesize
    270272   \begin{itemize}     
    271       \item[-]<1-> To change the output of the plot you can also use:\\
     273      \item<1-> To change the output of the plot you can also use the prompt:\\
    272274                   \scriptsize
    273275                   \texttt{palmplot \textbf{plot\underline{ }identifier}
    274                    parameter=value parameter=string ...}
     276                   parameter=value parameter='string' ...}
    275277      \footnotesize \\
    276278      \vspace{2mm}
    277       \item[-]<2-> A list of all available parameters can be found in the
     279      \item<2-> A list of all available parameters can be found in the
    278280                   configuration file \texttt{.ncl.config} or in the
    279281                   documentation:\\
    280282                   \uncover<3->{\texttt{http://palm.muk.uni-hannover.de/wiki/doc/app/nclparlist}}\\
    281283      \vspace{2mm}
    282       \item[-]<4-> Parameters specified in the prompt override parameters given
     284      \item<4-> Parameters specified in the prompt override parameters given
    283285                   in the configuration file\\
    284286      \vspace{2mm}
    285       \item[-]<5-> String parameters which can contain lists (\texttt{var},
     287      \item<5-> String parameters which can contain lists (\texttt{var},
    286288                   \texttt{c\underline{ }var}, \texttt{vec1}, \texttt{vec2},
    287289                   \texttt{plotvec}) have to be set in single quotes and the
     
    289291                   \texttt{var='pt u w'}\\
    290292      \vspace{2mm}
    291       \item[-]<6-> A short introduction for using the shell script is given by
     293      \item<6-> A short introduction for using the shell script is given by
    292294                   typing\\
    293295                   \texttt{palmplot ?}
     
    304306      \item<1-> Starting the example run with the command\\
    305307                \vspace{2mm}
    306                 \texttt{mrun -d example\underline{ }cbl ... -r
     308                \hspace{0.5cm}\texttt{mrun -d example\underline{ }cbl ... -r
    307309                        'd3\# pr\# ts\# xy\# xz\#'}\\
    308310                \vspace{2mm}
    309                 results in the following output files in\\
     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\\
    310322                \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}
    314       \item<2-> Example: Visualization of the time series data\\
    315                 \vspace{2mm}
    316                 Goal: Output as eps-file \texttt{timeseries.eps} (by default the
     323       \item<3-> Goal: Output the eps-file \texttt{timeseries.eps} (by default the
    317324                plot would be output to an X11 window)
    318325   \end{itemize}     
     
    327334   \begin{itemize}     
    328335      \item<1-> In order to reach the goal you can either ...
    329       \item<1-> ... Change to the directory\\
     336      \item<1-> ... change to the directory\\
    330337                \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>}
     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>}
    339343   \end{itemize}     
    340344
     
    346350               Run (example\underline{ }cbl) (III)}
    347351   \footnotesize
    348    ... or you can modify the configuration file \texttt{.ncl.config}, e.g.\\
     352   \begin{itemize}
     353   \item<1-> ... or you can modify the configuration file \texttt{.ncl.config}, e.\,g.,\\
    349354   \vspace{2mm}
    350355   \texttt{if(.not. isvar(\dq file\underline{ }1\dq))then}\\
     
    355360   \vspace{2mm}
    356361\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}\\
     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}\\
    358364   \texttt{end if}
    359 
     365\end{itemize}
    360366\end{frame}
    361367
     
    371377   \end{itemize}
    372378   \centering
    373    \onslide<2->\includegraphics[scale=0.25]{ncl_figures/vis1.png}
     379   \onslide<2->\includegraphics[scale=0.23]{ncl_figures/vis1.png}
    374380   
    375381\end{frame}
     
    381387   \footnotesize
    382388   \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.\\
     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.,\\
    384390      \vspace{2mm}
    385391      \texttt{if(.not. isvar(\dq var\dq ))then}\\
     
    387393      \texttt{end if}
    388394   \end{itemize}
     395   \vspace{+0.2cm}
    389396   \centering
    390397   \onslide<2->\includegraphics[scale=0.3]{ncl_figures/vis2.png}
     
    397404   \frametitle{Application Example: Visualization of the Output of the Example
    398405               Run (example\underline{ }cbl) (VI)}
    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
     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}
    414419   \begin{tikzpicture}[remember picture, overlay]
    415420      \node at (current page.north west){%
     
    426431\begin{frame}
    427432   \frametitle{More Comments}
    428    \small
     433   \footnotesize
    429434   \begin{itemize}     
    430435      \item<1-> The other NCL scripts delivered with PALM can be used in
     
    432437                differ from script to script
    433438      \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})
     439                look to the NCL documentation\\
     440               
     441                \quad \texttt{http://palm.muk.uni-hannover.de/wiki/doc/app/nclparlist}\\
     442               
    436443                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 ) 
     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})!
    442449   \end{itemize}   
    443450\end{frame}
Note: See TracChangeset for help on using the changeset viewer.