medsTide
Overview
medsTide converts Canadian Marine Environmental Data Section (MEDS / DFO) ASCII water level filesβas well as 12-hour AM/PM XTide text predictions (-xtide)βinto the 4-column JHC ASCII tide format (jday hour min tide_m).
Syntax & CLI Options
medsTide [OPTIONS] -in <tidefilename> -out <mytideformatname>
| Option | Description | Default |
|---|---|---|
-in <filename> | Required. Input MEDS (or XTide) ASCII tide file. | None |
-out <filename> | Required. Output JHC ASCII tide file (jday hour min tide). | None |
-skip <N> | Number of header lines to skip at the start of the input file. | 8 (or 0 if -xtide is set before -skip) |
-xtide | Parse XTide 12-hour format (YYYY-MM-DD HH:MM AM/PM TZ tide) and set skip = 0 (unless overridden by a subsequent -skip). | Disabled (default MEDS DD/MM/YYYY HH:MM:SS AM/PM, tide) |
-v | Print parsed year, month, day, 24-hour time, and tide value for each record. | Disabled |
How It Works
- Header Skipping: Skips
skipheader lines (default8for MEDS files;0when-xtideis specified). - Delimiter Normalization: Replaces
/,:,,, and date hyphens (-within the first 11 characters) with spaces. - Record Parsing & 12-to-24 Hour Conversion:
- Default MEDS mode: Parses
day month year hour min sec am_pm tide. -xtidemode: Parsesyear month day hour min am_pm timezone tide.- Converts 12-hour
AM/PMtimestamps to 24-hour time (handling12 PM$\rightarrow$12and12 AM$\rightarrow$0in-xtidemode).
- Default MEDS mode: Parses
- Julian Day Calculation: Converts
(day, month, year)to Julian day (jday) viastdtime_dmy_to_jul_dayand writesjday hour min tideto-out.
Examples
1. Convert a standard DFO MEDS tide gauge file (skipping 8 header lines):
medsTide -in meds_saint_john.csv -out saint_john.asc
binTide -year 2007 saint_john.asc saint_john.bin
2. Convert an XTide AM/PM prediction listing:
medsTide -xtide -in xtide_pred.txt -out xtide_pred.asc