GRID to GRID draft: Difference between revisions
Content deleted Content added
No edit summary |
Anne.Kolega (talk | contribs) m →Introduction: The |
||
(16 intermediate revisions by one other user not shown) | |||
Line 1:
=Introduction=
The grid_to_grid.exe is a utility that can be used to perform a range of operations on gridded files. The input grids can be a combination of GeoTIFF (.tif), ESRI ASCII (.asc), binary float (.flt) geopackage (.gpkg), NetCDF (.nc) and Cloud Optimised GeoTIFFs (.cog) grids, all of which can be input and output from TUFLOW and any of the format can be set as output from the utility.<br>
For some options (such as processing maximums or differences) the input files must be of the same row/column dimensions.<br>
Line 99:
==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.
===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
Example:
*Creates a new 10m DEM based on the the 2m DEM using an averaging approach.<br>
Line 107:
===Minimum===
Alternative processing method for resize, specified with the '''-rm_min''' (resize method - minimum) flag. At each output grid the values
Example:
*Creates a new 10m DEM based on the the 2m DEM using an minimum approach.<br>
Line 113:
===Maximum===
Alternative processing method for resize, specified with the '''-rm_max''' (resize method - maximum) flag. At each output grid the values
Example:
*Creates a new 10m DEM based on the the 2m DEM using an maximum approach.<br>
Line 119:
==Transform==
Transforms the values using a simple y = mx + c approach.
Example:
*Multiplies all values by 0.3048.<br>
Line 133:
==Classify==
Classifies the grid based on the input classifications. The output file is a classified 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>
{| class="wikitable"
Line 149:
*Outputs a classified grid, based on the cut off values and names in the "classifications.csv".<br>
:<tt>grid_to_grid.exe -classify classifications.csv results_VMax.tif</tt>
*If using vertical mapper the -grc option can be used to create
:<tt>grid_to_grid.exe -RGB -grc -classify depth_classify.csv results_dMax.
:{| class="wikitable"
Line 174:
==Extract Breaklines from DEM==
'''"-brkline <gis file in 2d_zsh format>"'''<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 Manual]</u>. For the utility the '''dz''', '''shape_width''' and the '''shape_options''' are used. Valid shape_options are "Max" and "Min" or blank (average used). The utility
▲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 Manual]</u>. For the utility the '''dz''', '''shape_width''' and the '''shape_options''' are used. Valid shape_options are "Max" and "Min" or blank (average used). The utility will extract an elevation at each <u>vertex</u> along the line.<br>
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.
* If the width is greater than 0, but less than 1.5 times the DEM cell size, the four DEM values surrounding the vertex are used. If max or min is specified in the "shape_option" the max or min of the four values is used. If max or min option is not specified (attribute is blank), the average of the four values is used.
* If the width is greater than 1.5 times the DEM cell size, at each vertex a buffer region (search radius) is created and all non null DEM values within the buffer object are processed. The diameter of the buffer region is equal to the width specified. If max or min option is not specified, the average of the values within the region is used. These buffer regions are outputted as a separate file, if '''"-check"''' switch is specified in the batch command.<br>
Line 188 ⟶ 187:
==Fuzzy Map==
'''"-fuzzy <input grids>"'''<br>
A fuzzy map can be used when comparing a large number of simulations.<br>
For each input grid (or scenario) the grid is classed as either 1 if the results grid is wet or 0 if dry.
This can be useful for quantifying the sensitivity of the model to parameters.<br>
Example:
Line 198 ⟶ 196:
==Histogram==
'''"-histogram bins.csv <input grid>"'''<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>
Example:
Line 247 ⟶ 244:
==Extract 1D Model Inputs==
'''"-egc control_file.egc"'''<br>
This allows 1D Network (1d_nwk) and/or 1D
A simple input file similar to the TUFLOW geometry control file is input into the utility. This is nominally given the extension .egc (Estry Geometry Control).<br>
<br>
Line 307 ⟶ 304:
|Read GIS XS == <1d_cut GIS file>|| Reads the cross-section cut lines, these are described above.
|-
|Read GIS FLC == <GIS file>|| Optional GIS layer of polygons that can be used to specify form loss coefficients to the 1d_nwk layer. A single GIS (float) attribute is required. A FLC value of greater than 0 will be split between all 1d_nwk channels within the region. A FLC value of less than 0, will apply the absolute value to all channels within the polygon. For example if an FLC value of -0.1 is specified, all channels that fall within the polygon will have a form_loss attribute of 0.1. If a channel falls within multiple polygons, the form loss values will be added.
|-
|Set XS dx == <distance>|| Sets the default distance across section to extract elevations and materials data. This can be specified on the cut lines as detailed above.
Line 361 ⟶ 357:
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:
*<tt>grid_to_grid.exe -na
==Calibration Points==
Line 377 ⟶ 373:
==Statistics==
<big>'''"-stat<type>"'''</big>
The available options are:
Line 397 ⟶ 393:
* 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:
*<tt>grid_to_grid.exe -statMedian Q100_30min_TP1_h.tif Q100_30min_TP2_h.tif Q100_30min_TP3_h.tif Q100_30min_TP4_h.tif
[[File: asc_to_asc_statsMedian_eg.PNG|1000px|]]<br>
<br>
Note, the median value for
<br>
[[File:A2A median.png|400px]]<br>
Line 417 ⟶ 413:
The utility outputs one grid:
* A Frac grid: the resulting
Example:
*<tt>grid_to_grid.exe -statFrac Q100_30min_*_h.tif</tt><br>
==="-statMin"===
The -statMin flag outputs the minimum value at each grid cell from all the input grids. This flag is analogous with the [[#Minimum|-Min]] operation flag.
The utility outputs two grids:
Line 450 ⟶ 446:
==="-statRank<integer id>"===
The -statRank<integer> flag outputs the
The utility outputs two grids:
Line 459 ⟶ 455:
==Flood Extent==
Returns a simple grid with value of 1 where the input grid has an active, non-zero value.<br>
Example:
Line 464 ⟶ 461:
==Remap==
'''"-wl <wl_file> -dem <dem_file>"'''<br>▼
▲'''"-wl <wl_file>"'''<br>
▲'''"-dem <dem_file>"'''<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>
Example:
*
:<tt>grid_to_grid.exe -remap -wl lowres_h.tif -dem DEM_highres.tif</tt>
*The utility can also
:<tt>grid_to_grid.exe -remap -wl lowres_h.tif -dem DEM_highres.tif
*The utility can also apply a buffer distance or add a freeboard. The below applies a buffer distance of 20m, and adds a freeboard of 0.2m to the original water level grid.<br>
:<tt>grid_to_grid.exe -remap -fb0.2 -bd20 -wl lowres_h.tif -dem DEM_highres.tif</tt>
Note
=GPKG and NetCDF=
Line 490 ⟶ 484:
=Creation Options=
The grid_to_grid.exe supports GDAL style creation options. Creation options can be passed in using the "-co" flag then the name of the creation option and the value:<Br>
<pre>-co COMPRESS=DEFLATE</pre>
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 grid_to_grid.exe utility. The following creation options are supported:<Br>
Line 511 ⟶ 505:
====NetCDF====
* COMPRESS=NONE/DEFLATE- output compression. Default - DEFLATE
* ZLEVEL=[0-9] - Compression level. Zero is no compression, 9 is
====ASC====
* DECIMAL_PRECISION=N - The number of decimal places in the output. This option is analogous to the <tt>"-decimal[N]"</tt> switch. Default - 3.
|