ANUGA FAQ
Analysing Results
How do I easily plot "tide gauge" timeseries graphs from a SWW file?
There are two ways to do this.
- Create .csv files from the .sww file using {anuga.abstract_2d_finite_volumes.util sww2csv_gauges and then use anuga.abstract_2d_finite_volumes.util csv2timeseries_graphs to create the plots. This code is newer, has unit tests and might be easier to use. Read doc strings for more information and review the "Exploring the Model Output" section of the User Manual.
- Use anuga.abstract_2d_finite_volumes.util sww2timeseries to do the whole thing, however this doesn't have a much control on the file name and plots. Plus there are no unit tests yet.
Read the doc string for more information.
How do I extract elevation and other quantities from a SWW file?
The function sww2dem can extract any quantity, or expression using quantities, from a SWW file as used in the Cairns example described earlier. This function is used in ExportResults.py in the Cairns demo folder where stage, absolute momentum, depth, speed and elevation can be exported from the input .sww file. Note that depth, absolute momentum and speed are expressions and stage and elevation are quantities. In addition to extracting a particular quantity or expression, the user can define a region to extract these values by defining the minimum and maximum of both the easting and northing coordinates. The function also calls for a grid resolution, or cell size, to extract these values at. It is recommended to align this resolution with the mesh resolution in the desired region and to not generate a fine grid where the model output cannot support that resolution.
The viewer can't open the sww files anymore
Since July 2009, ANUGA has moved towards a new NetCDF library that, amongst other things, allows larger output files and removes reliance on the old no longer supported Numeric package. A new viewer is on its way, but meanwhile it is possible to convert the sww files to the old format by following the instructions provided below:
This link to the NetCDF FAQ explains how to convert a 'classic' NetCDF file to 'large' model is at http://www.unidata.ucar.edu/software/netcdf/docs/faq.html#fv14. The command to see what type of NetCDF format a file is:
ncdump -k [filename]
This is documented at: http://www.unidata.ucar.edu/software/netcdf/docs/faq.html#Large%20File%20Support5
To convert 64-bit offset format sww files produced by versions of ANUGA after June 2009, you can do the following under both Windows and Linux:
ncdump new.sww > fred.ncd ncgen -o old.sww fred.ncd
Note that the fred.ncd file may be very large. If you are using Linux or Unix you can do the following and not generate the large intermediate file:
ncdump new.sww | ncgen -o old.sww
Also note that you must use a version of NetCDF that supports reading new large format sww files.
There is a new directory in the ANUGA repository misc/tools/n2o that has a conversion unix shell script based on the above.
Does the sww file viewer (animate) work under Linux
The viewer that comes with ANUGA (anuga_viewer.exe) is available in compiled form for Windows. Checkout http://sourceforge.net/projects/anuga/files/anuga_viewer_windows/
The source code is Open Source and the library it is using, Open Scene Graph, is also Open Source and known to work under Linux. Here is a link describing how to compile it on linux https://anuga.anu.edu.au/wiki/InstallViewer