Control File Converter for CE-QUAL-W2¶
This section describes the steps required to convert a legacy control file (w2_con.npt) and its companion graph.npt file into the Excel-based control file format (w2_con.xlsm). The converter also handles upgrading a w2_con.csv file from Version 4.1 or 4.22 to Version 4.5.
The conversion is a two-step process:
- Run the converter executable to produce a comma-separated values (CSV) formatted control file.
- Paste the CSV output into an existing Version 4.5 Excel template.
Step 1: Run the Converter Executable¶
- Copy
ConverterControlFile.exeinto the directory containing the legacy application files (w2_con.npt,graph.npt, and the bathymetry file). Alternatively, copy those three files into the directory containing the executable. If you are converting a Version 4.1 or 4.22w2_con.csvfile to Version 4.5, only thew2_con.csvand bathymetry file are needed. - Double-click the converter executable. The program generates the following output files in the same directory:
w2_con45.csv: The control file in CSV format. This file will be pasted into a Version 4.5w2_con.xlsmtemplate in Step 2.bthX.csv: A CSV-formatted bathymetry file for each waterbody, where X is the waterbody number. This format is easier to edit and analyze than the older fixed-width format. The filename reference inw2_con.csvis automatically updated tobthX.csv.
Step 2: Import into the Excel Template¶
Copy the contents of w2_con45.csv into an existing Version 4.5 w2_con.xlsm template file. You can obtain a template from any of the CE-QUAL-W2 example problems included with the model distribution.
Open and Copy the CSV Data¶
- Open the template file
w2_con.xlsm(or a descriptively named variant such asw2_con_DeGray.xlsm) from an existing example problem.
- Open
w2_con45.csvfrom the converter output in Excel.
- In
w2_con45.csv, select the columns and rows containing data. Do not select the entire sheet, because the data cannot be pasted into cell C1 ofw2_con.xlsmif the entire sheet is selected. Select all columns required by the data, including enough columns for segment-specific parameters such as sediment oxygen demand (SOD), which requires as many columns as the number of segments (IMX). - Copy the selected cells from
w2_con45.csvand paste them into cell C1 ofw2_con.xlsm. Use Paste Values and Number Formatting to preserve the colors and formatting of the original template.
Warning
Paste into column C1, not A1. Columns A and B in the Excel template contain descriptive labels and notes that are not part of the control file data.
Adjust Rows for Constituent Count¶
The template file may have been configured with a different number of water quality constituents than your application requires. Adjust the row count so that the constituent list in columns A and B aligns with the data in column C.
- Navigate to approximately row 384 in the Excel template, where the constituent order is defined.
- Compare the required number of constituents (computed by a formula in the Excel sheet) with the number of constituent rows present.
- To add rows, select the appropriate number of cells in columns A and B only, right-click, and choose Insert, then Shift cells down.
- To remove rows, select the extra cells in columns A and B only, right-click, and choose Delete, then Move cells up.
After adjustment, the labels in columns A and B should align with the corresponding data in column C.
Tip
Search for "increase # of rows" in column A to locate the sections where row adjustments may be needed.
Adjust Rows for Group Counts Exceeding Five¶
If your application uses more than 5 of any of the following group types, additional rows must be added in columns A and B at the designated locations in the Excel template:
- Structures: Look at rows 136--165. Notes in columns A and B describe where to add rows if more than 5 structures are present.
- Epiphyton/periphyton groups: Search for "epiphyton" in the Excel template to locate the relevant section.
- Algae and zooplankton groups: Search for "zooplankton" in the Excel template to locate the relevant section.
- Macrophyte groups: Search for "macrophyte" in the Excel template to locate the relevant section.
Add Double Quotes to Text Fields¶
The TITLE, HNAME, CNAME, and CDNAME fields require double quotes in the control file. Excel drops double quotes on import, so these must be restored manually.
To restore double quotes around a cell value, set up a formula in each affected cell:
where [CELLREF] is the cell reference containing the original text. Then paste the resulting values (with the double quotes) into the corresponding locations in the control file.
Note
This workaround is necessary because Excel removes double quotes when importing CSV data. If a simpler method is available in your version of Excel, use that instead.
Verify and Export¶
After completing the steps above, the w2_con.xlsm file should be fully functional. As edits are made to the control file within the Excel template, use the Export to CSV file button located in column B near the top of the sheet to export the file as w2_con.csv, which is the format read by the CE-QUAL-W2 model.
The preprocessor built into the Excel template performs validation checks and will report errors if there is a problem with the setup.