Grid and Grid Arithmetics
cna.calc_grid()starts grid calculation
cna.load_grid()loads grid
cna.resample_grid()resamples the grid
cna.save_grid()saves grid: The format will be determined automatically from the file extension. Default is .cnr. Unsupported extensions trigger an error message.
cna.grid.ne reads the extremal North-East coordinate of the grid.
cna.grid.swreads the extremal South-West coordinate of the grid.
cna.grid.oversampling controls (reads & writes) the value of the oversampling rate (example: cna.grid.oversampling = 5).
cna.grid.display controls (reads and writes) the grid appearance setting. Valid values: 1 = Iso-Lines, 2 = Iso-Areas, 3 = Raster, 4 = No Grid
cna.grid.display_range toggles the „Level Range“ on/off. Specify lower, upper limits and class width in dB by using cna.grid.display_range_lower, cna.grid.display_range_upper and cna.grid.display_range_width.
cna.grid.lines2contour() converts iso-lines to contour lines (as with ALT+F12 key combination). Works only if cna.grid.display is 1 or 2.
cna.grid.is_present returns a boolean value indicating whether the grid is present or not. The grid must be a valid grid. Result: true/false. NOTE: Use assert(cna.grid.is_present) at the top line of the Lua script.
cna.grid.is_inside(a,b)returns a boolean value indicating whether the specified integer grid point (a,b) is located inside the grid (result: true/false). The grids coordinates start at (1,1) and end at x,y = cna.grid.get_limits()which will be again two integers.
cna.grid.dx/dy/z reads/writes the grid width in x and y direction as well as the height in z direction.
cna.grid.exclude_src/exclude_bld/exclude_bld_3D/use_limits refer to the corresponding settings at menu Grid Specifications. An active checkbox refers to 1, inactive to 0.
cna.grid.set_step_size(dx,dy) sets grid spacing to dx and dy.
cna.grid.delete_grid(x) deletes the grid for variant with index x (-1 or w/o parameter deletes all grids).
- The grid arithmetics can be used as shown by the following example corresponding to the available settings in the dialog Grid Arithmetics (see Grid Arithmetic):
local c = cna.grid_arith.new()
c.R1 = "C:\raster.cnr -- input grids R1 to R6
c.intersect = true -- intersection on/off
c.expr1 = "r1-r0" -- expr1 .. expr4 possible (string)
c:execute() -- as clicking OK on dialog
cna.redraw() -- redraws grid, not compulsory