Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
h2. Name

*add* --- Add a constant value to a dataset or add two datasets together {alias:add}

h2. Syntax
{panel:|borderStyle=solid|borderWidth=1|bgColor=#ffffaa}
*add hi* _hiname_ ;# add active dataset to workspace _hiname_ dataset, result in _hiname_.

*add lo* _hiname_ ;# add active dataset to workspace _hiname_ dataset, result in active.

*add* _value_ ;# add _value_ to active dataset, result in active data.

*add x | y | sca* _value_ ;# add _value_ to x or y or scalar coordinates.

*add x | y | z | sca* \[_value_] *xx | yy | zz | sca* \[_factor_] ;# add data coordinates together.
{panel}

h2. Description

The *add* command will add a constant value to a dataset or add two datasets together. add works on grid and polydata type of dataset. The result dataset is changed.

    * *Grid*: The two datasets must have the same grid dimensions.
    * *Polydata*: The two datasets must have the same number of points. For polydata the target for the adding operation can be any of the xyz coordinates and scalar values.
    * *Adding two datasets together*: The dataset in active is added to 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:title=Tip}
 The command Function !att:_img_icon^calculator.png! is an alternative for mathematical operations on single datasets. Look inside the Geocap Toolbox for commands.
{tip}


h2. Arguments

*hi* _hiname_
{indent}Add dataset in active and hiname and the result data will be placed in workspace hiname. 
{indent}

*lo* _hiname_
{indent}Add dataset in active and hiname and the result data will be placed in active workspace. 
{indent}

_value_
{indent}Add _value_ and result data will be placed in the active workspace. 
{indent}

*hi* | *lo* _hiname_ *tes*
{indent}Add two poly dataset together according to rules above and optionally test using the *tes* argument if xy coordinates are equal and then add only for equal coordinates. 
{indent}

*x* | *y* | *sca* _value_
{indent}Add value to x- or y- or scalar coordinates. The result data will be placed in the active workspace. 
{indent}
*x* | *y* | *z* | *sca* \[_value_\] *xx* | *yy* | *zz* \[_factor_\]
{indent}Add _value_ to x or y or scalar coordinates. The result data will be placed in the active workspace. Add data coordinate axes together. Optionally use a value that will be added to the coordinates and/or a _factor_ that will be multiplied 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. 
{indent}

h2. Examples

h3. Ex.1: Add a value to a dataset

{noformat:|borderWidth=1|bgColor=#eeeeee}
# Add the value 15 to a dataset in active
add 15
{noformat}

h3. Ex.2: Add two grids

{noformat:|borderWidth=1|bgColor=#eeeeee}
# Add a grid in active to a grid in workspace named mygrid and place the result in active
add lo mygrid
{noformat}

h3. Ex.3: Add coordinates
{noformat:|borderWidth=1|bgColor=#eeeeee}
# Add together x and y data coordinates and place the result in x data coordinates.
add x yy
{noformat}


h2. See also

[sub - Subtract operation], [mul], [div - Divide operation]