ASC to ASC: Difference between revisions
Content deleted Content added
| No edit summary | |||
| (11 intermediate revisions by 3 users not shown) | |||
| Line 7: =2023-03-AA (and later)= <span style="color:red;font-size:14">This release incorporates new GIS/GRID formats included in the 2023-03-AA TUFLOW release. Some slight changes to the  The '''ASC_to_ASC-2023-03-AA''' release incorporates several new GIS formats - '''GeoTIFF''', '''GPKG''', '''NetCDF''' (note: NetCDF was previously supported but now has better integration with all operations). The commands are largely unchanged and now support input and output to a range of new formats. Line 101: *Converts the file "DEM_M01.asc" for .flt format.<br> :<tt>asc_to_asc.exe -conv DEM_M01.asc</tt> ===No Data Values=== <b>"-ndv <val>"</b><br> An additional option to set the "no data value" is also possible when running the conversion function: <tt>-ndv <val></tt>. Note, this option will identify NaN values ("not a number") in the input grid, and treat them as no data values during the conversion (regardless of whether they are explicitly labelled as "no data values" in the grid header). This is useful if the user wants to remove all NaN values from the grid. Note, from the 2025.1 release and onwards, NaN's values in grid inputs are always treated as “no data values” and therefore grids can be read into TUFLOW directly without undertaking the below process. *Converts asc to tif and sets the "no data value" to -999 :<tt>asc_to_asc.exe -conv -tif -ndv -999 DEM_M01.asc</tt> *Removes all NaN values in a tif and replace them with -999 :<tt>asc_to_asc.exe -conv -tif -ndv -999 <input.tif> -out <output.tif></tt><nowiki>**</nowiki><br> <nowiki>**</nowiki> Note, in the above example it is important to specify an output name with <tt>-out</tt> when converting to the same format (e.g. tif to tif) as otherwise the output will overwrite the input.<br> ==Maximum== Line 108 ⟶ 119: *A classified grid with the name _src.asc which contains the source grid for the maximum value.<br> Examples:<br> *Creates a new grid containing the maximum of the 3 input water level grids.<br> :<tt>asc_to_asc.exe  -max Q100_30min_h.asc Q100_45min_h.asc Q100_60min_h.asc</tt><br> *As per item 2 above,  but specifies the output name "Q100_Max_Levels.asc".<br> :<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> *Wildcard character "*" is supported in filenames.<br> :<tt>asc_to_asc.exe -out Q100_Max_Levels.asc -max Q100_*min_h.asc</tt> ==Difference== Line 124 ⟶ 133: *A second grid with a “_wd” suffix is output to indicate which .asc grid cells were once wet and are now dry (value -99) or once dry and are now wet (value +99 with first .asc to be the developed case and second .asc to be the existing case).  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.<br> Example: *Creates new grids comparing the differences in flood levels and extents for: "difference.asc" = "after_h.asc" - "before_h.asc"<br> :< Secondary options (only one can be used): *"-nowetdry" does not carry out a wet/dry test. If both cells are active a difference is calculated. Line 139 ⟶ 147: *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.<br> Examples: *Creates a new depth grid only where the depth is greater than 0.1m.<br> :<tt>asc_to_asc.exe -cd0.1 depth.asc</tt> *Creates a new level grid only where the depth is greater than 0.1m.<br> :<tt>asc_to_asc.exe -cd0.1 depth.asc levels.asc</tt> *As per the example above, but sets the output name as "filtered_levels.asc".<br> :<tt>asc_to_asc.exe -cd0.1 -out filtered_levels.asc depths.asc levels.asc</tt> ==Resize== Line 154 ⟶ 160: 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.<br> Example: *Creates a new 10m DEM (DEM_10m.asc) based on the the 2m DEM using an averaging approach.<br> :<tt>asc_to_asc.exe -resize5 -out DEM_10m.asc DEM_2m.asc</tt> ===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.<br> Example: *Creates a new 10m DEM (DEM_10m_min.asc) based on the the 2m DEM using an minimum approach.<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.<br> Example: *Creates a new 10m DEM (DEM_10m_max.asc) based on the the 2m DEM using an maximum approach.<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.<br> Examples: *Multiplies all values by 0.3048.<br> :< *Multiplies all values by 0.3048 and then adds 10.0.<br> :<tt>asc_to_asc.exe -trans_m0.3048 -trans_c10 DEM.asc</tt> ==Decimal== Converts .flt to .asc format with specified number of decimal spaces. ASC format created directly from TUFLOW comes only with three decimal spaces, FLT format has more decimal spaces.<br> Example: *Converts all .flt grids to .asc format with 5 decimal spaces.<br> :<tt>asc_to_asc.exe -conv -decimal5 *.flt</tt> ==Classify== Line 206 ⟶ 202: |2.0|| 1.0 to 2.0 |} Examples: *Outputs a classified grid, based on the cut off values and names in the "classifications.csv".<br> :<tt>asc_to_asc.exe -classify classifications.csv results_VMax.asc</tt> *If using vertical mapper the -grc option can be used to create the .asc file in classified grid format, in this format rather than storing a numerical value when interrogating an area a label is returned.  This format is not recognised by ArcMap or QGIS.  If using the grc option it is also possible to specify the desired RGB (red, green, blue) values for the output grid in the .csv file used for the classification.  The RGB values should be specified in the 3-5th columns of the .csv file.<br> :<tt>asc_to_asc.exe -RGB -grc -classify depth_classify.csv results_dMax.asc</tt><br> :{| class="wikitable" ! style="background-color:#005581; font-weight:bold; color:white;" width=20% | Cutoff Value Line 234 ⟶ 228: [[File:TUFLOW Utilities GRC01.jpeg|600px]]<br> <br> ==Extract Breaklines from DEM== '''"-brkline <gis file in 2d_zsh format>"'''<br> This feature was added to the 2013-06-AA version of the utility.<br> Extracts elevations from a DEM for breaklines in the 2d_zsh format.  This GIS input should have four attributes, z, dz, width and shape_options, as described in the <u>[https://docs.tuflow.com/classic-hpc/manual/latest/ TUFLOW  Depending on the line width and DEM cell size, the following methods are used:<br> * If the width is set to 0, the closest DEM value to the vertex is used.  If a "shape_option" is specified this is ignored. Line 247 ⟶ 240: '''NOTE:''' For the output GIS file, the '''dz''' attribute is set to 0.0 regardless of the value set in the input field. <br> Example: *<tt>asc_to_asc.exe -brkline 2d_zsh_breaklines_L.shp DEM.asc</tt> ==Fuzzy Map== Line 258 ⟶ 248: For each input grid (or scenario) the grid is classed as either 1 if the results grid is wet or 0 if dry.  The total score for each grid cell is is calculated and then divided by the total number of input grids.  A value of 1 indicates that the cell was wet in each simulation a value of 0 is dry in all simulations.  Grids with a value of 0.5 are most sensitive.<br> This can be useful for quantifying the sensitivity of the model to parameters.<br> Example: *Create a fuzzy map from all maximum depth grids in the directory.<br> :<tt>asc_to_asc.exe -fuzzy *_d_Max.flt</tt> ==Histogram== Line 268 ⟶ 256: This feature was added to the 2014-03-AB version of the utility.<br> Calculates the number of cells and percentage of cells that fall in each range.  Requires and input .csv file containing the bin values.<br> Examples: *An example inputs bin file is:<br> :{| class="wikitable" ! style="background-color:#005581; font-weight:bold; color:white;"| Bin Line 287 ⟶ 276: |} *An example output looks like the below: :{| class="wikitable" ! style="background-color:#005581; font-weight:bold; color:white;"| Bin Line 309 ⟶ 298: |Above 5.0|| Above 5.0 || 973 || 0.06 |} *Example usage: :<tt>asc_to_asc_w64.exe –histogram histogram_bins.csv results_d_Max.asc</tt> ==Extract 1D Model Inputs== Line 399 ⟶ 388: |FLC per Unit Length == <form loss per unit length> || The form loss per unit length is written to the "exit_loss" attribute of all 1d_nwk channels. |} Example usage: *<tt>asc_to_asc.exe -egc MR_1d_001.egc</tt> An example .egc file is:<br> <pre> Line 426 ⟶ 416: The input GIS region file should have the same attributes as the 1d_tab file format produced by TUFLOW.  The first attribute ("Source" ) should contain a valid .csv file name.<br> The out nodal area table extends from  the minimum to the maximum elevation in the DEM.  A user defined minimum value can be specified using the "Skew" attribute of the GIS region.<br> Example usage: *<tt>asc_to_asc.exe -na 1d_na_storage_R.shp DEM_1m.flt</tt> ==Calibration Points== Line 437 ⟶ 428: '''"-cpmm<mm>"''' (optional)<br> The second search radius used to search for maximum and minimum values in meters.<br> Example usage: *<tt>asc_to_asc.exe -cp Flood_Marks.MIF -config diff_config.csv -cpsd100 -cpmm50 results_h_Max.asc</tt><br> ==Statistics== <big>'''"-stat<type>"'''</big> As of the 2017-10-AA build, the ASC_to_ASC.exe utility allows the user to perform a number of statistical analyses on a group of input grids (*.flt or *.asc format). This is particularly useful when extracting information from assessments that produce multiple result files for a single event, for example, processing grids from an ensemble assessment with numerous temporal pattern arrangements. Line 455 ⟶ 445: The below gives a description on each option as well as an example. It is also useful to consider using wildcards in the batch file to supplement typing out each input grid file individually. Several of the examples below utilise this ability to demonstrate how it can be done.<br> ==="-statMedian"=== The -statMedian flag outputs the median value at each grid cell from all the input grids. All the input grids are considered, regardless of if the grid cell is dry in some of the input grids (dry areas are still ranked as low e.g. Rank1, Rank2 and so on). Line 463 ⟶ 452: * A value grid: the resulting median value * An SRC grid: a grid listing which source input grid the median result value came from (a corresponding .csv file is also written as a legend)<br> Example usage: *<tt>asc_to_asc.exe -statMedian Q100_30min_TP1_h.asc Q100_30min_TP2_h.asc Q100_30min_TP3_h.asc Q100_30min_TP4_h.asc Q100_30min_TP5_h.asc</tt><br> [[File: asc_to_asc_statsMedian_eg.PNG|1000px|]]<br> Line 474 ⟶ 463: ==="-statMean"=== The -statMean flag outputs the mean value at each grid cell. Unlike the median, the mean is only calculated at grid cells that are wet (that show flooding) in all input grids. Please note that the source grid is the next grid above the mean value. The mean command outputs two grids: * A value grid: the resulting value * An SRC grid: a grid listing which source input grid the result value came from or was the next above (a corresponding .csv file is also written as a legend)<br> Example usage: *<tt>asc_to_asc.exe -statMean Q100_30min_*_h.asc</tt><br> ==="-statFrac"=== The -statFrac flag outputs a value at each grid cell that represents the fraction of the events that the grid cell is wet in. For example, if the number of input grids is 10, and a value of 0.2 is returned, this means this grid cell experienced flooding in 2 out of the 10 events. A value of 1.0 means that the grid cell was wet in all events. The utility outputs one grid: * A Frac grid: the resulting Fraction value<br> Example usage: *<tt>asc_to_asc.exe -statFrac Q100_30min_*_h.asc</tt><br> ==="-statMin"=== The -statMin flag outputs the minimum value at each grid cell from all the input grids. Line 495 ⟶ 483: * A value grid: the resulting value * An SRC grid: a grid listing which source input grid the minimum result value came from (a corresponding .csv file is also written as a legend)<br> Example usage: *<tt>asc_to_asc.exe -statMin Q100_30min_*_h.asc</tt><br> ==="-statMax"=== The -statMax flag outputs the maximum value at each grid cell from all the input grids. This flag is analogous with the [[#Maximum|-Max]] operation flag. Line 504 ⟶ 492: * A value grid: the resulting value * An SRC grid: a grid listing which source input grid the maximum result value came from (a corresponding .csv file is also written as a legend)<br> Example usage: *<tt>asc_to_asc.exe -statMax Q100_30min_*_h.asc</tt><br> ==="-statAll"=== The -statAll flag undertakes and creates results for all the statistic operations mentioned above. Line 514 ⟶ 502: * An SRC grid: for the median, mean, min and max calculations (calculation of source grids as detailed above) * A .csv file that contains the legend for all SRC grids<br> Example usage: *<tt>asc_to_asc.exe -statAll Q100_30min_*_h.asc</tt><br> ==="-statRank<integer id>"=== The -statRank<integer> flag outputs the ''n<integer>'' ranked value at each grid cell from all the input grids. All the input grids are considered, regardless of if the grid cell is dry in some of the input grids (dry areas are still ranked as low e.g. Rank1, Rank2 and so on). For example, if the number of input grids is 10, at each grid cell the values are ranked lowest to highest (from 1 to 10). -statRank8 will output results taken from the 8th ranked grid. In this example, -statRank1 is equivalent to ''Min'', -statRank10 is equivalent to ''Max'', and -statRank6 is equivalent to ''Median''. The Rank flag allows additional functionality that lets users extract results in between those that are pre-programmed. Line 523 ⟶ 511: * A value grid: the resulting value * An SRC grid: a grid listing which source input grid the ranked result value came from (a corresponding .csv file is also written as a legend)<br> Example usage: *<tt>asc_to_asc.exe -statRank5 Q100_30min_*_h.asc</tt><br> ==Flood Extent== Returns a simple grid with value of 1 where the input grid has an active, non-zero value.<br> Example usage: *<tt>asc_to_asc.exe -fe results_dMax.asc</tt><br> ==Remap== Line 536 ⟶ 526: Sets the finer resolution DEM.<br> The default interpolation method is TIN. But "-idw_npt<number of points>" flag can be used to change the interpolation method to IDW and set the number of points used for IDW interpolation (default is 12).<br> Examples: :<tt>asc_to_asc.exe -remap -wl lowres_h.asc -dem DEM_highres.asc</tt> :<tt>asc_to_asc.exe -remap -wl lowres_h.asc -dem DEM_highres.asc lowres_v.asc lowres_hazard.asc</tt> Note that, for any output types other than depth, this utility does NOT interpolate the result from the coarser grid to the finer grid, but only extends/reduces the output extent to the dry/wet extent. More discussions on this function is documented here [[TUFLOW_Remapping | TUFLOW Remapping Tool]].<br> | |||