Skip to content

Fix code documentation regarding generation of rainfall interface file formats #186

@cbuahin

Description

@cbuahin

Discussed in #185

Originally posted by MitchHeineman July 24, 2024
I'd like to write a rainfall interface file outside of SWMM to facilitate use of hundreds or thousands of rain gages. The rain.c documentation explains the format, but I end up with an unreadable file. When I compare my file with one saved by SWMM, there appears to be a difference after the 14-byte file header and before the gage metadata section. Perhaps this stems from my misunderstanding of what is meant by "(MAXMSG+1 (=80) bytes)". Given that MAXMSG=1024, this would appear to be equivalent to (1025 (=80) bytes), which I cannot understand. Should the station ID be 80 bytes? Is the length of the gage metadata section 14 + 92 x number of gages? Should the starting byte for the first rain data record be 14 + 92g + 1? Is there example code that writes a rainfall interface file from a text rainfall file?

//   The layout of the SWMM binary rainfall interface file is:
//     File stamp ("SWMM5-RAIN") (10 bytes)
//     Number of SWMM rain gages in file (4-byte int)
//     Repeated for each rain gage:
//       recording station ID (not SWMM rain gage ID) (MAXMSG+1 (=80) bytes)
//       gage recording interval (seconds) (4-byte int)
//       starting byte of rain data in file (4-byte int)
//       ending byte+1 of rain data in file (4-byte int)
//     For each gage:
//       For each time period with non-zero rain:
//         Date/time for start of period (8-byte double)
//         Rain depth (inches) (4-byte float)
```</div>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions