Skip to content

TSTool / Command / Add


Overview

The Add command adds regular interval time series. The receiving time series will be set to the sum of itself and all indicated time series. See also the NewTimeSeries command, which can create an empty time series to receive a sum. If an ensemble is being processed, another ensemble can be added, a single time series can be added to all time series in the ensemble, or a list of time series can be added to 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 sum before addition. Missing data in the parts can be ignored (do not set the sum to missing) or can result in missing values in the sum. Implications of ignoring missing data should be considered. Time series being added must have the same data interval.

Command Editor

The command is available in the following TSTool menu:

  • Commands / Manipulate Time Series

The following dialog is used to edit the command and illustrates the syntax of the command.

Add command editor

Add Command Editor (see full-size image)

Command Syntax

The command syntax is as follows:

Add(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.
AddTSList Indicates the list of time series to be processed, one of:
  • AllMatchingTSID – all time series that match the TSID (single TSID or TSID with wildcards) will be processed.
  • AllTS – all time series before the command.
  • EnsembleID – all time series in the ensemble will be processed (see the EnsembleID parameter).
  • FirstMatchingTSID – the first time series that matches the TSID (single TSID or TSID with wildcards) will be processed.
  • LastMatchingTSID – the last time series that matches the TSID (single TSID or TSID with wildcards) will be processed.
  • SelectedTS – the time series are those selected with the SelectTimeSeries command.
  • SpecifiedTSID – the specified list of time series given by the AddTSID parameter.
AllTS (the time series receiving the result will not be added to itself).
AddTSID 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 AddTSList=*TSID
AddEnsembleID The ensemble to be processed, if processing an ensemble. Can be specified using ${Property}. Required if AddTSList=*EnsembleID. Use if an ensemble is being added to another ensemble.
HandleMissingHow Indicates how to handle missing data in a time series:
  • IgnoreMissing – create a result even if missing data are encountered in one or more time series – this option is not as rigorous as the others
  • SetMissingIfOtherMissing – set the result missing if any of the other time series values is missing
  • SetMissingIfAnyMissing – set the result missing if any time series value involved is missing IgnoreMissing
IgnoreMissing
HandleDataFlagsHow Indicates how to handle data flags:
  • Ignore - do not modify the data flags
  • Set - set (override) the data flags in the result to the added time series
Ignore
IfTSListToAddIsEmpty Action if time series list to add is empty. Fail
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
Add(TSID="0100501.DWR.DivTotal.Month",TSList="SpecifiedTSID",
AddTSID="0100503.DWR.DivTotal.Month",HandleMissingHow=IgnoreMissing)

Troubleshooting

See the main TSTool Troubleshooting documentation.

See Also