div - Divide operation
Name
div — Divide a constant value into a dataset or divide a dataset by another
Syntax
div hi hiname ;# divide active dataset by workspace hiname dataset, result in hiname.
div lo hiname ;# divide active dataset by workspace hiname dataset, result in active.
div value ;# divide value into active dataset, result in active data.
div x | y | sca value ;# divide value into x or y or scalar coordinates.
div x | y | z | sca [value] xx | yy | zz | sca [factor] ;# divide data coordinates by each other.
Description
The div command will divide a constant value with a dataset or divide two datasets by each other. div works on grid and polydata type of dataset. The result dataset is changed. Dividing by zero will be bypassed.
- Grid: The two datasets should preferably have the same grid dimensions. If not the active dataset is regridded to match the window and resolution of the hiname grid. A warning is issued in the message area.
- Polydata: The two datasets must have the same number of points. For polydata the target for the divide operation can be any of the xyz coordinates and scalar values.
- Dividing a datasets by another: The dataset in active is divided by the dataset in hiname. The result data is placed in active if the *lo argument is used, and in the workspace hiname if the hi argument is used.
Tip
The command Function is an alternative for mathematical operations on single datasets. Look inside the Geocap Toolbox for commands.
Arguments
hi hiname
Divide dataset in active and hiname and the result data will be placed in workspace hiname.
lo hiname
Divide dataset in active and hiname and the result data will be placed in active workspace.
value
Add value and result data will be placed in the active workspace.
hi | lo hiname tes
Add two poly dataset together according to rules above and optionally test using the tes argument if xy coordinates are equal and then divide only for equal coordinates.
x | y | sca value
Divide value to x- or y- or scalar coordinates. The result data will be placed in the active workspace.
x | y | z | sca [value] xx | yy | zz [factor]
Divide value to x or y or scalar coordinates. The result data will be placed in the active workspace. Divide data coordinate axes by each other. Optionally use a value that will be divided by the coordinates and/or a factor that will be divided with the coordinates. x | y | z |sca represents the first data coordinates and xx | yy | zz represents the second data coordinates. The result is always placed in the first coordinates.
Examples
Ex.1: Divide a dataset with another
# Divide a grid in active with a grid in workspace named mygrid and place the result in active div lo mygrid
Ex.2: Divide a dataset with a value
# Divide the value 15 with a dataset in active div 15
Ex.3: Divide coordinates
# Divide x by y data coordinates and place the result in x data coordinates. div x yy
See also
add - Add to dataset, sub - Subtract operation, mul - Multiply operation