iwfm.file_utils

IWFM File Format Conventions —————————– IWFM input files follow a Fortran-style convention where:

  • Comment lines start with ‘C’, ‘c’, ‘*’, or ‘#’ in the first column (column 1)

  • Data lines MUST start with whitespace (space, tab) to avoid being treated as comments

This convention ensures that data values never accidentally get interpreted as comment markers. For example, a filename ‘crop_data.dat’ would appear as ‘ crop_data.dat’ (with leading space) in IWFM input files.

The skip_ahead() function implements this convention and is used internally by the utility functions in this module.

Functions

component_version(file_lines)

Return the IWFM component version tag from a file's first line.

read_line_values_to_dict(lines, start_index, ...)

Read multiple line values directly into a dictionary.

read_multiple_line_values(lines, ...[, ...])

Read multiple consecutive line values.

read_next_line_value(lines, line_index[, ...])

Skip ahead and read a value from the next line.

read_param_table(file_lines, line_index, ...)

Read a table of numeric parameters and return a numpy array.

skip_to_next_line(lines, line_index[, ...])

Advance to the next non-comment line without parsing it.