Difference between revisions of "TUFLOW Viewer"

From Tuflow
Jump to navigation Jump to search
Line 96: Line 96:
 
<li> '''[[TUFLOW_Viewer_-_Map_Outputs_-_Styling_Vector_Types | Style Vector Map Outputs]]''' - similar to the styling the scalar map outputs, there are a range of options for styling the vector layers.
 
<li> '''[[TUFLOW_Viewer_-_Map_Outputs_-_Styling_Vector_Types | Style Vector Map Outputs]]''' - similar to the styling the scalar map outputs, there are a range of options for styling the vector layers.
 
<li> '''[[TUFLOW_Viewer_-_Map_Outputs_-_Saving_Default_Styles | Save Default Styles]]''' - users can save default styles for result types so that they are automatically applied each time results are imported using TUFLOW Viewer.
 
<li> '''[[TUFLOW_Viewer_-_Map_Outputs_-_Saving_Default_Styles | Save Default Styles]]''' - users can save default styles for result types so that they are automatically applied each time results are imported using TUFLOW Viewer.
<li> '''Displaying the Mesh''' - the quickest way to toggle the mesh is to click the grid box in TUFLOW Viewer.
+
<li> '''[[TUFLOW_Viewer_-_Map_Outputs_-_Display_The_Mesh | Displaying The Mesh]]''' - the quickest way to toggle the mesh is to click the grid box in TUFLOW Viewer.
 
</ol>
 
</ol>
 
<br>
 
<br>

Revision as of 00:11, 24 February 2021

TUFLOW Viewer

TUFLOW Viewer replaces Crayfish and TUPLOT as the TUFLOW result viewer for QGIS for version 3.6 onwards. It uses the Mesh Data Abstraction Library (MDAL) available in QGIS to display and interact with TUFLOW map output results, and the TUFLOW results python library (the same library used by TUPLOT in earlier versions of QGIS) for viewing TUFLOW time series results.

How To Use

Basics

Some of the basic functionality are listed below this section and describe how to:

  1. Load Results
  2. Change Result Type
  3. Show Maximums
  4. Show Vectors
  5. Style 2D Results Layer
  6. Save Default Style For 2D Result
  7. Plot From Map Outputs
    1. Time Series
    2. Cross Section / Long Plot
    3. Flow
    4. Clear the Plot and Graphic Layers (coming soon)
  8. Plot From Time Series Output
  9. 1D Long Plot
  10. Use a Secondary Axis
  11. Change Plot Properties
  12. Export The Plot as an Image or CSV (coming soon)

Advanced

Some more advanced use is described in the following pages:

  1. Animations (coming soon)
  2. Maps (coming soon)
  3. Using a Date Axis (coming soon)
  4. Importing Calibration Data (coming soon)
  5. Batch Exporting Plots (coming soon)

Getting a Python Error

Occasionally the TUFLOW plugin will throw an exception and this will produce a Python Error which is displayed either as a yellow banner at the top of the map window or a window may appear stating than an 'Error has occurred while executing Python code'.
PythonError.PNG

What Does This Mean?

This means that the TUFLOW plugin has encountered something unusual or a situation that it does not know how to handle i.e. it has reached a line in the code that has failed to execute and as a consequence Python has bailed out. This means that all the code below this point that was meant to be executed has not. This can have knock on consequences as variables may not exist or be set to incorrect values and signal handling (e.g. what happens when a menu item is clicked) may be broken. So a python error can lead to further python errors that would normally not have occurred, so the first python error is usually the most important.

What To Do

  1. Email the Stack Trace to support@tuflow.com with a description of the steps that produced the python error (as best you can describe it). This is to help us identify bugs and fix the plugin so that it catches this exception in the future.
  2. If you find that you are now experiencing further python errors (probably caused by the initial error) you can try the following in order of severity:
    1. On the TUFLOW Viewer menu bar File >> Reload TUFLOW Viewer - this will reload TUFLOW Viewer, resetting all variables and signals. You will be required to load in any time series results again and other settings may also be reset. Map output results will remain in the workspace and be reloaded into TUFLOW Viewer.
    2. Save the workspace (.qgz) and restart QGIS
    3. Restart QGIS - you can save the workspace (.qgz), however you should first select on the TUFLOW Viewer menu bar File >> Close TUFLOW Viewer Completely - this will close the viewer and also remove all settings associated with it from the workspace so that the problematic variable is not accidentally reloaded with the workspace
    4. The nuclear option - Restart QGIS and load a new workspace from scratch (do not load a saved workspace)


Error While Upgrading the Plugin

Error_While_Upgrading_Plugin

Loading Results

Results can be loaded several ways:

Option 1

File >> Load Results

Option 2

Right Click in Open Results >> Load Results


The following options are available for loading into TUFLOW Viewer:

  1. Load Results --> This is done via a TCF, TLF, or FVC (TUFLOW FV) file and will load in all results (Map Outputs and ESTRY Time Series)
  2. Load Results - Map Outputs --> Select map output mesh results file (*.xmdf, *.dat, *.2dm, *.xmdf.sup, *.dat.sup, *.nc (supports netCDF format from TUFLOW FV output only))
  3. Load Results - Time Series --> Select ESTRY time series output results (*.tpc)
  4. Load Results - Time Series FM --> Load Flood Modeller results. This requires a .gxy and result .csv file to be exported from Flood Modeller.
  5. Load Results - Particles --> Select output from particle module (*.nc) which will typically be suffixed with _ptm
  6. Import 1D Hydraulic Tables --> Select a _1d_ta_tables_check.csv check file
  7. Import 1D ESTRY Cross-Sections --> This will automatically happen if an appropriate TUFLOW input is opened in QGIS while TUFLOW Viewer is open (e.g. 1d_xs)


If I Receive an Error?
If you receive an error similar to that below when trying to load results from a TCF:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 626: invalid start byte

This usually results from inconsistent encoding of the TUFLOW control files. You can fix this by changing the encoding of all your control files to a single type - typically UTF-8. You can do this using Notepad++, please see below link for how to do this (refer last image).
TUFLOW_Message_0060

Map Outputs

Map outputs are the 2D result outputs from TUFLOW (or 3D outputs from TUFLOW FV). Basic interaction with the map output results in TUFLOW Viewer are described below:

  1. Change Results - changing between different simulation results is done by selecting the result name(s) in the 'Open Results' widget
  2. Change Result Type - changing between different result types is done using the 'Result Type' widget
  3. Display Maximum - if available, maximums can be toggled on/off for the different result types
  4. Display Vectors - vector results can be displayed in combination with any of the scalar result types e.g. velocity vectors can be displayed with depth
  5. Style Scalar Map Outputs - styling scalar map output results is similar to styling raster layers in QGIS and can be done via QGIS properties (right click >> properties) or pressing F7 to open the properties docking window.
  6. Style Vector Map Outputs - similar to the styling the scalar map outputs, there are a range of options for styling the vector layers.
  7. Save Default Styles - users can save default styles for result types so that they are automatically applied each time results are imported using TUFLOW Viewer.
  8. Displaying The Mesh - the quickest way to toggle the mesh is to click the grid box in TUFLOW Viewer.


Changing Result Type

As simple as selecting a different result type in Result Type panel. You can only display one Scalar results and one Vector result at any given time.

File:ChangingResultType.gif

Showing Maximums

Option 1

Click the double up arrow next to the result type

Option 2

Right click the result type >> Check on Maximum


File:ToggleMax.gif

Showing Vectors

Select one of the Vector result types in the Result Types panel


File:ToggleVectors.gif

Styling 2D Results Layer

Option 1

Right Click mesh layer in Layers Panel >> Properties... >> Navigate to the Contour Tab at the top >> Select Colour Ramp in drop down box >> Click Load >> Click OK

Option 2

Right Click result type in Result Type Panel >> Properties... >> Navigate to the Contour Tab at the top >> Select Colour Ramp in drop down box >> Click Load >> Click OK



File:ChangeStyles.gif

Saving Default 2D Result Style

Saving a default style for a result type will mean that every time a result type of that name e.g 'Depth' is loaded, TUFLOW Viewer will automatically apply that style.

There are 2 options:

  1. Save Colour Ramp --> This will save the particular colour ramp as default. This means the actual min / max values will be adjusted based on the results. This is useful for results such as Bed Elevation or Water Level where the ranges are usually different depending on the model's location
  2. Save Colour Map --> This will save the exact values and associated colours used in the styling. This might be useful for results such as Depth or Velocity where a template can be applicable across different models


Right Click the result type >> Save Style As Default >> [Colour Ramp | Save Colour Map]
The default styling can be removed by selecting in the TUFLOW Viewer menubar Settings >> Reset Default Styles


File:SavingDefaultStyles.gif

Plotting From Map Outputs

Time Series

You can plot one or multiple temporal map output results as a time series.

  1. Choose which map outputs to plot --> click on the time series graph down arrow under Map Output Plotting >> Check on desired result types
  2. Click off the menu
  3. Click the time series graph again (not the down arrow)
  4. Click somewhere on your results


File:MapOutputPlotting TS.gif

2D Cross Sections and Long Sections

You can plot one or multiple map output results as a cross section for the current time step.

  1. Choose which map outputs to plot --> click on the cross-section graph down arrow under Map Output Plotting >> Check on desired result types
  2. Click off the menu
  3. Click the cross-section graph again (not the down arrow)
  4. Left click somewhere on your results to start the cross-section
  5. Left click to add vertices to your cross-section polyline
  6. Right click to finish


File:MapOutputPlotting CS.gif

Follow the steps above in the direction of flow to plot long sections.

Plotting Flow

You can post calculate flow from the map output results. Note that this approach should be used for approximation only. The preferred method is to use a PO line in TUFLOW.

  1. Click on the Plot Flux button down arrow under Map Output Plotting
  2. Left click somewhere on your results to start the flux line
  3. Left click to add vertices to your flux line
  4. Right click to finish

The direction convention is the same as PO lines in TUFLOW - the positive direction of flow is from left bank to right bank looking downstream
File:MapOutputPlotting Q.gif

Plotting Long Section From Shape File

It's possible to plot time series, flow, cross sections, and long plots using an existing shape file (or other vector formats supported by QGIS). Example below using a shape file to plot a long section:

  1. Select polyline used for plotting (time series will use point object)
  2. Choose Layer Selection under Map Output Plotting
  3. Choose which map outputs to plot --> click on the cross-section graph down arrow under Map Output Plotting >> Check on desired result types
  4. Click the cross-section graph again (not the down arrow)


File:2D long plot from selection.gif

Plotting From Time Series Outputs

If time series results are loaded in (e.g. 1D results) you can plot from the outputted types.

  1. Select result type e.g Flow under the Time Series section in the Result Types
  2. Use QGIS Select Tool and select one of the PLOT GIS features


File:TimeSeriesPlotting Q.gif

Plotting 1D Long Sections

If time series results are loaded in (e.g. 1D results) you can plot long sections from the results. Example below plotting a long section from stormwater pipes:

  1. Select single channel (pipe) from the PLOT_L GIS layer
  2. Select a long section result type e.g Water Level and/or Culverts and Pipes (Long section result types have the icon with a light blue line)
  3. Selecting a second channel downstream of the first will plot the long section between the selected channels (if no second channel is selected, the long section will plot until the outlet)


File:1D long plot from selection.gif

Using a Secondary Axis

If you are plotting multiple result types at once, you may want to plot one or more of the lines on a secondary axis. This can be done 2 ways:
Option 1

Click the Secondary Axis icon on the appropriate result type in the Result Types Panel

Option 2

Right Click on the appropriate result type in the Result Types Panel and check on Secondary Axis


File:ToggleSecondaryAxis.gif

Changing Plot Properties

Plot properties can be changed via
Option 1

TUFLOW Viewer Settings >> Customise

Option 2

Customise tool icon in the plot toolbar


Using this, properties such as the plot axis, item name in legend, and line / point styling can be modified. The styling is saved in the session and will be used the next time the same plot type (e.g. depth time series) is plotted.

Changing the default colours

The default colours are randomly generated when TUFLOW Viewer is opened and can be re-generated by selecting Settings >> Reset Plotting Colours. This will also reset any custom line properties the user may have set.

Changing the axis limits and names

The same process can be used to set the axis limits and axis names. The axis names will be saved in the session and can be reset to default by selecting Settings >> Reset Plot Axis Names. Changing the axis limits will cause the plot axis to become frozen (depending on which axis limits was changed). The axis limits can be unfrozen by unchecking the relevant axis icon in the plot toolbar.
File:Axis limits frozen.png

File:PlotProperties 1.gif

File:PlotProperties 2.gif

File:PlotProperties 3.gif

File:PlotProperties 4.gif