|
FhSim
3.1.0
Marine systems simulation
|
#include <netcdf_handler.h>
Public Member Functions | |
| void | readNCFile (const char *filename) |
| int | cacheCurrentField () |
| void | closeNCFile () |
| Close the NetCDF file and release the file handle. | |
| void | getDomainBounds (float *bounds) |
| int | getVar (char *name) |
| int | getCurrentSpeedAt (float x, float y, float z, float *value) |
| int | calculateDescriptorValues (float *values) |
| bool | isProfileFile () |
Handler for reading NetCDF current field files.
Provides methods for opening NetCDF files, caching current velocity data, and looking it up at query positions. Two layouts are read, selected from the variable and dimension names found in the file:
zc, yc and xc, and velocity variables u, v and w on (zc, yc, xc).xc dimension; a zc dimension and coordinate variable, and u and v on (zc).xc is NED north, yc NED east and zc depth, positive down; u, v and w are the north, east and down components. The cell size is taken from the first two coordinates of each axis, so the coordinates must be uniformly spaced. A position is given the value of the node at the lower corner of its cell, without interpolation.
| int NetcdfHandler::cacheCurrentField | ( | ) |
Cache the entire current velocity field in memory.
| int NetcdfHandler::calculateDescriptorValues | ( | float * | values | ) |
Compute min, mean, and max velocity magnitude statistics.
| [out] | values | Array of at least 3 floats: [minVal, meanVal, maxVal] [m/s]. |
| int NetcdfHandler::getCurrentSpeedAt | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float * | value | ||
| ) |
Get interpolated current velocity at a position.
| [in] | x | X (xc, north) coordinate [m]. |
| [in] | y | Y (yc, east) coordinate [m]. |
| [in] | z | Z (zc, depth) coordinate [m]. |
| [out] | value | Interpolated velocity components [u, v, w] [m/s]. |
| void NetcdfHandler::getDomainBounds | ( | float * | bounds | ) |
Get the spatial domain bounds of the loaded field.
| [out] | bounds | Array of at least 6 floats [xmin, xmax, ymin, ymax, zmin, zmax] [m]. |
| int NetcdfHandler::getVar | ( | char * | name | ) |
Get a NetCDF variable ID by name.
| [in] | name | Variable name string. |
| bool NetcdfHandler::isProfileFile | ( | ) |
Check whether the file is a depth-profile layout.
| void NetcdfHandler::readNCFile | ( | const char * | filename | ) |
Open and parse a NetCDF file.
| [in] | filename | Path to NetCDF file. |
Determines the file layout type from the variable and dimension names present in the file and loads the grid coordinate arrays.
| std::runtime_error | If the file cannot be opened, is not one of the two layouts read, or has an axis of fewer than two coordinates. |