Skip to content

TSTool / Command / WriteStateMod


Overview

The WriteStateMod command writes the time series in memory to the specified StateMod format file. See the StateMod Input Type Appendix for more information about the file format. It is expected that the time series have the same interval. The time series identifier location part is written as the identifier, even if an alias is assigned to a time series.

Command Editor

The command is available in the following TSTool menu:

  • Commands / Output Time Series

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

WriteStateMod command editor

WriteStateMod Command Editor (see full-size image)

Command Syntax

The command syntax is as follows:

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

Command Parameters

Parameter            Description Default                           
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.
  • SelectedTS – the time series are those selected with the SelectTimeSeries command.
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
OutputFile
required
The StateMod file to write. The path to the file can be absolute or relative to the working directory (command file location). None – must be specified.
OutputStart The date/time for the start of the output. Use the global output period.
OutputEnd The date/time for the end of the output. Use the global output period.
MissingValue The value to write for missing data. -999
Precision The number of digits to use after the decimal point, for data values. A negative number indicates that if the formatted number is larger than the allowed output width, adjust the format accordingly by truncating fractional digits. A special value of –2001 is equivalent to –2 and additionally NO decimal point will be printed for large values. The default output precision if not specified is -2, which is then reset based on the data units (see the system/DATAUNIT file installed with TSTool).

Examples

See the automated tests.

A sample command file to process time series from the State of Colorado’s HydroBase database is as follows:

SetOutputPeriod(OutputStart="1950-01",OutputEnd="2002-12")
# 08213500 - RIO GRANDE RIVER AT THIRTY MILE BRIDGE NEAR CREEDE
08213500.DWR.Streamflow.Month~HydroBase
# 08217000 - RIO GRANDE AT WASON, BELOW CREEDE, CO.
08217000.USGS.Streamflow.Month~HydroBase
WriteStateMod(TSList=AllTS,OutputFile="RioGrande.rih")

Troubleshooting

See the main TSTool Troubleshooting documentation.

See Also