Difference between revisions of "ASC to ASC"

From Tuflow
Jump to navigation Jump to search
m (Protected "ASC to ASC": High traffic page ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
Line 1: Line 1:
 +
<ol>
 
=Introduction=
 
=Introduction=
 
asc_to_asc.exe is a utility used for generating the difference between two .asc (ESRI ASCII grid) files. <br>
 
asc_to_asc.exe is a utility used for generating the difference between two .asc (ESRI ASCII grid) files. <br>
Line 4: Line 5:
 
The input grids are generally processed using the TUFLOW_to_GIS utility described <u>[[TUFLOW_to_GIS|here]]</u>.  Both .asc files must be of the same row/column dimensions.
 
The input grids are generally processed using the TUFLOW_to_GIS utility described <u>[[TUFLOW_to_GIS|here]]</u>.  Both .asc files must be of the same row/column dimensions.
  
=Options (switches=
+
=Operations=
A list of the available switches is provided in the table below:<br>
+
==Maximum==
{| align="center" class="wikitable"
+
'''"-max"'''<br>
 
+
Determines the maximum value in all the input .asc files. Two output grids are created:<br>
! Switch
+
*A numerical grid containing the maximum value.<br>
! width=90% | Description
+
*A classified grid with the name _src.asc which contains the source grid for the maximum value.
|-
+
<li><tt>asc_to_asc.exe  -max Q100_30min_h.asc Q100_45min_h.asc Q100_60min_h.asc</tt><br>
|"-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.
+
Creates a new grid containing the maximum of the 3 input water level grids.</li>
|-
+
<li><tt>asc_to_asc.exe -out Q100_Max_Levels.asc -max Q100_30min_h.asc Q100_45min_h.asc Q100_60min_h.asc</tt><br>
|"-dif"||Takes the difference between the first two .asc files, the second grid is subtracted from the first.  If an optional third .asc file is specified, this is used as the output file, otherwise, asc_to_asc creates its own output filename using the names of the two input .dat files.  The output is the first .asc file minus the second .asc file.  
+
As per item 2 above, but specifies the output name "Q100_Max_Levels.asc".</li><br>
 +
==Difference==
 +
'''"-dif"'''<br>
 +
Takes the difference between the first two .asc files, the second grid is subtracted from the first.  If an optional third .asc file is specified, this is used as the output file, otherwise, asc_to_asc creates its own output filename using the names of the two input .dat files.  The output is the first .asc file minus the second .asc file.  
 
Two .asc grids are output:
 
Two .asc grids are output:
 
*The first is the difference values between the two .asc files.  A difference value only occurs at grid cells that have a value in both grids.  If the cell has a null value (ie. the TUFLOW output was dry at that location) in either or both .asc grids, a null value is output.
 
*The first is the difference values between the two .asc files.  A difference value only occurs at grid cells that have a value in both grids.  If the cell has a null value (ie. the TUFLOW output was dry at that location) in either or both .asc grids, a null value is output.
 
*A second grid with a “_wd” suffix is output to indicate which .asc grid cells were either previously wet and are now dry or vica versa.  Importing this grid into Vertical Mapper creates a .grc (grid classification) grid that has two categories: “Was Wet Now Dry” and “Was Dry Now Wet”.  This grid is particularly useful for displaying areas that were previously inundated or previously flood-free.
 
*A second grid with a “_wd” suffix is output to indicate which .asc grid cells were either previously wet and are now dry or vica versa.  Importing this grid into Vertical Mapper creates a .grc (grid classification) grid that has two categories: “Was Wet Now Dry” and “Was Dry Now Wet”.  This grid is particularly useful for displaying areas that were previously inundated or previously flood-free.
|-
 
|"-out <output grid name>"||Specify the output filename for the new grid. This overwrites the a third grid if using the -dif option described above.<br> '''Note:''' a space is required between the -out and the filename.
 
|-
 
|"-max"||Determines the maximum value in all the input .asc files. Two output grids are created:<br>
 
*A numerical grid containing the maximum value.<br>
 
*A classified grid with the name _src.asc which contains the source grid for the maximum value.
 
|-
 
|"-cd<cutoff value>"||Outputs a new file only where the value is greater than the cutoff value.<br>
 
*If only one grid is specified this grid is processed.<br>
 
*If two grids are specified, the first value is used for setting the cutoff depth and the second grid is processed.<br>
 
*If three grids are specified, the third grid is used for setting the filename for the output grid. This is ignored if the "-out" option is used.
 
|}
 
=Examples=
 
<ol>
 
==Difference Examples==
 
 
<li><tt>asc_to_asc.exe -out difference.asc -dif after_h.asc before_h.asc</tt><br>
 
<li><tt>asc_to_asc.exe -out difference.asc -dif after_h.asc before_h.asc</tt><br>
 
Creates new grids comparing the differences in flood levels and extents for:<br>
 
Creates new grids comparing the differences in flood levels and extents for:<br>
 
"difference.asc" = "after_h.asc" - "before_h.asc"</li><br>
 
"difference.asc" = "after_h.asc" - "before_h.asc"</li><br>
==Maximum Example==
+
==Cutoff Depth==
<li><tt>asc_to_asc.exe  -max Q100_30min_h.asc Q100_45min_h.asc Q100_60min_h.asc</tt><br>
+
'''"-cd<cutoff value>"''' <br>
Creates a new grid containing the maximum of the 3 input water level grids.</li>
+
Outputs a new file only where the value is greater than the cutoff value.<br>
<li><tt>asc_to_asc.exe -out Q100_Max_Levels.asc -max Q100_30min_h.asc Q100_45min_h.asc Q100_60min_h.asc</tt><br>
+
*If only one grid is specified this grid is processed.<br>
As per item 2 above, but specifies the output name "Q100_Max_Levels.asc".</li><br>
+
*If two grids are specified, the first value is used for setting the cutoff depth and the values from the second grid are processed.<br>
==Cutoff Value Examples==
+
*If three grids are specified, the third grid is used for setting the filename for the output grid. This is ignored if the "-out" option is used.
 
<li><tt>asc_to_asc.exe -cd0.1 depth.asc</tt><br>
 
<li><tt>asc_to_asc.exe -cd0.1 depth.asc</tt><br>
 
Creates a new depth grid only where the depth is greater than 0.1m.</li><br>
 
Creates a new depth grid only where the depth is greater than 0.1m.</li><br>
Line 46: Line 35:
 
Creates a new level grid only where the depth is greater than 0.1m.</li><br>
 
Creates a new level grid only where the depth is greater than 0.1m.</li><br>
 
<li><tt>asc_to_asc.exe -cd0.1 -out filtered_levels.asc. depths.asc levels.asc</tt><br>
 
<li><tt>asc_to_asc.exe -cd0.1 -out filtered_levels.asc. depths.asc levels.asc</tt><br>
As per Example 3, but outputs to "filtered_levels.asc".</li><br>
+
As per Example above, but sets the output name as "filtered_levels.asc".</li><br>
 +
==Resize==
 +
'''"-resize<factor>"'''<br>
 +
Resize the grid based on the factor above.  The factor must be an integer (greater than 1).  The output grid has the same origin (lower left) coordinates as the input grid.  The new cell size is the factor times the old cell size.  For example if a -resize5 is used on a 2m resolution grid the output grid will be 10m.  For processing the grid three options are available
 +
===Average (default)===
 +
This is the defualt processing method, which can also be specified with the '''-rm_avg''' (resize method - average) input flag.  When processing for each tile in the new grid, the average of all non-null values in the input grid is taken.  For example with a resize factor of 5, the 25 values in the input grid are averaged.
 +
<li><tt>asc_to_asc.exe -resize5 -out DEM_10m.asc DEM_2m.asc</tt><br>
 +
Creates a new 10m DEM (DEM_10m.asc) based on the the 2m DEM using an averaging approach.</li><br>
 +
===Minimum===
 +
Alternative processing method for resize, specified with the '''-rm_min''' (resize method - minimum) flag.  At each output grid the values is the minimum of the values in the input grid.
 +
<li><tt>asc_to_asc.exe -resize5 -rm_min -out DEM_10m_min.asc DEM_2m.asc</tt><br>
 +
Creates a new 10m DEM (DEM_10m_min.asc) based on the the 2m DEM using an minimum approach.</li><br>
 +
===Maximum===
 +
Alternative processing method for resize, specified with the '''-rm_max''' (resize method - maximum) flag.  At each output grid the values is the maximum of the values in the input grid.
 +
<li><tt>asc_to_asc.exe -resize5 -rm_max -out DEM_10m_max.asc DEM_2m.asc</tt><br>
 +
Creates a new 10m DEM (DEM_10m_max.asc) based on the the 2m DEM using an maximum approach.</li><br>
 +
==Transform==
 +
Transforms the values using a simple y = mx + c approach the multiplier (m) is specified with flag '''-trans_m<value>'''.  The add value (c)'''-trans_c<value>'''.  Only one values is required to be specified.
 +
<li><tt>asc_to_asc.exe -trans_m0.3048 DEM.asc</tt><br>
 +
Multiplies all values by 0.3048.</li><br>
 +
<li><tt>asc_to_asc.exe -trans_m0.3048 -trans_c10 DEM.asc</tt><br>
 +
Multiplies all values by 0.3048 and then adds 10.0.</li><br>
 +
==Classify==
 +
Classifies the grid based on the input classifications.  The output file is a classified .asc grid.  The classification .csv file should have two columns cutoff value and name (in that order). The first line in .csv treated as a header line and ignored.  Any values over the greatest cutoff with be outputted to class "above".<br>
 +
{| align="center" class="wikitable"
 +
 
 +
! style="background-color:#005581; font-weight:bold; color:white;"| Cutoff Value
 +
! style="background-color:#005581; font-weight:bold; color:white;" width=50% | Name
 +
|-
 +
|0.5|| Less than 0.5
 +
|-
 +
|1.0|| 0.5 to 1.0
 +
|-
 +
|2.0|| 1.0 to 2.0
 +
|}
 +
<li><tt>asc_to_asc.exe -classify classifications.csv results_VMax.asc</tt><br>
 +
Outputs a classified grid, based on the cut off values and names in the "classifications.csv".</li><br>
 +
=Other Options (switches)=
 +
A list of the general switches is provided in the table below, these are available for all operations listed above:<br>
 +
{| align="center" class="wikitable"
 +
 
 +
! Switch
 +
! width=90% | 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.
 +
|-
 +
|"-out <output grid name>"||Specify the output filename for the new grid. This overwrites the a third grid if using the -dif option described above.<br> '''Note:''' a space is required between the -out and the filename.
 +
|}
 +
 
 
</ol>
 
</ol>
 
{{Tips Navigation
 
{{Tips Navigation
 
|uplink=[[TUFLOW_Utilities | Back to TUFLOW Utilities]]
 
|uplink=[[TUFLOW_Utilities | Back to TUFLOW Utilities]]
 
}}
 
}}

Revision as of 07:24, 15 February 2013

    Introduction

    asc_to_asc.exe is a utility used for generating the difference between two .asc (ESRI ASCII grid) files.
    This utility is useful for comparing and processing TUFLOW outputs from different .2dm meshes, which can't be compared with the dat_to_dat.exe.
    The input grids are generally processed using the TUFLOW_to_GIS utility described here. Both .asc files must be of the same row/column dimensions.

    Operations

    Maximum

    "-max"
    Determines the maximum value in all the input .asc files. Two output grids are created:

    • A numerical grid containing the maximum value.
    • A classified grid with the name _src.asc which contains the source grid for the maximum value.
  1. asc_to_asc.exe -max Q100_30min_h.asc Q100_45min_h.asc Q100_60min_h.asc
    Creates a new grid containing the maximum of the 3 input water level grids.
  2. asc_to_asc.exe -out Q100_Max_Levels.asc -max Q100_30min_h.asc Q100_45min_h.asc Q100_60min_h.asc
    As per item 2 above, but specifies the output name "Q100_Max_Levels.asc".

  3. Difference

    "-dif"
    Takes the difference between the first two .asc files, the second grid is subtracted from the first. If an optional third .asc file is specified, this is used as the output file, otherwise, asc_to_asc creates its own output filename using the names of the two input .dat files. The output is the first .asc file minus the second .asc file. Two .asc grids are output:

    • The first is the difference values between the two .asc files. A difference value only occurs at grid cells that have a value in both grids. If the cell has a null value (ie. the TUFLOW output was dry at that location) in either or both .asc grids, a null value is output.
    • A second grid with a “_wd” suffix is output to indicate which .asc grid cells were either previously wet and are now dry or vica versa. Importing this grid into Vertical Mapper creates a .grc (grid classification) grid that has two categories: “Was Wet Now Dry” and “Was Dry Now Wet”. This grid is particularly useful for displaying areas that were previously inundated or previously flood-free.
  4. asc_to_asc.exe -out difference.asc -dif after_h.asc before_h.asc
    Creates new grids comparing the differences in flood levels and extents for:
    "difference.asc" = "after_h.asc" - "before_h.asc"

  5. Cutoff Depth

    "-cd<cutoff value>"
    Outputs a new file only where the value is greater than the cutoff value.

    • If only one grid is specified this grid is processed.
    • If two grids are specified, the first value is used for setting the cutoff depth and the values from the second grid are processed.
    • If three grids are specified, the third grid is used for setting the filename for the output grid. This is ignored if the "-out" option is used.
  6. asc_to_asc.exe -cd0.1 depth.asc
    Creates a new depth grid only where the depth is greater than 0.1m.

  7. asc_to_asc.exe -cd0.1 depth.asc. levels.asc
    Creates a new level grid only where the depth is greater than 0.1m.

  8. asc_to_asc.exe -cd0.1 -out filtered_levels.asc. depths.asc levels.asc
    As per Example above, but sets the output name as "filtered_levels.asc".

  9. Resize

    "-resize<factor>"
    Resize the grid based on the factor above. The factor must be an integer (greater than 1). The output grid has the same origin (lower left) coordinates as the input grid. The new cell size is the factor times the old cell size. For example if a -resize5 is used on a 2m resolution grid the output grid will be 10m. For processing the grid three options are available

    Average (default)

    This is the defualt processing method, which can also be specified with the -rm_avg (resize method - average) input flag. When processing for each tile in the new grid, the average of all non-null values in the input grid is taken. For example with a resize factor of 5, the 25 values in the input grid are averaged.

  10. asc_to_asc.exe -resize5 -out DEM_10m.asc DEM_2m.asc
    Creates a new 10m DEM (DEM_10m.asc) based on the the 2m DEM using an averaging approach.

  11. Minimum

    Alternative processing method for resize, specified with the -rm_min (resize method - minimum) flag. At each output grid the values is the minimum of the values in the input grid.

  12. asc_to_asc.exe -resize5 -rm_min -out DEM_10m_min.asc DEM_2m.asc
    Creates a new 10m DEM (DEM_10m_min.asc) based on the the 2m DEM using an minimum approach.

  13. Maximum

    Alternative processing method for resize, specified with the -rm_max (resize method - maximum) flag. At each output grid the values is the maximum of the values in the input grid.

  14. asc_to_asc.exe -resize5 -rm_max -out DEM_10m_max.asc DEM_2m.asc
    Creates a new 10m DEM (DEM_10m_max.asc) based on the the 2m DEM using an maximum approach.

  15. Transform

    Transforms the values using a simple y = mx + c approach the multiplier (m) is specified with flag -trans_m<value>. The add value (c)-trans_c<value>. Only one values is required to be specified.

  16. asc_to_asc.exe -trans_m0.3048 DEM.asc
    Multiplies all values by 0.3048.

  17. asc_to_asc.exe -trans_m0.3048 -trans_c10 DEM.asc
    Multiplies all values by 0.3048 and then adds 10.0.

  18. Classify

    Classifies the grid based on the input classifications. The output file is a classified .asc grid. The classification .csv file should have two columns cutoff value and name (in that order). The first line in .csv treated as a header line and ignored. Any values over the greatest cutoff with be outputted to class "above".

    Cutoff Value Name
    0.5 Less than 0.5
    1.0 0.5 to 1.0
    2.0 1.0 to 2.0
  19. asc_to_asc.exe -classify classifications.csv results_VMax.asc
    Outputs a classified grid, based on the cut off values and names in the "classifications.csv".

  20. Other Options (switches)

    A list of the general switches is provided in the table below, these are available for all operations listed above:

    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.
    "-out <output grid name>" Specify the output filename for the new grid. This overwrites the a third grid if using the -dif option described above.
    Note: a space is required between the -out and the filename.
Up
Go-up.png Back to TUFLOW Utilities