Difference between revisions of "TUFLOW to GIS"

From Tuflow
Jump to navigation Jump to search
Line 20: Line 20:
 
The most common way to run the utility is from a batchfile.  This allows the user to process multiple outputs at once. A batch file is simply a plain text file containing one or more lines that execute a utility as per the example sections below.<br>
 
The most common way to run the utility is from a batchfile.  This allows the user to process multiple outputs at once. A batch file is simply a plain text file containing one or more lines that execute a utility as per the example sections below.<br>
 
<br>
 
<br>
For more common tasks a right click function can be setup in Windows to perform a particular conversion. FileMenuTools can be used to set custom right click functionality, the method is similar to the method of starting [[Run_TUFLOW_Right-Click_Windows_7 | TUFLOW from a right click]].  The '''Program''' input should refer to the location of the TUFLOW_to_GIS executable and the '''Arguments''' input should contain the desired option and then %FILENAMES%.  For example <tt>-b -asc -TypeAll -max %FILENAMES%</tt> could be used to convert all of the "Maximums" data into gridded .asc format.
+
For more common tasks a right click function can be setup in Windows to perform a particular conversion. FileMenuTools can be used to set custom right click functionality, the method is described  in the [[Windows_Right_Click_Functionality| Windows Right Click Functionality]].  The '''Program''' input should refer to the location of the TUFLOW_to_GIS executable and the '''Arguments''' input should contain the desired option and then %FILENAMES%.  For example <tt>-b -asc -TypeAll -max %FILENAMES%</tt> could be used to convert all of the "Maximums" data into gridded .asc format.
  
 
=Output Options=
 
=Output Options=

Revision as of 11:11, 5 August 2014

Introduction

The TUFLOW_to_GIS.exe is a utility available on the the TUFLOW website (Download TUFLOW utilities).
The utility can be used to convert TUFLOW outputs (.dat and .xmdf) into formats that can be imported into GIS packages such as MapInfo, ArcGIS, QGIS and SAGA.
Note That as per the 2013 version of TUFLOW, TUFLOW can now write directly to the gridded formats (.asc and .flt). This avoids the need for a separate conversion step. This is outlined in the release notes.

The output frequency and data types can now be specified independently for each data output format. An example is given below:
Map Output Data Format == XMDF ASC
XMDF Map Output Data Types == h v d MB1
XMDF Map Output Interval == 300
ASC Map Output Data Types == h v d Z0
ASC Map Output Interval == 0
In the example above, both .xmdf and .asc are written directly by TUFLOW. For the .xmdf output the water levels, velocity, depth and mass balance output are written every 300 seconds (5 minutes). For the .asc format the water levels, velocities, depths and hazard (velocity depth product) are written. These are written only for the maximum (ASC Map Output Interval == 0).

The TUFLOW to GIS utility can output to grid format and also MapInfo and Shapefile format. For the MapInfo and Shapefile format this can be either as points, or as arrows.

Running TUFLOW_to_GIS

Simply double clicking on the TUFLOW_to_GIS executable will bring up a DOS prompt that that gives you some instructions on running the utility.
The most common way to run the utility is from a batchfile. This allows the user to process multiple outputs at once. A batch file is simply a plain text file containing one or more lines that execute a utility as per the example sections below.

For more common tasks a right click function can be setup in Windows to perform a particular conversion. FileMenuTools can be used to set custom right click functionality, the method is described in the Windows Right Click Functionality. The Program input should refer to the location of the TUFLOW_to_GIS executable and the Arguments input should contain the desired option and then %FILENAMES%. For example -b -asc -TypeAll -max %FILENAMES% could be used to convert all of the "Maximums" data into gridded .asc format.

Output Options

Gridded Data

Gridded (raster) data is outputted in the ESRI ASCII grid format. This is plain text format and is very widely recognised and used by a variety of GIS software including ArcGIS (requires Spatial Analyst), QGIS, SAGA and MapInfo (requires Vertical Mapper or Encom Discover). This is specified with the flag -asc.

Point and Vector Data

Vector outputs (e.g. velocity or flow) can be written as either points or arrows. Scalar outputs (e.g. depth or level) can be written as points. These can currently be written out in either MapInfo format (.mif) or ArcGIS shapefiles (.shp). The -mif flag is used to output in MapInfo format and -shp to output in shapefile format. Only one type (-mif or -shp) can be processed at a time, to output in both formats, use two entries in a batchfile.

Input Flags (switches)

A list of the input switches is provided in the 2010 TUFLOW manual as Table 11.1. However, the most common arguments are:

Switch Description
"-b" Run the utility in batch mode, this suppresses the prompt to press enter at the end of processing. Used in .bat files where two or more files are to be processed.
"-asc" The output file will be in ESRI ASCII Grid format, a text format recognised by most 3D grid modelling software (including Vertical Mapper, SAGA and QGIS)
"-mif" The output format will be the MapInfo Interchange format (.mif/.mid) recognised by most GIS software
"-shp" The output format will be the ArcGIS Shapefile format. This can be opened directly in ArcMap, QGIS or SAGA (and most GIS software)
"-vector" or "-arrows" The output will contain arrows as polygons to display vector data (eg. velocities and unit flows) in GIS. Must be used with the -mif option.
"-t<output time>" Converts the data at the specified timestep, for example -t2 to convert output time 2 hours. If this switch is omitted the utility will display a list of available times and prompt for an input. Use -t99999 or -max to convert the maximums.
"-max" or "-t99999" The maximums will be converted. The maximums must have been written to be able to convert using the -max or -t99999 switch. See the .tcf file command (Store Maximums and Minimums == ON MAXIMUMS ONLY).
"-sf<scale factor>" Scale factor to scale the size of the arrows. The default is sf = 1, which means either:
  • if grid is not specified the cell size of the first 2D domain in the .tcf file is equivalent in length to an arrow of 1m/s for _V.dat files or 1m2/s for _q.dat files.
  • if grid is specified, the grid <dist> value is used instead of the cell size of the first 2D domain to scale the arrows.
    For example, if the first 2D domain has a cell size of 10m, by default, a 1m/s velocity arrow will be 10m long. If sf0.5 or grid5, is specified the 1m/s velocity arrow will be 5m long.
"-2dm <.2dm file>" To explicitly specify a .2dm file. By default TUFLOW_to_GIS assumes the .2dm file has the same name as the .dat file. Must be a space between -2dm and “<2dm_file>”.
"-grid<dist>" The output will be on a regular north-south aligned grid of spacing <dist> metres. If no <dist> is specified the user is prompted to enter a distance (e.g. "-grid"). If no grid input is used with a -mif or -shp conversion the data is converted at the cell corners. For a "-asc" output if no grid input is specified the default is 1/2 of the 2D cell size.

For -asc output it sets the raster cell size of the 3D ESRI ASCII grid.
For -mif or -shp output sets the interval in metres for the output on a north-south alignment.

"-type<output type>" For use with .xmdf inputs, in which all inputs are stored in the one .xmdf file. Use this to convert a specific output type. Output types should as specified per the output type in the .tcf eg. h (water level), V (velocity), q (flow), or d (depth).Scale factor to scale the size of the arrows.

Examples

    Converting to 3D grids

    Probably the most common use of the TUFLOW_to_GIS utility is to convert the maximum results to a 3D surface. A number of examples are given below:

    • Convert maximums to a 3D grid:
  1. TUFLOW_to_GIS.exe -asc -b -max M01_5m_003_h.dat
  2. Description: Convert to a 3D grid ("-asc"), using batch mode ("-b"), converting the maximums ("-max") for the water level results M01_5m_003_h.dat.
    • Convert to a 3D grid at a specific time:
  3. TUFLOW_to_GIS.exe -asc -b -t3 M01_5m_003_h.dat
  4. Description: As per example 1, except conversion at time 3 hours (-t3) instead of the maximums.
    • Convert to a 3D grid of specified grid cell size:
  5. TUFLOW_to_GIS.exe -asc -b -grid1 -max M01_5m_003_h.dat
  6. Description: As per example 1, except the raster cell size is specified at 1m instead of being half the 2D cell size.
    • Convert to a 3D grid from .xmdf file:
  7. TUFLOW_to_GIS.exe -asc -b -typeh -max M01_5m_003.xmdf
  8. Description: As per example 1, output TUFLOW format is .xmdf. The -typeh specifies the h(water level) output to be converted.
  9. TUFLOW_to_GIS.exe -asc -b -typeV -max M01_5m_003.xmdf
  10. Description: As per example 4, except the the velocity results (-typeV) are processed instead of water level (-typeh).

    Converting to Points

    To output to a points file specify either a MapInfo output with the "-mif" switch or Arc shapefiles output with the "-shp" output. To output at cell corners only:

    • Convert maximums to a MapInfo Points file at cell corners:
  11. TUFLOW_to_GIS.exe -mif -b -max M01_5m_003_h.dat
  12. Description: Convert to a MapInfo format ("-mif"), using batch mode ("-b"), converting the maximums ("-max") for the water level results M01_5m_003_h.dat.
    • Convert maximums to a MapInfo Points file on a regular grid:
  13. TUFLOW_to_GIS.exe -mif -grid2 -b -max M01_5m_003_h.dat
  14. Description: Convert to a MapInfo format ("-mif") on a regular 2m grid ("-grid2"), using batch mode ("-b"), converting the maximums ("-max") for the water level results M01_5m_003_h.dat.
    To export either of the above to shapefile format simply replace the "-mif" with "-shp".
    • Convert velocity at time 2 hours MapInfo points file, where the results file is in xmdf format:
  15. TUFLOW_to_GIS.exe -shp -b -t2 -typeV M01_5m_003.xmdf
  16. Description: Convert to a ArcGIS shapefile format ("-shp"), using batch mode ("-b"), at time of 2 hours ("-t2"), converting the velocity output ("-typeV") for the results file M01_5m_003.xmdf.

    Converting to Arrows

    To output to vectors file specify either a MapInfo "-mif" or Arc shapefiles ("-shp") output type and the "-vector" option. This will create a vector dataset, with the vectors stored as polygon objects.
    The size of the vectors can be controlled with the scale factor ("-sf") switch. NOTE: The input .dat file or dataset type must be a vector dataset, such as velocity or unit flow.

    • Convert output time 2 to a MapInfo vector file at cell corners:
  17. TUFLOW_to_GIS.exe -mif -vector -b -t2 M01_5m_003_V.dat
  18. Description: Convert to a MapInfo format ("-mif"), using vector outputs ("-vector"), using batch mode ("-b") and converting at time 2 hours ("-t2") for the velocity results M01_5m_003_V.dat.
    • Convert output time 2 to a MapInfo vector file at cell corners:
  19. TUFLOW_to_GIS.exe -mif -vector -sf0.5 -b -t2 M01_5m_003_V.dat
  20. Description: As above with a scale factor of 0.5, so that the arrows will be half the length.
    • Convert output time 2 to a ArcGIS shapefile on a regular grid of 2m spacing:
  21. TUFLOW_to_GIS.exe -mif -vector -grid2 -b -t2 M01_5m_003_q.dat
  22. Description: Convert to a ArcGIS shapefile ("-shp"), using vector outputs ("-vector") on a regular 2 metre grid ("-grid2") using batch mode ("-b") and converting at time 2 hours ("-t2") for the unit flow results M01_5m_003_q.dat.
Up
Go-up.png Back to TUFLOW Utilities