layout: default title: combineSeaCast parent: Grid Tools nav_order: 11 —
combineSeaCast
Description
combineSeaCast is a command-line utility that processes gridded output from an oceanographic model (likely SeaCast, given the name) to derive current magnitude and azimuth. It takes four JHC-format 32-bit floating-point (.r4) grid files as input: latitude, longitude, U-velocity (eastward), and V-velocity (northward). It then calculates the vector magnitude and direction (azimuth) for the current at each grid node and outputs these as a series of JCU navigation records (latitude, longitude, magnitude, azimuth) to an ASCII file, suitable for plotting as vectors on a map.
Usage
combineSeaCast -lat <file_lat.r4> -lon <file_lon.r4> -uvel <file_uvel.r4> -vvel <file_vvel.r4> -out <output.nav> [OPTIONS]
Arguments
| Option | Description | Default / Example |
|---|---|---|
-lat <file_lat.r4> | Required. Path to the JHC-format .r4 grid file containing latitude values for each grid node. | lat_grid.r4 |
-lon <file_lon.r4> | Required. Path to the JHC-format .r4 grid file containing longitude values for each grid node. | lon_grid.r4 |
-uvel <file_uvel.r4> | Required. Path to the JHC-format .r4 grid file containing eastward (U) velocity components for each grid node. | u_velocity.r4 |
-vvel <file_vvel.r4> | Required. Path to the JHC-format .r4 grid file containing northward (V) velocity components for each grid node. | v_velocity.r4 |
-out <output.nav> | Required. Path for the output JCU navigation format file, containing latitude, longitude, current magnitude, and azimuth for each grid node. | current_vectors.nav |
-v | Enable verbose output during processing. |
How It Works
- File Opening: Opens the four input
.r4grid files (latitude, longitude, U-velocity, V-velocity) and the output.navfile. - Header Reading: Reads the
JHC_headerfrom the input files, ensuring their dimensions match. - Pixel Iteration: Iterates through each corresponding pixel in the input grids:
- Reads
latitude,longitude,u_velocity, andv_velocityfor the current grid node. - Calculates the
magnitudeof the current vector:sqrt(u_velocity^2 + v_velocity^2). - Calculates the
azimuthof the current vector:atan2(u_velocity, v_velocity). - Populates a
jcu_nav_recstructure withlatitude,longitude,magnitude, andazimuth. - Writes the
jcu_nav_recto the output.navfile.
- Reads
Output Files
<output.nav>: An ASCII file in JCU navigation format, where each record contains latitude, longitude, current magnitude, and azimuth.
Dependencies
array.h: ForJHC_headerstructure and related functions.support.h: For general utility functions and error handling.jcu_nav.h: Forjcu_nav_recstructure and related functions.
Notes
The output .nav file can be directly used by plotting tools that support the JCU navigation format to visualize current vectors overlaid on a map. This tool is valuable for converting model output into a readily plottable format for oceanographic analysis.