GRID to GRID draft: Difference between revisions

Content deleted Content added
Created page with "=Introduction= asc_to_asc.exe is a utility that can be used to perform a range of operations on gridded files. The input grids can be either ESRI ASCII grid (.asc) or binary..."
 
No edit summary
Line 1:
=Introduction=
asc_to_ascgrid_to_grid.exe is a utility that can be used to perform a range of operations on gridded files. The input grids can be either ESRI ASCII grid (.asc) or binary float grids (.flt), both of which can be input and output from TUFLOW.<br>
This utility is useful for comparing and processing TUFLOW outputs from different .2dm meshes, which can't be compared with the <u>[[RES_to_RES| res_to_res.exe]]</u>.<br>
For some options (such as processing maximums or differences) the input (.asc or .flt) files must be of the same row/column dimensions.<br>
Line 40:
===GPKG and NetCDF===
GeoPackage and NetCDF are database formats and are able to contain multiple layers in a single file. When passing in an input or output reference to a GeoPackage or NetCDF file the layer name is assumed to be the same as the database name unless otherwise specified. To give the layer a different name than the database, use the following syntax <tt>"database.ext >> layer"</tt>:<Br>
<pre>asc_to_ascgrid_to_grid.exe -dif "database.gpkg >> raster1" "database.gpkg >> raster2"</pre>
''<b>Note:</b>''
* ''quotes will always be required when using this syntax''
Line 53:
Multiple creation options can be used (each will require its own -co flag).<Br>
<Br>
The creation options have adopted the same naming as GDAL (more information on the options can be found at <b><u>[https://gdal.org https://gdal.org]</u></b>) however not all options in GDAL are supported in the ASC_to_ASCgrid_to_grid.exe utility. The following creation options are supported in the ASC_to_ASCgrid_to_grid 2023-Beta:<Br>
====GeoTIFF====
* COMPRESS=NONE/DEFLATE/LZW - output compression. Default - DEFLATE
Line 61:
* BIGTIFF=YES/NO/IF_NEEDED - Controls whether the ouput file uses the BigTIFF format or classic TIFF. Default - IF_NEEDED.
* TILED=YES/NO - Controls whether the output GeoTIFF should use tiles or strips. Default - NO.
* OVERVIEWS=YES/NO - Controls whether overviews (also known as pyramids) should be created. The ASC_to_ASCgrid_to_grid tool only supports internal overviews and therefore this option is only supported for tiled GeoTIFFs. Default - NO.
 
====Cloud Optimised GeoTIFF (COG)====
Line 80:
===Examples===
*Runs a difference operation on GeoTIFF outputs.<br>
:<tt>asc_to_ascgrid_to_grid.exe -diff proposed.tif existing.tif</tt>
* Runs a difference operation on GPKG outputs. The layer name needed is assumed to be the same as the database name.<br>
:<tt>asc_to_ascgrid_to_grid.exe -diff proposed.gpkg existing.gpkg</tt>
* Runs a difference operation on GeoPackage outputs where the layer name is different than the database name.<br>
:<tt>asc_to_ascgrid_to_grid.exe -diff "proposed_grid_results.gpkg >> proposed_max_h" "existing_grid_results.gpkg >> existing_max_h"</tt>
* Converts an ASC grid to a GeoTIFF with an LZW compression and horizontal predictor.<br>
:<tt>asc_to_ascgrid_to_grid.exe -conv -tif DEM_M01.asc -co COMPRESS=LZW -co PREDICTOR=2</tt>
* Runs a maximum operation on all FLT grids in a given location and outputs to a GeoPackage raster.<br>
:<tt>asc_to_ascgrid_to_grid.exe -max -out "output_grids.gpkg >> maximum_h" *.flt</tt>
* Converts GeoTIFF to a Cloud Optimised GeoTIFF. Requires <tt>-out</tt> flag since the extension for COG is also '.tif' and therefore the default output file would be the same as the input file.<br>
:<tt>asc_to_ascgrid_to_grid.exe -conv -cog DEM_M01.tif -out DEM_M01_COG.tif</tt>
 
=Operations=
Line 98:
Examples:<br>
*Converts all .flt grids to .asc format.<br>
:<tt>asc_to_ascgrid_to_grid.exe -conv *.flt</tt>
*Converts the file "DEM_M01.asc" for .flt format.<br>
:<tt>asc_to_ascgrid_to_grid.exe -conv DEM_M01.asc</tt>
 
==Maximum==
Line 109:
Examples:<br>
*Creates a new grid containing the maximum of the 3 input water level grids.<br>
:<tt>asc_to_ascgrid_to_grid.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_ascgrid_to_grid.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_ascgrid_to_grid.exe -out Q100_Max_Levels.asc -max Q100_*min_h.asc</tt>
 
==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_ascgrid_to_grid creates its own output filename using the names of the two input .asc 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.
Line 123:
Example:
*Creates new grids comparing the differences in flood levels and extents for: "difference.asc" = "after_h.asc" - "before_h.asc"<br>
:<tt>asc_to_ascgrid_to_grid.exe -out difference.asc -dif after_h.asc before_h.asc</tt>
 
Secondary options (only one can be used):
Line 137:
Examples:
*Creates a new depth grid only where the depth is greater than 0.1m.<br>
:<tt>asc_to_ascgrid_to_grid.exe -cd0.1 depth.asc</tt>
*Creates a new level grid only where the depth is greater than 0.1m.<br>
:<tt>asc_to_ascgrid_to_grid.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_ascgrid_to_grid.exe -cd0.1 -out filtered_levels.asc depths.asc levels.asc</tt>
 
==Resize==
Line 150:
Example:
*Creates a new 10m DEM (DEM_10m.asc) based on the the 2m DEM using an averaging approach.<br>
:<tt>asc_to_ascgrid_to_grid.exe -resize5 -out DEM_10m.asc DEM_2m.asc</tt>
 
===Minimum===
Line 156:
Example:
*Creates a new 10m DEM (DEM_10m_min.asc) based on the the 2m DEM using an minimum approach.<br>
:<tt>asc_to_ascgrid_to_grid.exe -resize5 -rm_min -out DEM_10m_min.asc DEM_2m.asc</tt>
 
===Maximum===
Line 162:
Example:
*Creates a new 10m DEM (DEM_10m_max.asc) based on the the 2m DEM using an maximum approach.<br>
:<tt>asc_to_ascgrid_to_grid.exe -resize5 -rm_max -out DEM_10m_max.asc DEM_2m.asc</tt>
 
==Transform==
Line 168:
Examples:
*Multiplies all values by 0.3048.<br>
:<tt>asc_to_ascgrid_to_grid.exe -trans_m0.3048 DEM.asc</tt>
*Multiplies all values by 0.3048 and then adds 10.0.<br>
:<tt>asc_to_ascgrid_to_grid.exe -trans_m0.3048 -trans_c10 DEM.asc</tt>
 
==Decimal==
Line 176:
Example:
*Converts all .flt grids to .asc format with 5 decimal spaces.<br>
:<tt>asc_to_ascgrid_to_grid.exe -conv -decimal5 *.flt</tt>
 
==Classify==
Line 194:
Examples:
*Outputs a classified grid, based on the cut off values and names in the "classifications.csv".<br>
:<tt>asc_to_ascgrid_to_grid.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_ascgrid_to_grid.exe -RGB -grc -classify depth_classify.csv results_dMax.asc</tt><br>
 
:{| class="wikitable"
Line 229:
'''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_ascgrid_to_grid.exe -brkline 2d_zsh_breaklines_L.shp DEM.asc</tt>
 
==Fuzzy Map==
Line 239:
Example:
*Create a fuzzy map from all maximum depth grids in the directory.<br>
:<tt>asc_to_ascgrid_to_grid.exe -fuzzy *_d_Max.flt</tt>
 
==Histogram==
Line 288:
|}
*Example usage:
:<tt>asc_to_asc_w64grid_to_grid.exe –histogram histogram_bins.csv results_d_Max.asc</tt>
 
==Extract 1D Model Inputs==
Line 378:
|}
Example usage:
*<tt>asc_to_ascgrid_to_grid.exe -egc MR_1d_001.egc</tt>
 
An example .egc file is:<br>
Line 406:
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_ascgrid_to_grid.exe -na 1d_na_storage_R.shp DEM_1m.flt</tt>
 
==Calibration Points==
Line 418:
The second search radius used to search for maximum and minimum values in meters.<br>
Example usage:
*<tt>asc_to_ascgrid_to_grid.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_ASCgrid_to_grid.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.
 
The available options are:
Line 442:
* 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_ascgrid_to_grid.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 456:
* 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_ascgrid_to_grid.exe -statMean Q100_30min_*_h.asc</tt><br>
 
==="-statFrac"===
Line 464:
* A Frac grid: the resulting Fraction value<br>
Example usage:
*<tt>asc_to_ascgrid_to_grid.exe -statFrac Q100_30min_*_h.asc</tt><br>
 
==="-statMin"===
Line 473:
* 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_ascgrid_to_grid.exe -statMin Q100_30min_*_h.asc</tt><br>
 
==="-statMax"===
Line 482:
* 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_ascgrid_to_grid.exe -statMax Q100_30min_*_h.asc</tt><br>
 
==="-statAll"===
Line 492:
* A .csv file that contains the legend for all SRC grids<br>
Example usage:
*<tt>asc_to_ascgrid_to_grid.exe -statAll Q100_30min_*_h.asc</tt><br>
 
==="-statRank<integer id>"===
Line 501:
* 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_ascgrid_to_grid.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_ascgrid_to_grid.exe -fe results_dMax.asc</tt><br>
 
==Remap==
Line 517:
Examples:
*The utility can also remap additional map output grids (e.g. velocity, hazard and others) to the resolution of the DEM file, e.g.<br>
:<tt>asc_to_ascgrid_to_grid.exe -remap -wl lowres_h.asc -dem DEM_highres.asc</tt>
*The utility can also apply a buffer distance or add freeboard. For example, the below applies a buffer distance of 20m, and adds a freeboard of 0.2m to the original water level grid.<br>
:<tt>asc_to_ascgrid_to_grid.exe -remap -wl lowres_h.asc -dem DEM_highres.asc lowres_v.asc lowres_hazard.asc</tt>
:<tt>asc_to_ascgrid_to_grid.exe -remap -fb0.2 -bd20 -wl lowres_h.asc -dem DEM_highres.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>
Line 531:
! style="background-color:#005581; font-weight:bold; color:white;" width=80% | 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. The -b flag should be placed after the asc_to_ascgrid_to_grid.exe call, before the function command. For example:<br> <tt>asc_to_ascgrid_to_grid.exe -b -brkline 2d_zsh_breaklines_L.shp DEM.asc</tt><br>
|-
|"-out <output grid name>"||Specify the output filename for the new grid. <br> '''Note:''' a space is required between the -out and the filename.