source: trunk/anuga_user_manual/source/anuga_internal_tools.tex @ 9402

Last change on this file since 9402 was 9090, checked in by steve, 11 years ago

Move all the TeX source into a sub directoryto clean up user_manual directory

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