Marine systems simulation
Loading...
Searching...
No Matches
NetcdfHandler Class Reference

#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 ()
 

Detailed Description

Handler for reading NetCDF current field files.

Provides methods for opening NetCDF files, caching current velocity data, and performing spatial interpolation at query positions. Four NetCDF file layouts are supported, selected automatically from the variable/dimension names found in the file.

Member Function Documentation

◆ cacheCurrentField()

int NetcdfHandler::cacheCurrentField ( )

Cache the entire current velocity field in memory.

Returns
0 on success, non-zero error code on failure.

◆ calculateDescriptorValues()

int NetcdfHandler::calculateDescriptorValues ( float *  values)

Compute min, mean, and max velocity magnitude statistics.

Parameters
[out]valuesArray of at least 3 floats: [minVal, meanVal, maxVal] [m/s].
Returns
0 on success.

◆ getCurrentSpeedAt()

int NetcdfHandler::getCurrentSpeedAt ( float  x,
float  y,
float  z,
float *  value 
)

Get interpolated current velocity at a position.

Parameters
[in]xX (east) coordinate [m].
[in]yY (north) coordinate [m].
[in]zZ (depth) coordinate [m].
[out]valueInterpolated velocity components [u, v, w] [m/s].
Returns
0 on success.

◆ getDomainBounds()

void NetcdfHandler::getDomainBounds ( float *  bounds)

Get the spatial domain bounds of the loaded field.

Parameters
[out]boundsArray of at least 6 floats [xmin, xmax, ymin, ymax, zmin, zmax] [m].

◆ getVar()

int NetcdfHandler::getVar ( char *  name)

Get a NetCDF variable ID by name.

Parameters
[in]nameVariable name string.
Returns
NetCDF variable ID, or a negative error code if not found.

◆ isProfileFile()

bool NetcdfHandler::isProfileFile ( )

Check whether the file is a depth-profile layout.

Returns
True if the file type is Z_PROFILE_FILE.

◆ readNCFile()

void NetcdfHandler::readNCFile ( const char *  filename)

Open and parse a NetCDF file.

Parameters
[in]filenamePath to NetCDF file.

Determines the file layout type from the variable and dimension names present in the file and loads the grid coordinate arrays.


The documentation for this class was generated from the following file: