environmentaltools.processes.read_copla
- environmentaltools.processes.read_copla(fname, grid=None)[source]
Load COPLA model velocity field output.
- Parameters:
fname (str) – Path to COPLA velocity output file
grid (dict, optional) – Existing grid dictionary to update. If None, creates new dictionary.
- Returns:
Grid dictionary with keys: - ‘u’: East-west velocity component (m/s) - ‘v’: North-south velocity component (m/s) - ‘U’: Velocity magnitude (m/s) - ‘DirU’: Current direction (degrees, oceanographic convention)
- Return type:
dict
Notes
File format: - Skips first 7 header rows - Columns: x, y, u, v (whitespace-delimited) - Data reshaped to 2D grid with ghost cells padding
Direction convention: - 0° = North, 90° = East (oceanographic) - Computed from arctan2(v, u) + 90°
Examples
>>> grid = read_copla('velocity.001') >>> print(grid['U'].shape) >>> print(f"Max velocity: {grid['U'].max():.2f} m/s")