REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_NCFile.cpp File Reference
#include <string>
#include "REMORA_NCFile.H"
#include "REMORA_NCInterface.H"
Include dependency graph for REMORA_NCFile.cpp:

Go to the source code of this file.

Functions

std::string ReadNetCDFVarAttrStr (const std::string &fname, const std::string &var_name, const std::string &attr_name)
 Helper function for reading a single variable attribute.
 
bool QueryNetCDFVarAttrStr (const std::string &fname, const std::string &var_name, const std::string &attr_name)
 Helper function for testing for the presence of a single variable attribute.
 
bool QueryNetCDFHasVars (const std::string &fname, const amrex::Vector< std::string > &var_names)
 Helper function for testing whether a file carries every named variable.
 

Function Documentation

◆ QueryNetCDFHasVars()

bool QueryNetCDFHasVars ( const std::string &  fname,
const amrex::Vector< std::string > &  var_names 
)

Helper function for testing whether a file carries every named variable.

Parameters
fnameName of NetCDF file
var_namesNames of the variables to test for
Returns
whether every named variable is present in the file

Use this before calling BuildFABsFromNetCDFFile() on optional variables: ReadNetCDFFile() calls ncf.var(name) unconditionally, so a missing variable is a hard failure rather than a recoverable one. The answer is broadcast so every rank agrees before any collective read is attempted.

Definition at line 65 of file REMORA_NCFile.cpp.

Referenced by read_spherical_grid_vars_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ QueryNetCDFVarAttrStr()

bool QueryNetCDFVarAttrStr ( const std::string &  fname,
const std::string &  var_name,
const std::string &  attr_name 
)

Helper function for testing for the presence of a single variable attribute.

Parameters
fnameName of NetCDF file
var_nameName of variable
attr_nameName of attribute to read
Returns
whether attribute was found

Definition at line 40 of file REMORA_NCFile.cpp.

Referenced by NCTimeSeriesBoundary::Initialize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadNetCDFVarAttrStr()

std::string ReadNetCDFVarAttrStr ( const std::string &  fname,
const std::string &  var_name,
const std::string &  attr_name 
)

Helper function for reading a single variable attribute.

Parameters
fnameName of NetCDF file
var_nameName of variable
attr_nameName of attribute to read
Returns
attribute value

Definition at line 13 of file REMORA_NCFile.cpp.

Referenced by NCTimeSeries::Initialize(), NCTimeSeriesBoundary::Initialize(), and NCTimeSeriesRiver::Initialize().

Here is the call graph for this function:
Here is the caller graph for this function: