Data Calculator: Difference between revisions
(27 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
[[File:GMS Data Calculator.png|thumb|450 px|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: | |||
The ''Data Calculator'' can be used to perform mathematical operations with datasets to create new datasets. The ''Data Calculator'' is accessed by selecting the ''' | |||
=== 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 | 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 === | === 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" | 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. | 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. | ||
Line 17: | Line 14: | ||
=== Operators === | === Operators === | ||
The allowable operators are listed in the | 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: | ||
{| class="wikitable" | {| class="wikitable" | ||
!width="100"|Operator | !width="100"|Operator | ||
!width=" | !width="200"|Function | ||
|- | |- | ||
|<center> + </center> | |<center> + </center> | ||
Line 36: | Line 33: | ||
|- | |- | ||
|<center> ( </center> | |<center> ( </center> | ||
|Left | |Left parenthesis | ||
|- | |- | ||
|<center> ) </center> | |<center> ) </center> | ||
|Right | |Right parenthesis | ||
|- | |- | ||
|<center> log(x) </center> | |<center> log(x) </center> | ||
Line 48: | Line 45: | ||
|- | |- | ||
|<center> x^a </center> | |<center> x^a </center> | ||
|(x) raised to the (a) power. (x) and (a) can be any mixture of constants and datasets | |(x) raised to the (a) power. (x) and | ||
(a) can be any mixture of constants and datasets | |||
|- | |- | ||
|<center> abs(x) </center> | |<center> abs(x) </center> | ||
Line 56: | Line 54: | ||
|The square root of a dataset | |The square root of a dataset | ||
|- | |- | ||
|<center> | |<center> avg(x,y) </center> | ||
|The average of two datasets | |The average of two datasets | ||
|- | |- | ||
Line 66: | Line 64: | ||
|- | |- | ||
|<center> trunc(x,a,b) </center> | |<center> trunc(x,a,b) </center> | ||
|Truncates a dataset (x) so that all values are >= a and <= b | |Truncates a dataset (x) so that all | ||
|- | values are >= a and <= b | ||
<!--|- | |||
|<center> 1/(x) </center> | |<center> 1/(x) </center> | ||
|The inverse of (x) - Only available in SMS | |The inverse of (x) - Only available in SMS--> | ||
|} | |} | ||
Line 75: | Line 74: | ||
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) dataset | * A steady state (1 time step) dataset | ||
* A specified time step of a transient dataset (i.e., x:#). | * 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). | * 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. | 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. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 84: | Line 83: | ||
!width="500"|Function | !width="500"|Function | ||
|- | |- | ||
|<center> ave(x:all) </center>||The average at each location of all time steps in the dataset | |<center> ave(x:all) </center>||The average, at each location, of all time steps in the dataset "x" | ||
|- | |- | ||
|<center> min(x:all) </center>||The minimum at each location of all time steps in the dataset | |<center> min(x:all) </center>||The minimum, at each location, of all time steps in the dataset "x" | ||
|- | |- | ||
|<center> max(x:all) </center>||The maximum at each location of all time steps in the dataset | |<center> max(x:all) </center>||The maximum, at each location, of all time steps in the dataset "x" | ||
|} | |} | ||
Line 94: | Line 93: | ||
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. | 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. | ||
==Restrictions/Rules== | |||
{{Dataset Calculator Table}} | |||
{{Dataset Calculator Table Examples}} | |||
<noinclude> | <noinclude> | ||
Line 99: | Line 101: | ||
* [[GMS:Datasets|Datasets (GMS)]] | * [[GMS:Datasets|Datasets (GMS)]] | ||
* [[WMS:Datasets|Datasets (WMS)]] | * [[WMS:Datasets|Datasets (WMS)]] | ||
* [[SMS: | * [[SMS:Data_Calculator| SMS Data Calculator]] | ||
<!--* [[Dataset_Calculator_Tool |Dataset Calculator Tool]]--> | |||
</noinclude> | </noinclude> | ||
{{Navbox GMS}} | |||
{{WMSMain}} | |||
[[Category:Datasets|D]] | [[Category:Datasets|D]] | ||
[[Category:General Information|D]] | [[Category:General Information|D]] | ||
[[Category: | [[Category:GMS Dialogs]] | ||
[[Category:WMS Dialogs]] |
Latest revision as of 23:15, 5 August 2024
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 | |
The base 10 logarithm of a dataset | |
The natural logarithm of a dataset | |
(x) raised to the (a) power. (x) and
(a) can be any mixture of constants and datasets | |
The absolute value of a dataset | |
The square root of a dataset | |
The average of two datasets | |
The minimum of two datasets | |
The maximum of two datasets | |
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 |
---|---|
The average, at each location, of all time steps in the dataset "x" | |
The minimum, at each location, of all time steps in the dataset "x" | |
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.
Restrictions/Rules
The values will be the result of the expression being performed on each set of values of the datasets at each time step. Datasets with point and cell values cannot be mixed in the dataset calculator.
- If no dataset being used in a calculation has activity, the resulting dataset will also not have activity. (See example #1 in the table below)
- In calculations with multiple datasets with one timestep selected, the resulting time step will be 0.0. (See example #4)
- If there is a combination of different selections for time steps and there is at least one dataset with “all time steps” selected, the resulting dataset’s time steps will be that dataset’s time steps. (see example #5)
- In any such calculations, the calculator will use the single corresponding values array from any datasets with a single time step selected for every corresponding set of values in any datasets with “all time steps” selected. time step in the multiple time step selections.
- All datasets where “all time steps” has been selected must have the same time steps. (See example #9)
- If there is a combination of activity on cells and points between the datasets being used in a calculation, before performing calculations for activity, the calculator will find the point activity from the given cell activity and use that in the activity calculations. (See example #26)
An SMS sample file with the examples in the table can be downloaded here.
Test # | Dataset 1 value location | Dataset 1 activity | Dataset 1 time steps | Dataset 2 value location | Dataset 2 activity | Dataset 2 time steps | Result location | Result activity | Result time steps |
---|---|---|---|---|---|---|---|---|---|
1 | cells | no activity | 1 time step | cells | no activity | 1 time step | cells | no activity | 1 time step |
2 | cells | no activity | 1 time step | cells | no activity | all time steps | cells | no activity | all time steps |
3 | cells | no activity | all time steps | cells | no activity | all time steps | cells | no activity | all time steps |
4 | cells | cells activity | 1 time step | cells | cells activity | 1 time step | cells | cells activity | 1 time step |
5 | cells | cells activity | 1 time step | cells | cells activity | all time steps | cells | cells activity | all time steps |
6 | cells | cells activity | all time steps | cells | no activity | 1 time step | cells | cells activity | all time steps |
7 | cells | cells activity | all time steps | cells | no activity | all time steps | cells | cells activity | all time steps |
8 | cells | cells activity | 1 time step | cells | no activity | 1 time step | cells | cells activity | 1 time step |
9 | cells | cells activity | all time steps | cells | cells activity | all time steps | cells | cells activity | all time steps |
10 | cells | cells activity | 1 time step | cells | no activity | all time steps | cells | cells activity | all time steps |
11 | points | points activity | 1 time step | points | points activity | 1 time step | points | points activity | 1 time step |
12 | points | points activity | 1 time step | points | points activity | all time steps | points | points activity | all time steps |
13 | points | cells activity | all time steps | points | no activity | all time steps | points | cells activity | all time steps |
14 | points | cells activity | all time steps | points | points activity | 1 time step | points | points activity | all time steps |
15 | points | cells activity | all time steps | points | points activity | all time steps | points | points activity | all time steps |
16 | points | points activity | all time steps | points | points activity | all time steps | points | points activity | all time steps |
17 | points | no activity | 1 time step | points | no activity | 1 time step | points | no activity | 1 time step |
18 | points | cells activity | 1 time step | points | no activity | 1 time step | points | cells activity | 1 time step |
19 | points | cells activity | 1 time step | points | cells activity | 1 time step | points | cells activity | 1 time step |
20 | points | cells activity | 1 time step | points | cells activity | all time steps | points | cells activity | all time steps |
21 | points | no activity | 1 time step | points | no activity | 1 time step | points | no activity | 1 time step |
22 | points | no activity | 1 time step | points | points activity | all time steps | points | points activity | all time steps |
23 | points | cells activity | 1 time step | points | no activity | all time steps | points | cells activity | all time steps |
24 | points | no activity | 1 time step | points | points activity | 1 time step | points | points activity | 1 time step |
25 | points | no activity | all time steps | points | no activity | all time steps | points | no activity | all time steps |
26 | points | cells activity | 1 time step | points | points activity | 1 time step | points | points activity | 1 time step |
27 | points | cells activity | 1 time step | points | points activity | all time steps | points | points activity | all time steps |
28 | points | no activity | all time steps | points | points activity | 1 time step | points | points activity | all time steps |
29 | points | no activity | all time steps | points | points activity | all time steps | points | points activity | all time steps |
30 | points | cells activity | all time steps | points | no activity | 1 time step | points | cells activity | all time steps |
31 | points | cells activity | all time steps | points | cells activity | all time steps | points | cells activity | all time steps |
Examples
The examples below provide descriptions and context for dataset calculator results.
Test 1 of Dataset Calculator
This example is regarding two datasets. The inputs for dataset value locations include cells, there is one time step per each dataset, and no activity in either dataset. The result location for the datasets include cells, there is one result time step per each dataset, and no result activity in either dataset.
Test 4 of Dataset Calculator
This example is regarding two datasets. The inputs for dataset value locations include cells, there is one time step per each dataset, and cells activity in both datasets. The result location for the datasets include cells, there is one result time step per each dataset, and cells activity in both datasets.
Test 11 of Dataset Calculator
This example is regarding two datasets. The inputs for dataset value locations include points, there is one time step per each dataset, and points activity in both datasets. The result location for the datasets include points, there is one result time step per each dataset, and points activity in both datasets.
Test 17 of Dataset Calculator
This example is regarding two datasets. The inputs for dataset value locations include points, there is one time step per each dataset, and no activity in either dataset. The result location for the datasets include points, there is one result time step per each dataset, and no activity in either dataset.
Test 29 of Dataset Calculator
This example is regarding two datasets. The inputs for dataset 1 value location includes points, all time steps are used in dataset 1, and no activity in dataset 1. The inputs for dataset 2 value location includes points, all time steps are used in dataset 2, and points activity in dataset 2. The result location for both datasets include points, all time steps are used per each dataset, and points activity in both datasets.
Related Links
GMS – Groundwater Modeling System | ||
---|---|---|
Modules: | 2D Grid • 2D Mesh • 2D Scatter Point • 3D Grid • 3D Mesh • 3D Scatter Point • Boreholes • GIS • Map • Solid • TINs • UGrids | |
Models: | FEFLOW • FEMWATER • HydroGeoSphere • MODAEM • MODFLOW • MODPATH • mod-PATH3DU • MT3DMS • MT3D-USGS • PEST • PHT3D • RT3D • SEAM3D • SEAWAT • SEEP2D • T-PROGS • ZONEBUDGET | |
Aquaveo |
WMS – Watershed Modeling System | ||
---|---|---|
Modules: | Terrain Data • Drainage • Map • Hydrologic Modeling • River • GIS • 2D Grid • 2D Scatter | |
Models: | CE-QUAL-W2 • GSSHA • HEC-1 • HEC-HMS • HEC-RAS • HSPF • MODRAT • NSS • OC Hydrograph • OC Rational • Rational • River Tools • Storm Drain • SMPDBK • SWMM • TR-20 • TR-55 | |
Toolbars: | Modules • Macros • Units • Digitize • Static Tools • Dynamic Tools • Drawing • Get Data Tools | |
Aquaveo |