Skip to content

TSTool / Command / SelectTimeSeries


Overview

The SelectTimeSeries command selects output time series, as if done interactively, to indicate which time series should be operated on by following commands. The command minimizes the need for the Free command because other commands that operate on a time series list can use TSList=SelectedTS. See also the DeselectTimeSeries command.

If TSList=AllMatchingTSID is specified, then the TSID parameter specifies a pattern to match, for example:

  • * - will match all time series
  • A* - will match:
    • all identifiers with alias starting with A
    • all identifiers with location starting with A (including the location type if used by a time series)
  • *.*.XXXXX.*.*:
    • all time series with data type XXXXX

The use of a period in the TSID pattern triggers comparison of all of the parts. If necessary, use an alias for each time series and then match using the alias (be careful if a period is used in the alias).

Command Editor

The command is available in the following TSTool menu:

  • Commands / Select, Free, Sort Time Series

The following dialog is used to edit the command and illustrates the command syntax for selecting time series using the TSList parameter. This parameter provides the initial filter for the list of time series. The TSPosition parameter is generally not available in other commands - its use is discouraged in most cases because time series position in the output list can vary.

SelectTimeSeries command editor

SelectTimeSeries Command Editor (see full-size image)

The following dialog is used to edit the command and illustrates selecting time series by matching a property value.

SelectTimeSeries command editor specifying a property to match

SelectTimeSeries Command Editor Specifying a Property to Match (see full-size image)

The following dialog is used to edit the command and illustrates selecting time series based on whether it has data.

SelectTimeSeries command editor checking for data

SelectTimeSeries Command Editor Checking for Data (see full-size image)

The following dialog is used to edit the command and illustrates selecting time series by evaluating a time series statistic. Currently a direct check in this command is not done and instead the CheckTimeSeriesStatistic must be used to set a property, which can then be checked in this command.

SelectTimeSeries command editor specifying a statistic to check

SelectTimeSeries Command Editor Specifying a Statistic to Check (see full-size image)

The following dialog is used to edit the command and illustrates selecting time series by matching locations in a network.

SelectTimeSeries command editor specifying network nodes

SelectTimeSeries Command Editor Specifying Network Nodes (see full-size image)

Command Syntax

The command syntax is as follows:

SelectTimeSeries(Parameter="Value",...)

Command Parameters

Tab Parameter                         Description Default                           
TS List TSList 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.
  • TSPosition – time series specified by position in the results list (see TSPosition parameter below).
AllTS
TSID 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 TSList=*TSID
EnsembleID The ensemble to be processed, if processing an ensemble. Can be specified using ${Property}. Required if TSList=*EnsembleID
TSPosition A list of time series positions (1+) in output, separated by commas. Ranges can be specified as Start-End. Required if TSList=TSPosition
Property PropertyName Name of user-defined property to check. A property, if specified, is additive to selections from the TSList parameter. Can be specified using processor ${Property}.
PropertyCriterion Criterion to evaluate to determine which properties match. Required if PropertyName is specified.
PropertyValue Value to check against the property value, using criterion. Can be specified using processor ${Property}. Required if PropertyName is specified.
Check Data HasData Whether the time series has data: False or True. Not checked.
Network NetworkID The identifier for the network if selecting based on match of network node identifiers and location part of time series identifier. Network select is not used.
DownstreamNodeID The downstream node in the network to match. If preceded by a dash, don’t include the node in output. Network select is not used.
UpstreamNodeIDs Comma-separated list of upstream network node identifiers to match. If any identifier is preceded by a dash, don’t include the node in output. If selecting from network, select all nodes upstream of the downstream node.
All DeselectAllFirst Indicate whether all time series should be deselected before selecting the specified time series: True or False. False
IfNotFound Indicate how to handle the case of no time series being matched:
  • Ignore – OK if nothing selected
  • Warn – generate a warning message
  • Fail – generate a failure message
Fail
SelectCountProperty If specified, the corresponding time series property will be set to the number of selected time series after the command is executed. This is useful in cases where following commands are wrapped in an If command and should only be executed if the count is > 0. Also use to check for count of 0 and warn with the Message command. Can be specified using processor ${Property}.

Examples

See the automated tests.

A sample command file is as follows:

NewPatternTimeSeries(Alias="401234",NewTSID="401234..Precip.Day",
Description="Example data",SetStart="2000-01-01",SetEnd="2000-12-31",Units="IN",PatternValues="0,1,3,0,0,0")
SelectTimeSeries(TSList=AllMatchingTSID,TSID="40*",DeselectAllFirst=True)

Troubleshooting

See the main TSTool Troubleshooting documentation.

See Also