Skip to content

Relative Directory Paths

Overview

By default, CE-QUAL-W2 expects all input and output files to reside in the same directory as the executable and the control file (w2_con.npt). For large projects with many waterbodies, branches, tributaries, and output files, a single directory becomes difficult to manage. Organize files into subdirectories to improve project clarity and simplify locating specific inputs or outputs.

CE-QUAL-W2 supports relative directory paths in the control file. Instead of placing every file in the model root directory, create subdirectories and reference them using relative path notation.

Creating a Subdirectory Structure

Consider a model with its root directory at c:\w2\LakeA. A practical directory structure might include:

Directory Contents
c:\w2\LakeA\ Executable, w2_con.npt, and other control files
c:\w2\LakeA\Inflows\ Flow, temperature, and concentration input files for branch inflows, tributaries, and distributed inflow
c:\w2\LakeA\Inputs\ Bathymetry file, shading file, wind sheltering coefficient file
c:\w2\LakeA\output_snp\ Snapshot output files
c:\w2\LakeA\output_tsr\ Time series output files

Tip

Choose a naming convention that clearly distinguishes input directories from output directories. This prevents accidental overwriting and simplifies archiving of model results.

Specifying Relative Paths in the Control File

In w2_con.npt, use the .\ prefix to specify file paths relative to the directory containing the executable. The backslash (\) separates subdirectory names from filenames, following standard Windows path conventions.

Input File Examples

To place the wind sheltering coefficient file and the shading file in the Inputs subdirectory:

WSC FILE...............................WSCFN...............................
      .\Inputs\wsc.npt
SHD FILE...............................SHDFN...............................
      .\Inputs\shade.npt

To place branch inflow files (flow, temperature, and concentration) in the Inflows subdirectory:

QIN FILE...............................QINFN...............................
BR1    .\Inflows\qP88_2012.npt
TIN FILE...............................TINFN...............................
BR1    .\Inflows\tin_P88_2012.npt
CIN FILE...............................CINFN...............................
BR1    .\Inflows\cP88_2012_updated.npt

Output File Examples

To direct snapshot and time series outputs to their respective subdirectories:

SNP FILE...............................SNPFN...............................
WB 1    .\output_snp\snp_wb1.opt
...
TSR FILE...............................TSRFN...............................
      .\output_tsr\tsr.csv

Warning

The subdirectories must exist before running the model. CE-QUAL-W2 does not create directories automatically. If a specified subdirectory is missing, the model will fail when it attempts to open the file.

Summary

  1. Create subdirectories under the model root directory to organize input and output files.
  2. In w2_con.npt, replace bare filenames with relative paths using the .\ prefix (e.g., .\Inflows\qP88_2012.npt).
  3. Verify that all referenced subdirectories exist before running the model.

Note

Relative paths are resolved from the working directory where the executable runs. If you launch the model from a different directory, such as via a batch file, set the working directory to the model root directory. See Batch Processing and Command Line for details on running models from batch scripts.