source: anuga_core/documentation/user_manual/anuga_internal_tools.tex @ 7191

Last change on this file since 7191 was 7190, checked in by rwilson, 16 years ago

New manual.

File size: 31.0 KB
Line 
1% Complete documentation on the extended LaTeX markup used for Python
2% documentation is available in ''Documenting Python'', which is part
3% of the standard documentation for Python.  It may be found online
4% at:
5%
6%     http://www.python.org/doc/current/doc/doc.html
7
8%labels
9%Sections and subsections \label{sec: }
10%Chapters \label{ch: }
11%Equations \label{eq: }
12%Figures \label{fig: }
13
14% Is latex failing with;
15% 'modanuga_user_manual.ind' not found?
16% try this command-line
17%   makeindex modanuga_user_manual.idx
18% To produce the modanuga_user_manual.ind file.
19
20\documentclass{manual}
21
22\usepackage{graphicx}
23\usepackage[english]{babel}
24\usepackage{datetime}
25\usepackage[hang,small,bf]{caption}
26
27\input{definitions}
28
29\title{\anuga Internal Tools Manual}
30\author{Geoscience Australia and the Australian National University}
31
32% Please at least include a long-lived email address;
33% the rest is at your discretion.
34\authoraddress{Geoscience Australia \\
35  Email: \email{ole.nielsen@ga.gov.au}
36}
37
38%Draft date
39
40% update before release!
41% Use an explicit date so that reformatting
42% doesn't cause a new date to be used.  Setting
43% the date to \today can be used during draft
44% stages to make it easier to handle versions.
45
46\longdate       % Make date format long using datetime.sty
47%\settimeformat{xxivtime} % 24 hour Format
48\settimeformat{oclock} % Verbose
49\date{\today, \ \currenttime}
50%\hyphenation{set\_datadir}
51
52\ifhtml
53  \date{\today} % latex2html does not know about datetime
54\fi
55
56\input{version} % Get version info - this file may be modified by
57                % update_anuga_user_manual.py - if not a dummy
58                % will be used.
59
60%\release{1.0}   % release version; this is used to define the
61%                % \version macro
62
63\makeindex          % tell \index to actually write the .idx file
64\makemodindex       % If this contains a lot of module sections.
65
66\setcounter{tocdepth}{3}
67\setcounter{secnumdepth}{3}
68
69%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70
71\begin{document}
72\maketitle
73
74%% This makes the contents more accessible from the front page of the HTML.
75%\ifhtml
76%  \chapter*{Front Matter\label{front}}
77%\fi
78
79\input{toolscopyright}
80
81\tableofcontents
82
83%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84
85\chapter{Internal Tools}
86
87
88\section{Introduction}
89
90This document describes the tools written for internal \anuga use at Geoscience Australia.
91
92These tools are necessarily ad-hoc in nature and of possibly limited general use.  If
93a tool becomes useful to a wider audience it may be moved into the 'ANUGA Tools Manual'.
94
95The tools documented below are:
96\begin{itemize} 
97  \item acceptance_tests
98  \item cmpsww
99  \item event_selection
100  \item mk_digest
101  \item plotcsv
102  \item tar_file
103  \item update_DVD_images
104  \item write_large_files
105\end{itemize}   
106
107\pagebreak
108
109\subsection{acceptance_tests}
110\label{subsec:acceptance_tests}
111\index{acceptance_tests}
112
113This collection of tests is designed to speed up and automate acceptance testing of a
114'cluster' of compute servers.  The tests are highly dependent on the installed software
115environment, so may have limited use outside Geoscience Australia.
116
117The suite of tests checks:
118\begin{itemize}
119  \item installed software, such as python installed packages
120  \item availability of NFS mounted filesystems
121  \item ability to ssh to each compute node from the master
122  \item various aspects of parallel computation
123\end{itemize}
124
125The tests are a collection of self-contained acceptance 'testlets' that will be usually
126run from a controlling master program, but may be run individually.  This is very useful
127when developing a new test, as it can be run by itself until correct.
128
129\subsubsection{Using acceptance_tests}
130\label{subsubsec:acceptance_tests_use}
131
132The acceptance tests are designed to be run from the cluster 'master node', so you
133must \code{ssh} to that machine.  It is assumed the acceptance tests code suite is available
134on the master node.
135
136Before running the acceptance tests you must prepare some environment variables:
137
138\begin{tabular}{ r l }
139PYTHON & Defines the path to the python executable to use for the sub-tests. \\
140PYTHONPATH & The path to the \anuga source directory. \\
141EQRMPATH & The path to the EQRM source directory.  If not set, EQRM is not tested. \\
142\end{tabular}
143
144The first sub-test run dumps the testing environment to the screen as a check.
145
146So to run the acceptance tests, do all this:
147
148\begin{verbatim}
149export PYTHON=python2.5         # we want to run python 2.5 in the tests
150export PYTHONPATH=/home/r-w/sandpit/ga/anuga_core/source/
151# EQRMPATH not set
152python test_all.py
153\end{verbatim}
154
155While the tests are running, you will see the results of each test listed to the
156screen.  Don't worry about catching this output; everything is written to a log file
157\code{anuga.log}.
158
159\pagebreak
160
161\subsection{cmpsww}
162\label{subsec:cmpsww}
163\index{cmpsww.py}
164
165The \code{cmpsww} program is used to compare two SWW files for some approximation
166of \emph{equality}.  The user must be able to define what to compare in the two files,
167as well as 'how close is close'.
168
169\subsubsection{Using cmpsww}
170\label{subsubsec:cmpsww_use}
171
172The usage printed by the program is:
173
174\begin{verbatim}
175Usage: cmpsww.py <options> <file1> <file2>
176where <options> is zero or more of:
177                   -h        print this help
178                   -a <val>  set absolute threshold of 'equivalent'
179                   -r <val>  set relative threshold of 'equivalent'
180                   -g <arg>  check only global attributes specified
181                             <arg> has the form <globname>[,<globname>[,...]]
182                   -t <arg>  check only timesteps specified
183                             <arg> has the form <starttime>[,<stoptime>[,<step>]]
184                   -v <arg>  check only the named variables
185                             <arg> has the form <varname>[,<varname>[,...]]
186and <file1> and <file2> are two SWW files to compare.
187
188The program exit status is one of:
189   0    the two files are equivalent
190   else the files are not equivalent.
191\end{verbatim}
192
193Note that if no globals, variable or timesteps are specified, the program checks
194all globals and all variables for all timesteps.
195
196\subsubsection{Bugs}
197\label{subsubsec:cmpsww_bugs}
198
199The \code{cmpsww} program is still being developed and needs to change in concert
200with the methodology of determining if an SWW file is as expected.
201
202\pagebreak
203
204\subsection{event_selection}
205\label{subsec:event_selection}
206\index{event_selection.py}
207
208\code{event_selection} is a graphical program used to select earthquake events.
209
210\subsubsection{Using event_selection}
211\label{subsubsec:event_selection_use}
212
213Once you start the \code{event_selection} program you will see:
214
215\begin{figure}[ht]
216  \centerline{\fbox{\includegraphics[scale=0.5]{toolgraphics/eventselection/event1.png}}}
217  \label{fig:event1}
218\end{figure}
219
220Before using the program, you need to set the \emph{output base directory} field.  The program needs to write
221some data files and this field tells the program where to write them.  Just click in the box to
222select a directory somewhere in your filesystem.
223
224\pagebreak
225
226We set the directory to \code{C:$\backslash$temp}.
227Next, you need to select the \emph{Region} from the drop-down list:
228
229\begin{figure}[ht]
230  \centerline{\fbox{\includegraphics[scale=0.5]{toolgraphics/eventselection/event2.png}}}
231  \label{fig:event2}
232\end{figure}
233
234At this point you have set the values that will probably never change.  If you close the
235program at this point, then the two values set (\emph{base directory} and \emph{Region})
236and the three fields below (\emph{Hazard index},
237\emph{Minimum wave height} and \emph{Maximum wave height}) will be remembered and restored the
238next time you run the program.
239
240\pagebreak
241
242OK, now you need to enter data specific to a particular event you are going to model.  Fill
243in the \emph{Hazard index}, \emph{Minimum wave height} and \emph{Maximum wave height} values
244and click on the \emph{List} button:
245
246\begin{figure}[ht]
247  \centerline{\fbox{\includegraphics[scale=0.5]{toolgraphics/eventselection/event3.png}}}
248  \label{fig:event3}
249\end{figure}
250
251\pagebreak
252
253The program has filled the text box below the \emph{List} button with events that satisfy
254your listed requirements.  You need to select one of these events, which puts the \emph{Quake_ID}
255number into the \emph{Quake_ID} textbox below:
256
257\begin{figure}[ht]
258  \centerline{\fbox{\includegraphics[scale=0.5]{toolgraphics/eventselection/event4.png}}}
259  \label{fig:event4}
260\end{figure}
261
262\pagebreak
263
264Now you can click on either the \emph{Multimux} or \emph{Grid} buttons.
265Clicking on the  \emph{Multimux} buttons gives us:
266
267\begin{figure}[ht]
268  \centerline{\fbox{\includegraphics[scale=0.5]{toolgraphics/eventselection/event5.png}}}
269  \label{fig:event5}
270\end{figure}
271
272If you now look in the \code{C:$\backslash$temp} directory you will see that two directories have been created:
273
274\begin{verbatim}
27510959
276Results_Australia_1009_0.50_1.00
277\end{verbatim}
278
279The \code{Results_Australia_1009_0.50_1.00} directory contains the \code{fault.xy} and \code(quake_prob.txt}
280files used during the calculation of the multimux results.  The directory name contains the
281region name, hazard index and minimum and maximum wave heights in an encoded form.
282
283The \code{10959} directory contains the multimux data for the selected Quake_ID in a file called \code{event_list}.
284
285\pagebreak
286
287The \emph{Grid} button was installed [for Herve].  Clicking on this button shows:
288
289\begin{figure}[ht]
290  \centerline{\fbox{\includegraphics[scale=0.5]{toolgraphics/eventselection/event6.png}}}
291  \label{fig:event6}
292\end{figure}
293
294and writes some extra files into the \code{Results_Australia_1009_0.50_1.00} directory:
295
296\begin{verbatim}
297event_010959.list
298faults_010959.params
299\end{verbatim}
300
301\pagebreak
302
303The \code{event_010959.list} file contains:
304
305\begin{figure}[ht]
306  \centerline{\fbox{\includegraphics[scale=0.5]{toolgraphics/eventselection/event7.png}}}
307  \label{fig:event7}
308\end{figure}
309
310The \code{faults_010959.params} file contains:
311
312\begin{figure}[ht]
313  \centerline{\fbox{\includegraphics[scale=0.5]{toolgraphics/eventselection/event8.png}}}
314  \label{fig:event8}
315\end{figure}
316
317\subsection{Installing event_selection}
318\label{subsubsec:event_selection_install}
319
320There is an installer program used to install \code{event_selection} on a Windows machine (usually found at
321\code{georisk\downloads\event_selection}).
322The installer is generated by  moving into the \code{installer} directory and right-clicking
323on the \code{EventSelection.nsi} file and selecting \code{Compile NSIS script}.  You must have
324installed the NSIS package for this to work.  Get it from \url{http://nsis.sourceforge.net/Main_Page}.
325
326Once you have installed \code{event_selection} on your Windows machine you will have a desktop
327icon and Start menu entry to start the program with.
328
329Under Linux just execute the \code{event_selection.py} program, either from the console or
330from a desktop icon or menu entry you created.
331
332\subsubsection{Requirements}
333\label{subsubsec:event_selection_requirements}
334
335Various pieces of python software must be installed before \code{event_selection} can be used.
336These are:
337
338\begin{itemize}
339  \item wxpython - a python package
340  \item NSIS - a Windows installer generator (required if creating a Windows installer)
341\end{itemize}
342
343\pagebreak
344
345\subsection{mk_digest}
346\label{subsec:mk_digest}
347\index{mk_digest.py}
348
349\code{mk_digest.py} is a small program used to create an MD5 digest of a file.  The digest string
350is written into a file.
351
352This  program is used in the Patong Beach validation file refresh process.
353
354\subsubsection{Using mk_digest}
355\label{subsubsec:mk_digest_use}
356
357\begin{verbatim}
358usage: mk_digest.py <datafile> <digestfile>
359where <datafile>   is the file for which we create a digest string
360      <digestfile> is the created file that contains the hex string.
361\end{verbatim}
362
363\subsubsection{Installing mk_digest}
364\label{subsubsec:mk_digest_install}
365
366Installation is not required, just run the program.
367
368\pagebreak
369
370\subsection{plotcsv}
371\label{subsec:plotcsv}
372\index{plotcsv.py}
373
374
375\code{plotcsv} is a GUI program to quickly plot selected columns of a CSV file onto a graph screen.
376Once the desired graph is plotted you may save the plot as a picture file.
377
378\subsubsection{Using plotcsv}
379\label{subsubsec:plotcsv_use}
380
381Start the program by selecting it from the Start menu or double-clicking on the desktop icon.
382You will see the following window:
383
384\begin{figure}[ht]
385  \centerline{\fbox{\includegraphics[scale=0.50]{toolgraphics/plotcsv/1.png}}}
386  \label{fig:winsetpath1}
387\end{figure}
388
389The first thing you must do is select one or more CSV files to plot.  The files you are going to
390plot are listed in the textbox at the top of the screen.  There is nothing there because this is
391the first time you have run \code{plotcsv}.  Note that \code{plotcsv} will remember the selected files,
392as well as other information, when you next start the program.
393
394\pagebreak
395
396This screen shot shows what happens when you click on the \emph{Add} button - you get a file selector
397that lets you choose the CSV files to plot.
398
399\begin{figure}[ht]
400  \centerline{\fbox{\includegraphics[scale=0.50]{toolgraphics/plotcsv/2.png}}}
401  \label{fig:winsetpath1}
402\end{figure}
403
404\pagebreak
405
406In this example we selected both \code{test.csv} and \code{test2.csv}.
407
408\begin{figure}[ht]
409  \centerline{\fbox{\includegraphics[scale=0.50]{toolgraphics/plotcsv/3.png}}}
410  \label{fig:winsetpath1}
411\end{figure}
412
413\pagebreak
414
415You must now set the column data to display the X and Y axis of your plot.  The \emph{X-Column}
416and \emph{Y-Column} listboxes are used to set which column data to use.  In this example we are
417going to plot Stage versus Time, so we select the appropriate columns below:
418
419\begin{figure}[ht]
420  \centerline{\fbox{\includegraphics[scale=0.50]{toolgraphics/plotcsv/5.png}}}
421  \label{fig:winsetpath1}
422\end{figure}
423
424\pagebreak
425
426Note that choosing a column to plot also sets the text in the \emph{X-Label} and \emph{Y-Label}
427textboxes.  You can change this text and, in this example, we want to change the stage axis text
428to \emph{Stage (meters)}.  We add some title text and turn on the graph legend:
429
430\begin{figure}[ht]
431  \centerline{\fbox{\includegraphics[scale=0.50]{toolgraphics/plotcsv/7.png}}}
432  \label{fig:winsetpath1}
433\end{figure}
434
435\pagebreak
436
437Finally, once we are ready, we click on the \emph{Plot} button and see our plot:
438
439\begin{figure}[ht]
440  \centerline{\fbox{\includegraphics[scale=0.50]{toolgraphics/plotcsv/8.png}}}
441  \label{fig:winsetpath1}
442\end{figure}
443
444You are free to configure the plot, make it larger, save a picture file, etc.  Closing
445the plot window shuts down the application (see Bugs section below).
446
447\pagebreak
448
449\subsubsection{Installing plotcsv}
450\label{subsubsec:plotcsv_install}
451
452Just execute the \code{plotcsv_X.X.exe} file in \code{N:$\backslash$georisk$\backslash$downloads$\backslash$plotcsv}.
453This will install \code{plotcsv} into your \code{C:$\backslash$Program Files} directory and create a desktop icon.
454
455\subsubsection{Building plotcsv}
456\label{subsubsec:plotcsv_build}
457
458The source directory for \code{plotcsv} contains an \code{installer} directory.  Just right-click
459on the \code{plotcsv.nsi} file and select "Compile NSIS Script".  You must the NSIS installer installed, of course.
460Get it from \url{http://nsis.sourceforge.net/Main_Page}.
461
462\subsubsection{Bugs}
463\label{subsubsec:plotcsv_bugs}
464
465The mixture of matplotlib and wxpython isn't successful - you only get one plot and then you must
466close the application.
467
468Using the wx_mpl_bars.py example from \url{http://eli.thegreenplace.net/2008/08/01/matplotlib-with-wxpython-guis/},
469rewrite \code{plotcsv} to have the parameter changes (such as title text) show up immediately in the current plot.
470
471\pagebreak
472
473\subsection{tar_file}
474\label{subsec:tar_file}
475\index{tar_file}
476\index{tar_file.py}
477\index{untar_file.py}
478
479The \code{tar_file.py} program is used to tar and compress a file or directory into a *.tgz file.
480
481The associated \code{untar_file.py} program reverses the above process.
482
483\subsubsection{Using tar_file}
484\label{subsubsec:tar_file_use}
485
486\begin{verbatim}
487tar_file.py <tarfile> <file1> [<file2>, ...]
488\end{verbatim}
489
490where \emph{tarfile} is the path to the tar file to create,
491and \emph{file?} is the path to a file or  directory to include.
492
493\subsubsection{Using untar_file}
494\label{subsubsec:untar_file_use}
495
496\begin{verbatim}
497untar_file.py <tarfile> [<output_directory>]
498\end{verbatim}
499
500where \emph{tarfile} is the path to the file to untar,
501and \emph{output_directory} is the directory to write the results into.
502
503If \emph{output_directory} is not specified then the compressed file is unpacked
504into the current directory.
505
506\subsubsection{Installing tar_file}
507\label{subsubsec:tar_file_install}
508
509No installation is required, just run the programs.
510
511\pagebreak
512
513\subsection{update_DVD_images}
514\label{subsec:update_DVD_images}
515\index{update_DVD_images.py}
516
517\code{update_DVD_images} is a program used to create the DVD image filesystems that were burnt to DVD
518for the ...
519
520\subsubsection{Using update_DVD_images}
521\label{subsubsec:update_DVD_images_use}
522
523To use the \code{update_DVD_images} program, just execute the program:
524
525\begin{verbatim}
526python update_DVD_images.py <name of jurisdiction>
527\end{verbatim}
528
529Currently, the jurisdiction names are:
530
531\begin{itemize}
532  \item BatemansBay
533  \item GoldCoast
534  \item Gosford
535  \item Hobart
536\end{itemize}
537
538So to recreate the GoldCoast DVD image sub_directory, do:
539
540\begin{verbatim}
541python update_DVD_images.py goldcoast
542\end{verbatim}
543
544Note that the case of the input jurisdiction doesn't matter.
545
546The program will create a new sub-directory with the \emph{formal} jurisdiction name (see below)
547in the current directory.  The old jurisdiction sub-directory is deleted first.
548
549\subsubsection{Configuration}
550\label{subsubsec:update_DVD_images_config}
551
552Here we discuss how to configure \code{update_DVD_images} to handle a new jurisdiction or
553change what files/directories are copied.
554
555In \code{update_DVD_images.py} there are a set of dictionaries that control what is done for each
556jurisdiction.
557
558The first dictionary is \code{source_jurisdiction_path} which maps the lowercase jurisdiction name
559to the dictionary defining that particular jurisdiction:
560
561\begin{verbatim}
562source_jurisdiction_path = {'hobart': hobart_data,
563                            'batemansbay': batemans_bay_data,
564                            'gosford': gosford_data,
565                            'goldcoast': gold_coast_data}
566\end{verbatim}
567
568If you create a new jurisdiction, you need to add another line to the above dictionary.
569
570\pagebreak
571
572In the case of the GoldCoast jurisdiction, we see that the dictionary for the GoldCoast is
573\code{gold_coast_data}:
574
575\begin{verbatim}
576gold_coast_data = \
577{'jurisdiction':    'GoldCoast',        # jurisdiction name
578
579 # paths to various source directories
580 'data_src_path':   'data/queensland/gold_coast_tsunami_scenario_2009/anuga',
581 'arcgis_src_path': 'data/queensland/gold_coast_tsunami_scenario_2009/ArcGIS',
582 'proj_src_path':   'sandpits/lfountain/anuga_work/production/gold_coast_2009',
583
584 # paths to destination directories (under 'jurisdiction' root)
585 'data_dst_path':   'anuga',
586 'proj_dst_path':   'project',
587 'arcgis_dst_path': 'ArcGIS',
588
589 # copy or create whole directories
590 'make_dst_dirs':   ['outputs'],
591 'copy_data_dirs':  ['boundaries'],
592
593 # copy 'data' files or directories
594 'copy_data_files': ['outputs/Event1_HAT', 'outputs/Event1_MSL',
595                     'outputs/Event2_HAT', 'outputs/Event2_MSL',
596                     'outputs/Event3_HAT', 'outputs/Event3_MSL'
597                    ],
598
599 # copy 'project' files or directories
600 'copy_proj_files': ['build_elevation.py', 'export_results_max.py',
601                     'get_runup.py', 'project.py', 'run_model.py',
602                     'setup_model.py', 'build_urs_boundary.py',
603                     'combine_gauges.py', 'get_timeseries.py',
604                     'run_multiple_events.py'
605                    ],
606
607 # copy 'arcgis' files or directories
608 'copy_arc_files':  ['MainBeach.mxd', 'SurfersParadise.mxd', 'GoldCoast.mxd',
609                     'PalmBeach.mxd', 'Collangatta.mxd'
610                    ]
611}
612\end{verbatim}
613
614The first key is \code{jurisdiction}, which maps to a string defining the jurisdiction formal name.
615This name is used to create the output DVD staging directory.
616
617\begin{verbatim}
618'jurisdiction':    'GoldCoast',
619\end{verbatim}
620
621The next three key values define the complete paths to source directories in the production filesystem:
622
623\begin{verbatim}
624# paths to various source directories
625'data_src_path':   'data/queensland/gold_coast_tsunami_scenario_2009/anuga',
626'arcgis_src_path': 'data/queensland/gold_coast_tsunami_scenario_2009/ArcGIS',
627'proj_src_path':   'sandpits/lfountain/anuga_work/production/gold_coast_2009',
628\end{verbatim}
629
630\pagebreak
631
632These key values are used along with a master path variable defined earlier in
633\code{update_DVD_images.py} to create the complete paths to source directories:
634
635\begin{verbatim}
636main_path = '/nas/gemd/georisk_models/inundation'
637\end{verbatim}
638
639For example, the full path to the 'data' source directory would be:
640
641\begin{verbatim}
642data_src_path = os.path.join(main_path, j_dict['data_src_path'])
643\end{verbatim}
644
645where \code{j_dict} would be a reference to the jurisdiction dictionary controling the
646process (\code{gold_coast_data} in this case).
647
648The next three definitions define the names of output directories in the staging directory:
649
650\begin{verbatim}
651# paths to destination directories (under 'jurisdiction' root)
652'data_dst_path':   'anuga',
653'proj_dst_path':   'project',
654'arcgis_dst_path': 'ArcGIS',
655\end{verbatim}
656
657These three names are combined with the current directory and the jurisdiction
658staging directory name to produce the full path to output directories:
659
660\begin{verbatim}
661data_dst_path = os.path.join(os.getcwd(), j_name, j_dict['data_dst_path'])
662proj_dst_path = os.path.join(os.getcwd(), j_name, j_dict['proj_dst_path'])
663arcgis_dst_path = os.path.join(os.getcwd(), j_name, j_dict['arcgis_dst_path'])
664\end{verbatim}
665
666Note that \code{j_name} is the jurisdiction name.  So in this case, we would
667create the output directories:
668
669\begin{verbatim}
670./GoldCoast/anuga               # data directory
671./GoldCoast/project             # project files directory
672./GoldCoast/ArcGIS              # ArcGIS files
673\end{verbatim}
674
675The next two key values define the names of empty directories to create or names of
676complete directories to copy to the \code{data_dst_path} directory:
677
678\begin{verbatim}
679# copy or create whole directories
680'make_dst_dirs':   ['outputs'],
681'copy_data_dirs':  ['boundaries'],
682\end{verbatim}
683
684The values here are lists of one or more directories to create or copy.  If there are no directories
685to create/copy, just use an empty list.
686
687\pagebreak
688
689Next, we define which individual files we copy to a destination data directory:
690
691\begin{verbatim}
692# copy 'data' files or directories
693'copy_data_files': ['outputs/Event1_HAT', 'outputs/Event1_MSL',
694                    'outputs/Event2_HAT', 'outputs/Event2_MSL',
695                    'outputs/Event3_HAT', 'outputs/Event3_MSL'],
696\end{verbatim}
697
698Again we have a list of files to copy.  Note that we must specify the path following the
699\code{data_dst_path} variable (\code{anuga} in this case), so we specify the directory under
700\code{anuga} and then the source file (or directory).  Also note that we can copy a simple file
701or complete directory here.
702
703You \emph{must} create each target directory as an empty directory before copying files.
704That is why \code{outputs} appears in the \code{make_dst_dirs} key-value definition above.
705
706Similarly, we now define 'project' files to copy:
707
708\begin{verbatim}
709 # copy 'project' files or directories
710 'copy_proj_files': ['build_elevation.py', 'export_results_max.py',
711                     'get_runup.py', 'project.py', 'run_model.py',
712                     'setup_model.py', 'build_urs_boundary.py',
713                     'combine_gauges.py', 'get_timeseries.py',
714                     'run_multiple_events.py'],
715\end{verbatim}
716
717These files (or directories) will be copied from the path defined in the \code{proj_src_path}
718variable to the path defined in the \code{proj_dst_path} variable.
719
720Finally, we define 'arcgis' files or directories to copy:
721
722\begin{verbatim}
723# copy 'arcgis' files or directories
724'copy_arc_files':  ['MainBeach.mxd', 'SurfersParadise.mxd', 'GoldCoast.mxd',
725                    'PalmBeach.mxd', 'Collangatta.mxd']
726\end{verbatim}
727
728These files (or directories) will be copied from the path defined in the \code{arcgis_src_path}
729variable to the path defined in the \code{arcgis_dst_path} variable.
730
731\pagebreak
732
733\subsection{update_lic_checksum}
734\label{subsec:update_lic_checksum}
735\index{update_lic_checksum.py}
736\index{create_lic_file.py}
737
738The \code{update_lic_checksum} program is used to update all licence files (\code{*.lic}) in
739a filesystem sub_tree.
740
741\subsubsection{Using update_lic_checksum}
742\label{subsubsec:update_lic_checksum_use}
743
744The program is used:
745
746\begin{verbatim}
747update_lic_checksum.py [-m <lic_mask>] <directory>
748\end{verbatim}
749
750where \emph{directory} is the path to the sub_directory containing licence files to update.
751Normally, \code{update_lic_checksum} would search for and update all \code{*.lic} files.  If you
752want to update licence files that have a general filename form of \code{*.txt} then use the
753\code{-m *.txt} option.
754
755Note that the licence files being updated must contain well-formed XML data.
756
757\subsubsection{Using create_lic_file}
758\label{subsubsec:create_lic_file_use}
759
760\code{create_lic_file} is a program used to create licence files from scratch.  It is used so:
761
762\begin{verbatim}
763usage: create_lic_file.py <options> <lic_file> [<filename> ...]
764where <options>  is zero or more of:
765                  --author <name>
766                  -w <name>             - name of the author
767                  --publishable [Yes|No]
768                  -p [Yes|No]           - is document publishable
769                  --accountable <name>
770                  -a <name>             - name of person accountable for file
771                  --source <string>
772                  -s <string>           - source of controlled file
773                  --owner <name>
774                  -o <name>             - IP owner name
775                  --info <string>
776                  -i <string>           - IP extra information
777      <lic_file> is the name of the licence file to create.
778      <filename> is one or more files to control.
779\end{verbatim}
780
781If the file to be created (\emph{lic_file}) already exists, the program aborts; it will
782not overwrite any existing file.
783
784\pagebreak
785
786You must use the options to specify author name, etc.  If these are not overridden the
787generated licence file will contain default values. For example, if you did this:
788
789\begin{verbatim}
790python create_lic_file.py test.lic README
791\end{verbatim}
792
793then the output file \code{test.lic} would contain:
794
795\begin{verbatim}
796<?xml version='1.0' encoding='iso-8859-1'?>
797<ga_license_file>
798  <metadata>
799    <author>rwilson</author>
800  </metadata>
801  <datafile>
802    <filename>README</filename>
803    <checksum>1387779554</checksum>
804    <publishable>N</publishable>
805    <accountable>rwilson</accountable>
806    <source>Generated by ANUGA development team</source>
807    <IP_owner>Geoscience Australia</IP_owner>
808    <IP_info>For use with the ANUGA test suite</IP_info>
809  </datafile>
810</ga_license_file>
811\end{verbatim}
812
813In particular, the \emph{author} and \emph{accountable} values are defaulted with
814the username from the environment.
815
816Note the default values for these fields:
817
818\begin{verbatim}
819<publishable>N</publishable>
820<source>Generated by ANUGA development team</source>
821<IP_owner>Geoscience Australia</IP_owner>
822<IP_info>For use with the ANUGA test suite</IP_info>
823\end{verbatim}
824
825\pagebreak
826
827\subsection{write_large_files}
828\label{subsec:write_large_files}
829\index{write_large_files}
830\index{rwi_big_file.py}
831\index{rwil_big_file.py}
832\index{rwi4_big_file.py}
833
834This program is actually a suite of programs used to exercise the NetCDF file I/O code.
835
836The NetCDF I/O model has three models of the way data is written:
837\begin{itemize}
838  \item The 'classic' model
839  \item The 'large' model
840  \item The 'NetCDF4' model
841\end{itemize}
842
843The \emph{classic} model is usually dismissed as the '2GiB limit' model, but this
844is an over-simplification.  Chunks of data wriiten to a file in one write will contain
845an offset to the next related chunk 'upstream' in the file.  This offset has a 2GiB
846limit, hence the '2Gib' oversimplification.
847
848The \emph{long} model relaxes some of the limits in the \emph{classic} model.
849
850The \emph{NetCDF4} model allows much larger datasets to be written to a file, along
851with compression, more than one unlimited dimension, etc.
852
853Some effort is made to simulate the way an \anuga program would write data.  In  particular,
854the variables written are interleaved in the way \anuga would write them.
855
856Also, each data value written to the file is a floating point number which encodes
857variable number, variable 'slice' and index into each slice.  This is to ensure that
858each variable value written is unique and to allow for checking that what we read is what we wrote.
859
860\subsubsection{Using write_large_files}
861\label{subsubsec:write_large_files_use}
862
863There are three programs in the \code{write_large_files} suite:
864
865\begin{tabular}{ l l }
866  rwi_big_file.py & writes using the \emph{classic} model \\
867  rwil_big_file.py & writes using the \emph{large} model \\
868  rwi4_big_file.py & writes using the \emph{NetCDF4} model \\
869\end{tabular}
870
871Each of the three programs is used in the same way:
872
873\begin{verbatim}
874Usage: write_large_files <opts> <varsize> [<numvars>]
875
876where <varsize> is a number followed by an optional modifier:
877                    1024M or 4G
878                the assumed modifier if none is given is 'M'.
879  and <numvars> is the number of variables of the above size
880                    to write.  If not supplied, 1 is assumed.
881                    There can be at most 100 variables.
882  and <opts>    is zero or more of:
883                    -c s    close & open the output file after
884                            each variable slice is read/written,
885                    -t rf   time the complete file read,
886                    -t wf   time the complete file write,
887\end{verbatim}
888
889For instance, if we wanted to write a 3GiB 'large' file containing 6 variables we would do:
890
891\begin{verbatim}
892python rwil_big_file.py 512M 6
893\end{verbatim}
894
895\subsubsection{Installing write_large_files}
896\label{subsubsec:write_large_files_install}
897
898No installation is necessary, just execute the programs.
899
900%begin{latexonly}
901%\renewcommand{\indexname}{Index}
902%end{latexonly}
903\input{\jobname.ind}            % Index
904
905\end{document}
Note: See TracBrowser for help on using the repository browser.