csv2cwms Complete Config Example
Below is a complete example of a configuration file for the csv2cwms command.
Not all options are required.
See csv2cwms for the main command page. This page focuses on the JSON config structure and the canonical example file.
Global options
The following top-level keys act as global defaults for all file entries under
input_files unless a file-specific override is provided.
interval
Global interval in seconds.
When
round_to_nearestis disabled, this controls the spacing used when generating output points.When
round_to_nearestis enabled, this takes precedence as the rounding interval.If not set and rounding is disabled, the command attempts to determine the interval from the CSV timestamps.
If not set and rounding is enabled, the command falls back to the interval parsed from the time series identifier. See Supported interval identifiers.
round_to_nearest
Global default for whether timestamps should be rounded into interval buckets before output values are built.
Default:
FalseFile entries may override this with their own
round_to_nearestsetting.
use_if_multiple
Global default for handling duplicate values when multiple rows land on the same timestamp after parsing or rounding.
Default:
errorValid values:
error,first,last,averageFile entries may override this with their own
use_if_multiplesetting.
Configuration options
Option |
Required / Default |
Description |
|---|---|---|
|
Yes |
Top-level mapping of input file keys to file-specific configuration blocks. |
|
No; auto-detect when not rounding |
Global interval in seconds. Used for generated point spacing, and if |
|
No; |
Global default for whether timestamps should be rounded into interval buckets before building output points. |
|
No; |
Global default duplicate-handling strategy when multiple rows land on the same timestamp. Valid values are |
|
Yes |
Each file key contains one CSV input definition. |
|
Yes |
Path to the CSV file for that input block. |
|
No; |
Store rule used when writing time series to CWMS. |
|
No; first CSV column |
Header name of the CSV column containing the timestamp. If omitted, the first CSV column is assumed to be the timestamp column. |
|
No; fallback parser list |
One date format string or a list of accepted date format strings used to parse timestamps from the CSV. |
|
No; inherits round_to_nearest |
Per-file override for |
|
No; inherits use_if_multiple |
Per-file override for |
|
Yes |
Mapping of CWMS time series identifiers to column/expression metadata. |
|
Yes |
Each TSID key contains the mapping for one output time series. |
|
Yes |
CSV column name or expression used to compute the value written to that time series. |
|
No; |
Units to send with the time series payload. |
|
No; raw value when omitted |
Decimal precision used when rounding output values before storage. If omitted, the raw computed value is stored without rounding. |
Source file:
cwmscli/commands/csv2cwms/examples/complete_config.json
{
"interval": 3600,
"round_to_nearest": true,
"use_if_multiple": "last",
"input_files": {
"BROK": {
"data_path": "cwmscli/commands/csv2cwms/tests/data/sample_brok.csv",
"store_rule": "REPLACE_ALL",
"date_col": "Time",
"date_format": [
"%m/%d/%Y %H:%M:%S",
"%m/%d/%Y %H:%M"
],
"round_to_nearest": true,
"use_if_multiple": "last",
"timeseries": {
"BROK.Elev.Inst.15Minutes.0.Rev-SCADA-cda": {
"columns": "Headwater",
"units": "ft",
"precision": 2
}
}
}
}
}