dischargeTide
Overview
dischargeTide parses Environment Canada Water Survey daily hydrometric discharge/water-level CSV files (where each row represents day 1..31 across 12 monthly columns Jan..Dec) and outputs a chronological 5-column JHC V2 ASCII time series (year jday 0 0 value).
Syntax & CLI Options
dischargeTide [OPTIONS] -tide <in_csv_file> <out_ascii_file>
| Option | Description | Default |
|---|---|---|
-tide <filename> | Required. Input Environment Canada daily CSV file (with 3 header lines). | None |
<out_ascii_file> | Required. Output 5-column JHC V2 ASCII file (year jday hour min value). | None |
-v | Enable verbose output showing line parsing and monthly values. | Disabled |
How It Works
- Header Skipping: Reads and skips the first 3 lines of the Environment Canada CSV file.
- Comma-Delimited Parsing (
read_line):- Filters for station IDs matching
08GA022(Squamish River near Brackendale) or08GD004(Homathko River). - Extracts
param,type,year,day(1..31), and the 12 monthly floating-point values (JanthroughDec, skipping the interspersedSYMquality symbol columns).
- Filters for station IDs matching
- Annual Matrix Transpose:
- Buffers rows
day = 1..31in memory (thelines[1..31]). - When
day == 31is reached for a given year, loops over all 12 months (j = 0..11) and days (i = 1..31), computes the Julian day viastdtime_dmy_to_jul_day, and writes non-zero daily values asyear jday 0 0 value.
- Buffers rows
Examples
Convert an Environment Canada daily discharge CSV to binary OMG format:
dischargeTide -tide squamish_daily.csv squamish_discharge.asc
binTide -V2 squamish_discharge.asc squamish_discharge.bin
Workflow Context
- Used in riverine and fjord hydrographic surveys (such as Squamish River / Howe Sound) to correlate river discharge time series with multibeam surveys and bedform migration.