hydrobricks
|
Public Member Functions | |
bool | OpenReadOnly (const string &path) |
bool | Create (const string &path) |
void | Close () |
int | GetVarsNb () |
int | GetVarId (const string &varName) |
string | GetVarName (int varId) |
vecInt | GetVarDimIds (int varId, int dimNb) |
int | DefDim (const string &dimName, int length) |
int | GetDimId (const string &dimName) |
int | GetDimLen (const string &dimName) |
int | DefVarInt (const string &varName, vecInt dimIds, int dimsNb=1, bool compress=false) |
int | DefVarFloat (const string &varName, vecInt dimIds, int dimsNb=1, bool compress=false) |
int | DefVarDouble (const string &varName, vecInt dimIds, int dimsNb=1, bool compress=false) |
vecInt | GetVarInt1D (const string &varName, int size) |
vecFloat | GetVarFloat1D (const string &varName, int size) |
vecDouble | GetVarDouble1D (const string &varName, int size) |
axxd | GetVarDouble2D (int varId, int rows, int cols) |
void | PutVar (int varId, const vecInt &values) |
void | PutVar (int varId, const vecFloat &values) |
void | PutVar (int varId, const vecDouble &values) |
void | PutVar (int varId, const axd &values) |
void | PutVar (int varId, const vecAxd &values) |
void | PutVar (int varId, const vecAxxd &values) |
bool | HasVar (const string &varName) |
bool | HasAtt (const string &attName, const string &varName="") |
vecStr | GetAttString1D (const string &attName, const string &varName="") |
void | PutAttString (const string &attName, const vecStr &values, int varId=NC_GLOBAL) |
string | GetAttText (const string &attName, const string &varName="") |
void | PutAttText (const string &attName, const string &value, int varId=NC_GLOBAL) |
Protected Attributes | |
int | m_ncId |
void FileNetcdf::Close | ( | ) |
Close the NetCDF file. Not mandatory as the file is closed in the destructor if still opened.
bool FileNetcdf::Create | ( | const string & | path | ) |
Create a NetCDF file at the given path.
path | Path of the file to be created. |
int FileNetcdf::DefDim | ( | const string & | dimName, |
int | length ) |
Define a new dimension.
dimName | Name of the new dimension. |
length | Length of the new dimension. |
int FileNetcdf::DefVarDouble | ( | const string & | varName, |
vecInt | dimIds, | ||
int | dimsNb = 1, | ||
bool | compress = false ) |
Define a new double variable.
varName | Name of the new variable. |
dimIds | The corresponding dimension ids. |
dimsNb | The number of corresponding dimensions. |
compress | Option to compress the variable values (default: false). |
int FileNetcdf::DefVarFloat | ( | const string & | varName, |
vecInt | dimIds, | ||
int | dimsNb = 1, | ||
bool | compress = false ) |
Define a new float variable.
varName | Name of the new variable. |
dimIds | The corresponding dimension ids. |
dimsNb | The number of corresponding dimensions. |
compress | Option to compress the variable values (default: false). |
int FileNetcdf::DefVarInt | ( | const string & | varName, |
vecInt | dimIds, | ||
int | dimsNb = 1, | ||
bool | compress = false ) |
Define a new integer variable.
varName | Name of the new variable. |
dimIds | The corresponding dimension ids. |
dimsNb | The number of corresponding dimensions. |
compress | Option to compress the variable values (default: false). |
vecStr FileNetcdf::GetAttString1D | ( | const string & | attName, |
const string & | varName = "" ) |
Get a string vector stored as an attribute.
attName | The attribute name. |
varName | The variable name. If empty, search in the global attributes. |
string FileNetcdf::GetAttText | ( | const string & | attName, |
const string & | varName = "" ) |
Get a string stored as an attribute.
attName | The attribute name. |
varName | The variable name. If empty, search in the global attributes. |
int FileNetcdf::GetDimId | ( | const string & | dimName | ) |
Get the dimension id corresponding to the provided name.
dimName | The dimension name of interest. |
int FileNetcdf::GetDimLen | ( | const string & | dimName | ) |
Get the length of a dimension.
dimName | The name of the dimension of interest. |
vecInt FileNetcdf::GetVarDimIds | ( | int | varId, |
int | dimNb ) |
Get the dimension ids of the provided variable.
varId | The id of the variable of interest. |
dimNb | The number of dimensions of the variable. |
vecDouble FileNetcdf::GetVarDouble1D | ( | const string & | varName, |
int | size ) |
Get the values of a 1D double variable. The whole vector retrieved at once.
varName | The name of the variable of interest. |
size | The size of the data vector. |
axxd FileNetcdf::GetVarDouble2D | ( | int | varId, |
int | rows, | ||
int | cols ) |
Get values of a 2D double variable. The whole array retrieved at once.
varId | The id of the variable of interest. |
rows | The number of rows of the data array. |
cols | The number of columns of the data array. |
vecFloat FileNetcdf::GetVarFloat1D | ( | const string & | varName, |
int | size ) |
Get the values of a 1D float variable. The whole vector retrieved at once.
varName | The name of the variable of interest. |
size | The size of the data vector. |
int FileNetcdf::GetVarId | ( | const string & | varName | ) |
Get the variable id corresponding to the provided name.
varName | The name of the variable of interest. |
vecInt FileNetcdf::GetVarInt1D | ( | const string & | varName, |
int | size ) |
Get the values of a 1D integer variable. The whole vector retrieved at once.
varName | The name of the variable of interest. |
size | The size of the data vector. |
string FileNetcdf::GetVarName | ( | int | varId | ) |
Get the variable name corresponding to the provided id.
varId | The id of the variable of interest. |
int FileNetcdf::GetVarsNb | ( | ) |
Get the number of variables in the file.
bool FileNetcdf::HasAtt | ( | const string & | attName, |
const string & | varName = "" ) |
Check if an attribute exists.
attName | The attribute name. |
varName | The variable name. If empty, search in the global attributes. |
bool FileNetcdf::HasVar | ( | const string & | varName | ) |
Check if a variable exists.
varName | The variable name. |
bool FileNetcdf::OpenReadOnly | ( | const string & | path | ) |
Open a NetCDF file as read only.
path | Path of the existing file. |
void FileNetcdf::PutAttString | ( | const string & | attName, |
const vecStr & | values, | ||
int | varId = NC_GLOBAL ) |
Store a string vector as an attribute.
attName | The attribute name. |
values | A string vector containing the data. |
varId | The variable id. If empty, search in the global attributes. |
void FileNetcdf::PutAttText | ( | const string & | attName, |
const string & | value, | ||
int | varId = NC_GLOBAL ) |
Store a string as an attribute.
attName | The attribute name. |
value | The string to store. |
varId | The variable id. If empty, search in the global attributes. |
void FileNetcdf::PutVar | ( | int | varId, |
const axd & | values ) |
Set the variable values from a 1D array of doubles.
varId | The id of the variable of interest. |
values | The data to store. |
void FileNetcdf::PutVar | ( | int | varId, |
const vecAxd & | values ) |
Set the variable values from a vector of 1D arrays of doubles.
varId | The id of the variable of interest. |
values | The data to store. |
void FileNetcdf::PutVar | ( | int | varId, |
const vecAxxd & | values ) |
Set the variable values from a vector of 2D arrays of doubles.
varId | The id of the variable of interest. |
values | The data to store. |
void FileNetcdf::PutVar | ( | int | varId, |
const vecDouble & | values ) |
Set the variable values from a vector of doubles.
varId | The id of the variable of interest. |
values | The data to store. |
void FileNetcdf::PutVar | ( | int | varId, |
const vecFloat & | values ) |
Set the variable values from a vector of floats.
varId | The id of the variable of interest. |
values | The data to store. |
void FileNetcdf::PutVar | ( | int | varId, |
const vecInt & | values ) |
Set the variable values from a vector of integers.
varId | The id of the variable of interest. |
values | The data to store. |