REMORA
Regional Modeling of Oceans Refined Adaptively
|
#include <REMORA_NCInterface.H>
Public Member Functions | |
~NCFile () | |
void | close () |
Close file object. | |
int | num_dimensions () const |
Number of dimensions. | |
int | num_variables () const |
Number of variables. | |
int | num_attributes () const |
Number of attributes. | |
bool | has_dim (const std::string &) const |
Check if a dimension exists by name. | |
bool | has_var (const std::string &) const |
Check if a variable exists by name. | |
bool | has_attr (const std::string &) const |
Check if an attribute exists. | |
NCDim | dim (const std::string &) const |
Get the dimension instance by name. | |
NCVar | var (const std::string &) const |
Get the variable instance by name. | |
NCDim | def_dim (const std::string &, const size_t len) const |
Define new dimension. | |
NCVar | def_scalar (const std::string &name, const nc_type dtype) const |
Define a scalar variable, i.e., 0-dimensional array. | |
NCVar | def_array (const std::string &name, const nc_type dtype, const std::vector< std::string > &) const |
Define an array. | |
NCVar | def_array_fill (const std::string &name, const nc_type dtype, const std::vector< std::string > &dnames, const void *fill_val) const |
Define an array with a fill value. | |
NCVar | def_var (const std::string &name, const nc_type dtype, const std::vector< std::string > &dnames) const |
Define a variable (wrapper for def_array) | |
NCVar | def_var_fill (const std::string &name, const nc_type dtype, const std::vector< std::string > &dnames, const void *fill_val) const |
Define a variable (wrapper for def_array) | |
void | put_attr (const std::string &name, const std::string &value) const |
Set file attribute to value. | |
void | put_attr (const std::string &name, const std::vector< double > &value) const |
Set file attribute to value. | |
void | put_attr (const std::string &name, const std::vector< float > &value) const |
Set file attribute to value. | |
void | put_attr (const std::string &name, const std::vector< int > &value) const |
Set file attribute to value. | |
std::string | get_attr (const std::string &name) const |
Read file attribute from file. | |
void | get_attr (const std::string &name, std::vector< double > &value) const |
Read file attribute from file. | |
void | get_attr (const std::string &name, std::vector< float > &value) const |
Read file attribute from file. | |
void | get_attr (const std::string &name, std::vector< int > &value) const |
Read file attribute from file. | |
void | wait_all (int num_requests, int *requests) |
wait for non-blocking calls to finish | |
std::vector< NCDim > | all_dims () const |
Return a list of all dimensions defined in this group. | |
std::vector< NCVar > | all_vars () const |
Return a list of all variables defined in this group. | |
void | enter_def_mode () const |
Enter definition mode (not needed for NetCDF4 format) | |
void | exit_def_mode () const |
Exit definition mode. | |
NCFile (const int id) | |
Static Public Member Functions | |
static NCFile | create (const std::string &name, const int cmode=NC_CLOBBER|NC_MPIIO, MPI_Comm comm=MPI_COMM_WORLD, MPI_Info info=MPI_INFO_NULL) |
Create a file. | |
static NCFile | open (const std::string &name, const int cmode=NC_NOWRITE, MPI_Comm comm=MPI_COMM_WORLD, MPI_Info info=MPI_INFO_NULL) |
Open an existing file. | |
Public Attributes | |
const int | ncid {-1} |
bool | is_open {false} |
Representation of a NetCDF file
Provide wrappers to create and open file
Definition at line 267 of file REMORA_NCInterface.H.
ncutils::NCFile::~NCFile | ( | ) |
Definition at line 452 of file REMORA_NCInterface.cpp.
|
inline |
Definition at line 385 of file REMORA_NCInterface.H.
std::vector< NCDim > ncutils::NCFile::all_dims | ( | ) | const |
Return a list of all dimensions defined in this group.
Definition at line 400 of file REMORA_NCInterface.cpp.
std::vector< NCVar > ncutils::NCFile::all_vars | ( | ) | const |
Return a list of all variables defined in this group.
Definition at line 410 of file REMORA_NCInterface.cpp.
void ncutils::NCFile::close | ( | ) |
Close file object.
Definition at line 457 of file REMORA_NCInterface.cpp.
Referenced by REMORA::WriteNCPlotFile_which().
|
static |
Create a file.
Definition at line 435 of file REMORA_NCInterface.cpp.
Referenced by REMORA::WriteNCPlotFile().
NCVar ncutils::NCFile::def_array | ( | const std::string & | name, |
const nc_type | dtype, | ||
const std::vector< std::string > & | dnames | ||
) | const |
Define an array.
Definition at line 287 of file REMORA_NCInterface.cpp.
Referenced by def_var().
NCVar ncutils::NCFile::def_array_fill | ( | const std::string & | name, |
const nc_type | dtype, | ||
const std::vector< std::string > & | dnames, | ||
const void * | fill_val | ||
) | const |
Define an array with a fill value.
Definition at line 299 of file REMORA_NCInterface.cpp.
Referenced by def_var_fill().
NCDim ncutils::NCFile::def_dim | ( | const std::string & | name, |
const size_t | len | ||
) | const |
Define new dimension.
Definition at line 275 of file REMORA_NCInterface.cpp.
Referenced by REMORA::WriteNCPlotFile_which().
NCVar ncutils::NCFile::def_scalar | ( | const std::string & | name, |
const nc_type | dtype | ||
) | const |
Define a scalar variable, i.e., 0-dimensional array.
Definition at line 281 of file REMORA_NCInterface.cpp.
|
inline |
Define a variable (wrapper for def_array)
Definition at line 334 of file REMORA_NCInterface.H.
Referenced by REMORA::WriteNCPlotFile_which().
|
inline |
Define a variable (wrapper for def_array)
Definition at line 343 of file REMORA_NCInterface.H.
Referenced by REMORA::WriteNCPlotFile_which().
NCDim ncutils::NCFile::dim | ( | const std::string & | name | ) | const |
Get the dimension instance by name.
Definition at line 269 of file REMORA_NCInterface.cpp.
Referenced by def_array(), and def_array_fill().
void ncutils::NCFile::enter_def_mode | ( | ) | const |
Enter definition mode (not needed for NetCDF4 format)
Definition at line 420 of file REMORA_NCInterface.cpp.
Referenced by REMORA::WriteNCPlotFile_which().
void ncutils::NCFile::exit_def_mode | ( | ) | const |
Exit definition mode.
Definition at line 431 of file REMORA_NCInterface.cpp.
Referenced by REMORA::WriteNCPlotFile_which().
std::string ncutils::NCFile::get_attr | ( | const std::string & | name | ) | const |
Read file attribute from file.
Definition at line 370 of file REMORA_NCInterface.cpp.
void ncutils::NCFile::get_attr | ( | const std::string & | name, |
std::vector< double > & | value | ||
) | const |
Read file attribute from file.
Definition at line 379 of file REMORA_NCInterface.cpp.
void ncutils::NCFile::get_attr | ( | const std::string & | name, |
std::vector< float > & | value | ||
) | const |
Read file attribute from file.
Definition at line 386 of file REMORA_NCInterface.cpp.
void ncutils::NCFile::get_attr | ( | const std::string & | name, |
std::vector< int > & | value | ||
) | const |
Read file attribute from file.
Definition at line 393 of file REMORA_NCInterface.cpp.
bool ncutils::NCFile::has_attr | ( | const std::string & | name | ) | const |
Check if an attribute exists.
Definition at line 347 of file REMORA_NCInterface.cpp.
bool ncutils::NCFile::has_dim | ( | const std::string & | name | ) | const |
Check if a dimension exists by name.
Definition at line 337 of file REMORA_NCInterface.cpp.
bool ncutils::NCFile::has_var | ( | const std::string & | name | ) | const |
Check if a variable exists by name.
Definition at line 342 of file REMORA_NCInterface.cpp.
int ncutils::NCFile::num_attributes | ( | ) | const |
Number of attributes.
Definition at line 325 of file REMORA_NCInterface.cpp.
int ncutils::NCFile::num_dimensions | ( | ) | const |
Number of dimensions.
Definition at line 319 of file REMORA_NCInterface.cpp.
Referenced by all_dims().
int ncutils::NCFile::num_variables | ( | ) | const |
Number of variables.
Definition at line 331 of file REMORA_NCInterface.cpp.
Referenced by all_vars().
|
static |
Open an existing file.
Definition at line 441 of file REMORA_NCInterface.cpp.
Referenced by NCTimeSeriesRiver::Initialize(), ReadNetCDFFile(), ReadNetCDFVarAttrStr(), and REMORA::WriteNCPlotFile().
void ncutils::NCFile::put_attr | ( | const std::string & | name, |
const std::string & | value | ||
) | const |
Set file attribute to value.
Definition at line 354 of file REMORA_NCInterface.cpp.
Referenced by REMORA::WriteNCPlotFile_which().
void ncutils::NCFile::put_attr | ( | const std::string & | name, |
const std::vector< double > & | value | ||
) | const |
Set file attribute to value.
Definition at line 358 of file REMORA_NCInterface.cpp.
void ncutils::NCFile::put_attr | ( | const std::string & | name, |
const std::vector< float > & | value | ||
) | const |
Set file attribute to value.
Definition at line 362 of file REMORA_NCInterface.cpp.
void ncutils::NCFile::put_attr | ( | const std::string & | name, |
const std::vector< int > & | value | ||
) | const |
Set file attribute to value.
Definition at line 366 of file REMORA_NCInterface.cpp.
NCVar ncutils::NCFile::var | ( | const std::string & | name | ) | const |
Get the variable instance by name.
Definition at line 313 of file REMORA_NCInterface.cpp.
Referenced by REMORA::WriteNCPlotFile_which().
void ncutils::NCFile::wait_all | ( | int | num_requests, |
int * | requests | ||
) |
wait for non-blocking calls to finish
Definition at line 447 of file REMORA_NCInterface.cpp.
bool ncutils::NCFile::is_open {false} |
Definition at line 388 of file REMORA_NCInterface.H.
const int ncutils::NCFile::ncid {-1} |
Definition at line 387 of file REMORA_NCInterface.H.
Referenced by all_dims(), all_vars(), close(), create(), def_array(), def_array_fill(), def_dim(), def_scalar(), dim(), enter_def_mode(), exit_def_mode(), get_attr(), get_attr(), get_attr(), get_attr(), has_attr(), has_dim(), has_var(), num_attributes(), num_dimensions(), num_variables(), open(), put_attr(), put_attr(), put_attr(), put_attr(), var(), wait_all(), REMORA::WriteNCPlotFile_which(), and ~NCFile().