# SMS:Dataset Toolbox

The Dataset Toolbox contains numerous tools for working with datasets. Once the options for the current tool have been set and a name for the resulting dataset has been specified, selecting the Compute, Sample, etc. button will create the new dataset. The name of the new dataset will appear in the list of datasets.

The Dataset Toolbox tools are organized as follows:

## Math

Compare Datasets
Compare two datasets by subtracting the "Alternate" dataset from the "Base" dataset. User specified NULL values are assigned if the base or alternate dataset is inactive.
Data Calculator
Angle Convention
Create a new dataset with a different angle convention from a scalar dataset containing directions in a given angle convention. With datasets for CMS-WAVE and STWAVE Cartesian grids, the angle can be converted to and from a shore normal convention.

## Spatial

Geometry
Creates a function that gives the gradient at each node. The gradient is calculated as the run divided by the rise.
Creates a function that gives the direction in degrees of the maximum gradient at each point.
Directional Derivative
Creates a vector function that gives the gradient (run/rise) in the x and y directions.
Smoothing Datasets
Available when the Scatter module is active. For more information, see Smooth Dataset.
Grid Spacing
Creates a function that gives the average distance between a node and its neighbors.

## Temporal

Sample Time Steps
Create a new dataset from sampled times of an existing dataset. If Interpolate times is selected, linear interpolation will be used to determine the sampled times. If Interpolate times is not selected, the value from the nearest existing dataset time step will be used.
Compute Derivatives
Create a new dataset of the change from one time step to the next, or the derivative from one time step to the next of an existing dataset. When computing a derivative, the time units must be specified. The the new dataset will output data in between the existing dataset time steps, resulting in one fewer time step than the original dataset.
Merge Datasets
Starting SMS 11.2, two or more datasets can be merged together. The selected datasets must not have any overlapping time steps.

## Conversion

Scalar to Vector
Converts two scalar datasets to a single vector dataset. The specified scalar datasets can be either magnitude and direction or x and y components.
Vector to Scalar
Converts a single vector dataset into two scalar datasets. The resulting scalar datasets can be either magnitude and direction or x and y components.

## Coastal

Local Wave Length and Celerity
Creates one or two functions representing the celerity and/or the wavelength at each node, based on the depth at each node. The celerity (C) is defined as the relative velocity of a wave with respect to the fluid in which it is travelling.
Note: the variable here is depth, not elevation. For applications relative to mean sea level, using the negative of the elevation relative to a datum is acceptable, but if the water level will vary, the depth is actually the water level minus the ground elevation. This operation can be performed using the Data Calculator.
The Output base name edit field allows the modeler to customize the name of the dataset being created.
$Celerity=(Gravity*Depth)^{0.5}$ .
$Wavelength=Period*Celerity$ .
Gravity Waves (Courant or Time Steps)
Creates a function that gives the Courant number for each node given the time step, and/or the time step given the Courant number. It is assumed that the velocity of the water is the celerity (see above). For clarity it is recommended to do one or the other at a time. Using an Output base name such as "Time step 20" and specifying the time step as 20 will generate a dataset named "Time step 20 Courant" indicating the Courant number if the time step is assumed to be 20.
Note: the variable here is depth, not elevation. For applications relative to mean sea level, using the negative of the elevation relative to a datum is acceptable, but if the water level will vary, the depth is actually the water level minus the ground elevation. This operation can be performed using the Data Calculator.
$CourantNumber=TimeStep*(Gravity*Depth)^{0.5}/NodalSpacing$ .
$TimeStep=CourantNumber*NodalSpacing/(Gravity*Depth)^{0.5}$ .
Advective requires a vector function representing the velocity of the water as input and is disabled if no vector functions exist. The Courant option creates a function representing the Courant number given an assumed time step size and a velocity function. The time step option creates a function that represents an allowable time step given an assumed Courant number and a velocity function.
$CourantNumber=NodalVelocityMagnitude*TimeStep/NodalSpacing$ .
$TimeStep=CourantNumber*NodalSpacing/NodalVelocityMagnitude$ .

## Modification

Map Activity
This maps the activity array from one dataset to second dataset. This may be used to show only the values of interest on a particular dataset. This operation creates a new dataset.
Filter
This creates a new dataset based on specified criteria. The following options are available for filtering:
• < (less than)
• <= (less than or equal to)
• > (greater than)
• >= (greater than or equal to)
• equal
• not equal
• null
• not null
If the value passes the specified filter, the following can be assigned:
• original (no change)
• specify (a user specified value)
• null (the dataset null value)
• true (1.0)
• false (0.0)
• time – The first time the condition was met. Time can be specified in seconds, minutes, hours or days, and includes fractional values (such as 3.27 hours).
In addition, if the value passes none of the criteria, a default value can be assigned (see available options above).
The filtering is applied in the order specified. This means as soon as the new dataset passes a test, it will not be filtered by subsequent tests.