TSTool / Command / Subtract
Overview
The Subtract
command subtracts time series of the same interval.
The receiving time series will have data values set to its original
values minus the data values in the indicated time series.
If an ensemble is being processed, another ensemble can be subtracted,
a single time series can be subtracted from all time series in the ensemble,
or a list of time series can be subtracted from the ensemble
(the number in the list must match the number of time series in the ensemble).
This command will generate an error if the time series do not have compatible units. If the units are compatible but are not the same (e.g., IN and FT), then the units of the part will be converted to the units of the result before subtraction. Missing data in the parts can be ignored (do not set the result to missing) or can set missing values in the result. The user should consider the implications of ignoring missing data. Time series being subtracted must have the same data interval.
Command Editor
The following dialog is used to edit the command and illustrates the syntax of the command.
Subtract
Command Editor (see also the full-size image)
Command Syntax
The command syntax is as follows:
Subtract(Parameter="Value",...)
Command Parameters
Parameter | Description | Default |
---|---|---|
TSID |
The time series identifier or alias for the time series to receive the result. Can be specified using processor ${Property} . |
TSID or EnsembleID must be specified. |
EnsembleID |
The ensemble to receive the result, if processing an ensemble. Can be specified using processor ${Property} . |
TSID or EnsembleID must be specified. |
SubtractTSList |
Indicates the list of time series to be processed, one of:
|
AllTS (the time series receiving the result will not be subtracted from itself). |
SubtractTSID |
The time series identifier or alias for the time series to be processed, using the * wildcard character to match multiple time series. Can be specified using ${Property} . |
Required if SubtractTSList=*TSID |
SubtractEnsembleID |
The ensemble to be processed, if processing an ensemble. Can be specified using ${Property} . |
Required if SubtractTSList=*EnsembleID . Use if an ensemble is being subtracted from another ensemble. |
HandleMissingHow |
Indicates how to handle missing data in a time series:
|
IgnoreMissing |
AnalysisStart |
The date/time to start analyzing data. Can be specified using processor ${Property} . |
Full period is analyzed. |
AnalysisEnd |
The date/time to end analyzing data. Can be specified using processor ${Property} . |
Full period is analyzed. |
Examples
See the automated tests.
A sample command file to process a time series from the State of Colorado’s HydroBase database is as follows:
# 0100501 - EMPIRE DITCH
0100501.DWR.DivTotal.Month~HydroBase
# 0100503 - RIVERSIDE CANAL
0100503.DWR.DivTotal.Month~HydroBase
Subtract(TSID="0100501.DWR.DivTotal.Month",SubtractTSList=SpecifiedTSID,SubtractTSID="0100503.DWR.DivTotal.Month",HandleMissingHow="IgnoreMissing")
Troubleshooting
See Also
Add
commandSelectTimeSeries
command