Data Calculator: Difference between revisions

From XMS Wiki
Jump to navigationJump to search
 
 
(58 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<noinclude>
[[File:GMS Data Calculator.png|thumb|450 px|The ''Data Calculator'' dialog]]
{{SMS_at_a_glance_data_calculator|Heading===At a glance==}}
The ''Data Calculator'' can be used to perform mathematical operations with datasets to create new datasets. The ''Data Calculator'' is accessed in GMS by selecting the '''Dataset Calculator''' in the ''Edit'' menu. It is accessed in WMS by selecting the '''Data Calculator''' command from the ''Edit'' menu. The components of the ''Data Calculator'' are as follows:
</noinclude>
 
The Data Calculator can be used to perform mathematical operations with data sets to create new data sets. The Data Calculator is accessed by selecting the '''Data Calculator''' command from the '''Data''' menu. The components of the Data Calculator are as follows:


=== Expression Field ===
=== Expression Field ===
The most important part of the Data Calculator is the Expression field. This is where the mathematical expression is entered. The expression should be formulated using the same rules that are used in formulating equations in a spreadsheet. Parentheses should be used to clearly indicate the preferred order of evaluation. There is no limit on the length of the expression. The operators in the expression should be limited to the operators shown in the middle of the Data Calculator. The operands in the expression should consist of user-defined constants (e.g., 3.14159), or data sets.
The most important part of the ''Data Calculator'' is the ''Expression'' field. This is where the mathematical expression is entered. The expression should be formulated using the same rules that are used in formulating equations in a spreadsheet. Parentheses should be used to clearly indicate the preferred order of evaluation. There is no limit on the length of the expression. The operators in the expression should be limited to the operators shown in the bottom-right of the ''Data Calculator''. The operands in the expression should consist of user-defined constants (e.g., 3.14159), or datasets.


=== List of Data Sets ===
=== List of Datasets ===
All of the data sets associated with the active object (TIN, Grid, Mesh, or Scatter Point Set) are listed at the top of the Data Calculator. If a transient data set is highlighted, the time steps are listed on the right side of the Data Calculator. When a data set is used in an expression, the name of the data set should NOT be used. Rather, the letter associated with the data set should be used. For example, if a data set is listed as "b. head1", the data set is referenced in the expression simply as "b"
All of the datasets associated with the active object (TIN, Grid, Mesh, or Scatter Point Set) are listed at the top of the Data Calculator. If a transient dataset is highlighted, the time steps are listed on the right side of the Data Calculator. When a dataset is used in an expression, the name of the dataset should NOT be used. Rather, the letter associated with the dataset should be used. For example, if a dataset is listed as "b. head1", the dataset is referenced in the expression simply as "b".


When a transient data set is used in an expression, either a single time step or the entire sequence of time steps may be used. For example, the expression "abs(d:100)" creates a single (steady state) data set representing the absolute value of the data set at time = 100.0. However, the expression "abs(d:all)" creates a transient data set representing the absolute value of each of the time steps in the original data set.
When a transient dataset is used in an expression, either a single time step or the entire sequence of time steps may be used. For example, the expression "abs(d:100)" creates a single (steady state) dataset representing the absolute value of the dataset at time = 100.0. However, the expression "abs(d:all)" creates a transient dataset representing the absolute value of each of the time steps in the original dataset.


=== Result Name ===
=== Result Name ===
When an expression is evaluated, a new data set is created and the name of the new data set is designated in the Result field.
When an expression is evaluated, a new dataset is created and the name of the new dataset is designated in the ''Result'' field.


=== Operators ===
=== Operators ===
The allowable operators are listed in the middle of the dialog. Selecting one of the operator buttons adds the selected operator to the end of the expression. However, the operators can also be typed directly in the expression field. The function of each of the operators is as follows:
The allowable operators are listed in the bottom-right of the dialog. Selecting one of the operator buttons adds the selected operator to the end of the expression. However, the operators can also be typed directly in the expression field. The function of each of the operators is as follows:


{| border="1" cellpadding="2"
{| class="wikitable"
!width="200"|Operator
!width="100"|Operator
!width="500"|Function
!width="200"|Function
|-
|<center>" + "</center>||<center>Add</center>
|-
|-
|<center>" - "</center>||<center>Subtract</center>
|<center> + </center>
|Add
|-
|-
|<center>" * "</center>||<center>Multiply</center>
|<center> - </center>
|Subtract
|-
|-
|<center>" / "</center>||<center>Divide</center>
|<center> * </center>
|Multiply
|-
|-
|<center>" ( "</center>||<center>Left Parenthesis</center>
|<center> / </center>
|Divide
|-
|-
|<center>" ) "</center>||<center>Right /Parenthesis</center>
|<center> ( </center>
|Left parenthesis
|-
|-
|<center>" log(x) "</center>||<center>The base 10 logarithm of a data set</center>
|<center> ) </center>
|Right parenthesis
|-
|-
|<center>" ln(x) "</center>||<center>The natural logarithm of a data set</center>
|<center> log(x) </center>
|The base 10 logarithm of a dataset
|-
|-
|<center>" x^a "</center>||<center>(x) raised to the (a) power. (x) and (a) can be any mixture of constants and data sets</center>
|<center> ln(x) </center>
|The natural logarithm of a dataset
|-
|-
|<center>" abs(x) "</center>||<center>The absolute value of a data set</center>
|<center> x^a </center>
|(x) raised to the (a) power. (x) and
(a) can be any mixture of constants and datasets
|-
|-
|<center>" sqrt(x) "</center>||<center>The square root of a data set</center>
|<center> abs(x) </center>
|The absolute value of a dataset
|-
|-
|<center>" ave(x,y) "</center>||<center>The average of two data sets</center>
|<center> sqrt(x) </center>
|The square root of a dataset
|-
|-
|<center>" min(x,y) "</center>||<center>The minimum of two data sets</center>
|<center> avg(x,y) </center>
|The average of two datasets
|-
|-
|<center>" max(x,y) "</center>||<center>The maximum of two data sets</center>
|<center> min(x,y) </center>
|The minimum of two datasets
|-
|-
|<center>" trunc(x,a,b) "</center>||<center>Truncates a data set (x) so that all values are >= a and <= b</center>
|<center> max(x,y) </center>
|The maximum of two datasets
|-
|-
|<center>" 1/(x) "</center>||<center>The inverse of (x) - Only available in SMS</center>
|<center> trunc(x,a,b) </center>
|Truncates a dataset (x) so that all
values are >= a and <= b
<!--|-
|<center> 1/(x) </center>
|The inverse of (x) - Only available in SMS-->
|}
|}


====Operating with transient datasets====
====Operating With Transient Datasets====
Each argument in the operators listed in the table above may be:
Each argument in the operators listed in the table above may be:
* A steady state (1 time step) data set
* A steady state (1 time step) dataset
* A specified time step of a transient data set (i.e. x:#). In this case the # represents the index of the time step as specified in the timestep window.  
* A specified time step of a transient dataset (i.e., x:#). In this case the # represents the index of the time step as specified in the ''Time steps'' window.  
* A transient time step (i.e. x:all). These operations are only valid if all arguments have matching time step values. In this case, the result will be a new transient data set with identical time values as the arguments.
* A transient time step (i.e., x:all). These operations are only valid if all arguments/operands have matching time step values. In this case, the result will be a new transient dataset with identical time values as the arguments.


The data calculator supports an alternate format for computing attributes of a transient dataset. This alternate format applies to three of the operators. These operators compute a single timestep (steady state) dataset representing the spatially varied attribute operating on all the timesteps.
The data calculator supports an alternate format for computing attributes of a transient dataset. This alternate format applies to three of the operators. These operators compute a steady state (single time step) dataset that represents the spatially varied attribute operating on all the time steps.  


{| border="1" cellpadding="2"
{| class="wikitable"
!width="200"|Operator
!width="200"|Operator
!width="500"|Function
!width="500"|Function
|-
|-
|<center>" ave(x:all) "</center>||<center>The average at each location of all time steps in the data set</center>
|<center> ave(x:all) </center>||The average, at each location, of all time steps in the dataset "x"
|-
|-
|<center>" min(x:all) "</center>||<center>The minimum at each location of all time steps in the data set</center>
|<center> min(x:all) </center>||The minimum, at each location, of all time steps in the dataset "x"
|-
|-
|<center>" max(x:all) "</center>||<center>The maximum at each location of all time steps in the data set</center>
|<center> max(x:all) </center>||The maximum, at each location, of all time steps in the dataset "x"
|}
|}


=== Compute Button ===
=== Compute Button ===
Once an expression is formulated and a name for the resulting data set has been specified, the expression can be evaluated by selecting the Compute button. At this point, the data set is created and the name of the new data set should appear in the list of data sets.
Once an expression is formulated and a name for the resulting dataset has been specified, the expression can be evaluated by selecting the '''Compute''' button. At this point, the dataset is created and the name of the new dataset should appear in the list of datasets.


<noinclude>
<noinclude>
==Related Links==
==Related Links==


* [[GMS:Data Sets|Data Sets (GMS)]]
* [[GMS:Datasets|Datasets (GMS)]]
* [[SMS:Data Sets|Data Sets (SMS)]]
* [[WMS:Datasets|Datasets (WMS)]]
* [[WMS:Data Sets|Data Sets (WMS)]]
* [[SMS:Data_Calculator| SMS Data Calculator]]
* [[SMS:Data Set Toolbox|Data Set Toolbox (SMS)]]
</noinclude>
</noinclude>
{{Navbox GMS}}
{{WMSMain}}
[[Category:Datasets|D]]
[[Category:General Information|D]]
[[Category:GMS Dialogs]]
[[Category:WMS Dialogs]]

Latest revision as of 22:50, 22 February 2023

The Data Calculator dialog

The Data Calculator can be used to perform mathematical operations with datasets to create new datasets. The Data Calculator is accessed in GMS by selecting the Dataset Calculator in the Edit menu. It is accessed in WMS by selecting the Data Calculator command from the Edit menu. The components of the Data Calculator are as follows:

Expression Field

The most important part of the Data Calculator is the Expression field. This is where the mathematical expression is entered. The expression should be formulated using the same rules that are used in formulating equations in a spreadsheet. Parentheses should be used to clearly indicate the preferred order of evaluation. There is no limit on the length of the expression. The operators in the expression should be limited to the operators shown in the bottom-right of the Data Calculator. The operands in the expression should consist of user-defined constants (e.g., 3.14159), or datasets.

List of Datasets

All of the datasets associated with the active object (TIN, Grid, Mesh, or Scatter Point Set) are listed at the top of the Data Calculator. If a transient dataset is highlighted, the time steps are listed on the right side of the Data Calculator. When a dataset is used in an expression, the name of the dataset should NOT be used. Rather, the letter associated with the dataset should be used. For example, if a dataset is listed as "b. head1", the dataset is referenced in the expression simply as "b".

When a transient dataset is used in an expression, either a single time step or the entire sequence of time steps may be used. For example, the expression "abs(d:100)" creates a single (steady state) dataset representing the absolute value of the dataset at time = 100.0. However, the expression "abs(d:all)" creates a transient dataset representing the absolute value of each of the time steps in the original dataset.

Result Name

When an expression is evaluated, a new dataset is created and the name of the new dataset is designated in the Result field.

Operators

The allowable operators are listed in the bottom-right of the dialog. Selecting one of the operator buttons adds the selected operator to the end of the expression. However, the operators can also be typed directly in the expression field. The function of each of the operators is as follows:

Operator Function
+
Add
-
Subtract
*
Multiply
/
Divide
(
Left parenthesis
)
Right parenthesis
log(x)
The base 10 logarithm of a dataset
ln(x)
The natural logarithm of a dataset
x^a
(x) raised to the (a) power. (x) and

(a) can be any mixture of constants and datasets

abs(x)
The absolute value of a dataset
sqrt(x)
The square root of a dataset
avg(x,y)
The average of two datasets
min(x,y)
The minimum of two datasets
max(x,y)
The maximum of two datasets
trunc(x,a,b)
Truncates a dataset (x) so that all

values are >= a and <= b

Operating With Transient Datasets

Each argument in the operators listed in the table above may be:

  • A steady state (1 time step) dataset
  • A specified time step of a transient dataset (i.e., x:#). In this case the # represents the index of the time step as specified in the Time steps window.
  • A transient time step (i.e., x:all). These operations are only valid if all arguments/operands have matching time step values. In this case, the result will be a new transient dataset with identical time values as the arguments.

The data calculator supports an alternate format for computing attributes of a transient dataset. This alternate format applies to three of the operators. These operators compute a steady state (single time step) dataset that represents the spatially varied attribute operating on all the time steps.

Operator Function
ave(x:all)
The average, at each location, of all time steps in the dataset "x"
min(x:all)
The minimum, at each location, of all time steps in the dataset "x"
max(x:all)
The maximum, at each location, of all time steps in the dataset "x"

Compute Button

Once an expression is formulated and a name for the resulting dataset has been specified, the expression can be evaluated by selecting the Compute button. At this point, the dataset is created and the name of the new dataset should appear in the list of datasets.


Related Links