TSTool / Command / SortTimeSeries
Overview
The SortTimeSeries
command sorts time series based on the specified criteria:
- the time series identifier or alias
- a time series property
- a string formatted from time series properties
This command is useful for ordering time series before writing output or visualization.
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 syntax of the command.
SortTimeSeries
Command Editor to Sort by TSID or Alias (see full-size image)
The following dialog is used to edit the command and illustrates the syntax of the command when sorting by a property.
SortTimeSeries
Command Editor to Sort by a Time Series Property (see full-size image)
The following dialog is used to edit the command and illustrates the syntax of the command for property formatting.
SortTimeSeries
Command Editor to Sort by a Time Series Formatted Property (see full-size image)
Command Syntax
The command syntax is as follows:
SortTimeSeries(Parameter="Value",...)
Command Parameters
Parameter | Description | Default |
---|---|---|
TSIDFormat |
Sort by alias or TSID, determining the identifier for each time series as per the parameter value:
|
TSID |
Property |
Sort using the values of the specified time series property. Nulls are treated as blanks if strings and very small number for integers and floating point numbers. | |
PropertyFormat |
Sort using a string that formats one or more time series properties, indicated with:
|
|
SortOrder |
Sort order, either Ascending or Descending . |
Ascending |
Examples
See the automated tests.
A sample command file using data from the State of Colorado’s HydroBase database is as follows:
06756500.USGS.Streamflow.Month~HydroBase
# 06758300 - KIOWA CREEK AT BENNETT, CO.
06758300.USGS.Streamflow.Month~HydroBase
# 06758000 - KIOWA CREEK AT ELBERT, CO.
06758000.USGS.Streamflow.Month~HydroBase
# 06757600 - KIOWA CREEK AT K-79 RES, NEAR EASTONVILLE, CO.
06757600.DWR.Streamflow.Month~HydroBase
# 06758200 - KIOWA CREEK AT KIOWA, CO.
06758200.USGS.Streamflow.Month~HydroBase
# 06753400 - LONETREE CREEK AT CARR, CO.
06753400.USGS.Streamflow.Month~HydroBase
# 06753990 - LONETREE CREEK NEAR GREELEY, CO.
06753990.USGS.Streamflow.Month~HydroBase
# 06753500 - LONETREE CREEK NEAR NUNN, CO.
06753500.USGS.Streamflow.Month~HydroBase
# 06759910 - SOUTH PLATTE RIVER AT COOPER BRIDGE NEAR BALZAC
06759910.DWR.Streamflow.Month~HydroBase
# 06759500 - SOUTH PLATTE RIVER AT FORT MORGAN
06759500.USGS.Streamflow.Month~HydroBase
# 06756995 - SOUTH PLATTE RIVER AT MASTERS, CO.
06756995.USGS.Streamflow.Month~HydroBase
# 06757000 - SOUTH PLATTE RIVER AT SUBLETTE, CO.
06757000.USGS.Streamflow.Month~HydroBase
# 06754000 - SOUTH PLATTE RIVER NEAR KERSEY
06754000.DWR.Streamflow.Month~HydroBase
# 06758500 - SOUTH PLATTE RIVER NEAR WELDONA
06758500.DWR.Streamflow.Month~HydroBase
# 06758100 - WEST KIOWA CREEK AT ELBERT, CO.
06758100.USGS.Streamflow.Month~HydroBase
SortTimeSeries()
Troubleshooting
See the main TSTool Troubleshooting documentation.