This component performs simple calculations on its inputs to produce a calculated output value. Example calculations include summation, multiplication, division and other simple operations.
Usage
da.calc.simple [switches…] [[station] variables times [archive]|[file]]
Switches
- --operation=TYPE
-
This is the operation performed on the inputs to generate the output.
Default: None
The possible values are:
- --operation=Add
-
A + B
- --operation=AddAll
-
A + B + C
- --operation=AddMulitply
-
A * (B + C)
- --operation=CosScaled
-
cos(A) * B
- --operation=Divide
-
A / B
- --operation=DivideAll
-
A / B / C
- --operation=Identity
-
Same as --operation=None
- --operation=Limit
-
min(max(A, B), C) (i.e. A if B ≤ A ≤ C)
- --operation=Log
-
Same as --operation=Logarithm
- --operation=Logarithm
-
log_B(A) (i.e. log(A)/log(B))
- --operation=Max
-
max(A, B) (i.e. A if A > B)
- --operation=Min
-
min(A, B) (i.e. A if A < B)
- --operation=Multiply
-
A * B
- --operation=MultiplyAdd
-
A * B + C
- --operation=MultiplyAll
-
A * B * C
- --operation=None
-
A
- --operation=Power
-
Aᴮ
- --operation=RatioSum
-
A / (B + C)
- --operation=SinScaled
-
sin(A) * B
- --operation=Subtract
-
A - B
- --operation=SubtractAll
-
A - B - C
- --operation=SumRatio
-
(A + B) / C
- --operation=UndefinedAbove
-
A if A ≤ B
- --operation=UndefinedBelow
-
A if A ≥ B
- --operation=UndefinedOutside
-
A if B ≤ A ≤ C
- --operation=Wrap
-
Wrap A in [0,B]
- --operation=WrapRange
-
Wrap A in [B,C]
- --operation=abs
-
|A|
- --operation=acos
-
acos(A)
- --operation=asin
-
asin(A)
- --operation=atan
-
atan(A)
- --operation=atan2
-
atan2(A,B)
- --operation=cos
-
cos(A)
- --operation=exp
-
eᴬ
- --operation=ln
-
ln(A)
- --operation=log10
-
log⏨(A)
- --operation=sin
-
sin(A)
- --operation=tan
-
tan(A)
- --a=INPUT
-
The first input. The usage depends on the operation selected.
- --b=INPUT
-
The second input. The usage depends on the operation selected.
- --c=INPUT
-
The third input. The usage depends on the operation selected.
- --calibration=COEFFICIENTS…
-
The calibration applied to the output after the calculation is performed.
- --fanout-variable=STRING
-
When set, this matches input variables against the given regular expression. When one matches, a new copy of the operation is created with the other parameters (station, archive, flavors). This is most commonly used to handle cut-size selected data by matching one of the inputs that is size selected.
Default: Disabled
- --inverse-calibration[=BOOLEANS]
-
When set, the calibration is inverted (backed out) instead of applied. This is used to get the original values of an already applied calibration.
- --output=SELECTION
-
This is output value of the calculation.
Arguments
If no bare word input specification is supplied then data are read from standard input.
- station
-
This argument is used to specify the station used to look up variables that do not include a station as part of an archive read specification. The station is the three letter GAW station code of the location, such as
BND
. The argument accepts multiple stations specified as regular expressions and separated by:
or;
or,
. For exampleBND,MLO
and(BND|MLO)
are two ways of selecting both the BND and MLO stations.The special value
allstations
may also be specified to select all stations. - variables
-
This argument may be split into multiple actual program arguments. Each part consists of one or more variable specifications separated by
,
(commas). The station and archive used if none are explicitly given are defined in the other arguments or inferred from system defaults. For example simplyBsB_S11
selects the blue scattering from the S11 instrument and returns all cut sizes and metadata. If instead::BsB_S11:pm10
is used then only PM10 scattering is returned. That is, the selection specifies "any" station and archive (the defaults are set in the other arguments) then requires that it has the "PM10" flavor. A specification such asbnd:BsB_S11,thd:BsB_S11
allows for data selection from multiple stations.This may also be used to select a "record" type alias such as "S11a". In this mode all the variables defined in the alias are returned.
Finally the special value
everything
can be used to select all available data for the given station(s) and archive(s). - times
-
This argument may be split into multiple actual program arguments. This full list of time arguments defines a time bounds list that sets the range of data queried. The final resulting data are clipped to the given time bounds but any values that intersect them are returned.
- archive
-
This argument is used to specify the archive used to look up variables that do not include an archive as part of an archive read specification. The archive is the internal name, such as
raw
orclean_meta
. The argument accepts multiple archives specified as regular expressions and separated by:
or;
or,
. For exampleraw(_meta)?
selects both theraw
andraw_meta
archives.The special value
allarchives
may also be used to select all available archives. - file
-
This argument is used to specify the the file to read data from. If it is present and exists then data is read from the given file name instead of from standard input. Alternatively
-
(a single dash) may be used to explicitly specify standard input.
Examples
- Calculate non-zero adjusted scattering
-
This calculates BsG_S11 + BswG_S11 and places the output into ZBsfG_S11. That is, it generates the total scattering with the wall scattering added back in.
da.calc.simple --operation=Add --a=bnd:raw:BsG_S11 --b=bnd:raw:BswG_S11 --output=bnd:raw:ZBsfG_S11 bnd S11a,BswG_S11 2015-05-01 2015-05-03
Or:
da.calc.simple --operation=Add --a=bnd:raw:BsG_S11 --b=bnd:raw:BswG_S11 --output=bnd:raw:ZBsfG_S11 input_file.c3d
Or:
da.get bnd S11a,BswG_S11 2015-05-01 2015-05-03 | da.calc.simple --operation=Add --a=bnd:raw:BsG_S11 --b=bnd:raw:BswG_S11 --output=bnd:raw:ZBsfG_S11