NetCDF-C++
4.3.1-developer
|
Class represents a netCDF root group. More...
#include "ncFile.h"
Public Types | |
enum | FileFormat { classic, classic64, nc4, nc4classic } |
enum | FileMode { read, write, replace, newFile } |
enum | GroupLocation { ChildrenGrps, ParentsGrps, ChildrenOfChildrenGrps, AllChildrenGrps, ParentsAndCurrentGrps, AllGrps } |
The enumeration list contains the options for selecting groups (used for returned set of NcGroup objects). More... | |
enum | Location { Current, Parents, Children, ParentsAndCurrent, ChildrenAndCurrent, All } |
The enumeration list contains the options for selecting groups. More... | |
Public Member Functions | |
NcFile () | |
Constructor generates a null object. More... | |
NcFile (const std::string &filePath, FileMode fMode) | |
Opens a netCDF file. More... | |
NcFile (const std::string &filePath, FileMode fMode, FileFormat fFormat) | |
Creates a netCDF file of a specified format. More... | |
virtual | ~NcFile () |
destructor More... | |
NcCompoundType | addCompoundType (const std::string &name, size_t size) const |
Adds a new netCDF UserDefined type. More... | |
NcDim | addDim (const std::string &name, size_t dimSize) const |
Adds a new netCDF dimension. More... | |
NcDim | addDim (const std::string &name) const |
Adds a new unlimited netCDF dimension. More... | |
NcEnumType | addEnumType (const std::string &name, NcEnumType::ncEnumType basetype) const |
Adds a new netCDF enum type. More... | |
NcGroup | addGroup (const std::string &name) const |
Adds a new child netCDF group object. More... | |
NcOpaqueType | addOpaqueType (const std::string &name, size_t size) const |
Adds a new netCDF Opaque type. More... | |
NcVar | addVar (const std::string &name, const NcType &ncType) const |
Adds a new netCDF scalar variable. More... | |
NcVar | addVar (const std::string &name, const std::string &typeName, const std::string &dimName) const |
Adds a new netCDF variable. More... | |
NcVar | addVar (const std::string &name, const NcType &ncType, const NcDim &ncDim) const |
Adds a new netCDF variable. More... | |
NcVar | addVar (const std::string &name, const std::string &typeName, const std::vector< std::string > &dimNames) const |
Adds a new netCDF multi-dimensional variable. More... | |
NcVar | addVar (const std::string &name, const NcType &ncType, const std::vector< NcDim > &ncDimVector) const |
Adds a new multi-dimensional netCDF variable. More... | |
NcVlenType | addVlenType (const std::string &name, NcType &basetype) const |
Adds a new netCDF Vlen type. More... | |
void | close () |
Close a file before destructor call. More... | |
void | enddef () |
Leave define mode, used for classic model. More... | |
NcGroupAtt | getAtt (const std::string &name, NcGroup::Location location=Current) const |
Gets the named NcGroupAtt object. More... | |
int | getAttCount (NcGroup::Location location=Current) const |
Gets the number of group attributes. More... | |
std::multimap< std::string, NcGroupAtt > | getAtts (NcGroup::Location location=Current) const |
Gets the collection of NcGroupAtt objects. More... | |
std::set< NcGroupAtt > | getAtts (const std::string &name, NcGroup::Location location=Current) const |
Gets all NcGroupAtt objects with a given name. More... | |
void | getCoordVar (std::string &coordVarName, NcDim &ncDim, NcVar &ncVar, NcGroup::Location location=Current) const |
Gets the NcDim and NcVar object pair for a named coordinate variable. More... | |
std::map< std::string, NcGroup > | getCoordVars (NcGroup::Location location=Current) const |
Gets a collection of coordinate variables. More... | |
NcDim | getDim (const std::string &name, NcGroup::Location location=Current) const |
Gets the named NcDim object. More... | |
int | getDimCount (NcGroup::Location location=Current) const |
Gets the number of NcDim objects. More... | |
std::multimap< std::string, NcDim > | getDims (NcGroup::Location location=Current) const |
Gets the collection of NcDim objects. More... | |
std::set< NcDim > | getDims (const std::string &name, NcGroup::Location location=Current) const |
Gets NcDim objects with a given name. More... | |
NcGroup | getGroup (const std::string &name, NcGroup::GroupLocation location=ChildrenGrps) const |
Gets the named child NcGroup object. More... | |
int | getGroupCount (NcGroup::GroupLocation location=ChildrenGrps) const |
Gets the number of NcGroup objects. More... | |
std::multimap< std::string, NcGroup > | getGroups (NcGroup::GroupLocation location=ChildrenGrps) const |
Gets the collection of NcGroup objects. More... | |
std::set< NcGroup > | getGroups (const std::string &name, NcGroup::GroupLocation location=ChildrenGrps) const |
Gets NcGroup objects with a given name. More... | |
int | getId () const |
Gets the group id. More... | |
std::string | getName (bool fullName=false) const |
Gets the group name. More... | |
NcGroup | getParentGroup () const |
Gets the parent group. More... | |
NcType | getType (const std::string &name, NcGroup::Location location=Current) const |
Gets the NcType object with a given name. More... | |
int | getTypeCount (NcGroup::Location location=Current) const |
Gets the number of type objects. More... | |
int | getTypeCount (NcType::ncType enumType, NcGroup::Location location=Current) const |
Gets the number of type objects with a given enumeration type. More... | |
std::multimap< std::string, NcType > | getTypes (NcGroup::Location location=Current) const |
Gets the collection of NcType objects. More... | |
std::set< NcType > | getTypes (const std::string &name, NcGroup::Location location=Current) const |
Gets the collection of NcType objects with a given name. More... | |
std::set< NcType > | getTypes (NcType::ncType enumType, NcGroup::Location location=Current) const |
Gets the collection of NcType objects with a given data type. More... | |
std::set< NcType > | getTypes (const std::string &name, NcType::ncType enumType, NcGroup::Location location=Current) const |
Gets the collection of NcType objects with a given name and data type. More... | |
NcVar | getVar (const std::string &name, NcGroup::Location location=Current) const |
Gets the named NcVar object. More... | |
int | getVarCount (NcGroup::Location location=Current) const |
Gets the number of NcVar objects in this group. More... | |
std::multimap< std::string, NcVar > | getVars (NcGroup::Location location=Current) const |
Get the collection of NcVar objects. More... | |
std::set< NcVar > | getVars (const std::string &name, NcGroup::Location location=Current) const |
Gets all NcVar objects with a given name. More... | |
bool | isNull () const |
Returns true if this object is null (i.e. More... | |
bool | isRootGroup () const |
Returns true if this is the root group, otherwise returns false. More... | |
void | open (const std::string &filePath, FileMode fMode) |
Opens a netCDF file. More... | |
void | open (const std::string &filePath, FileMode fMode, FileFormat fFormat) |
Creates a netCDF file of a specified format. More... | |
bool | operator!= (const NcGroup &rhs) const |
!= operator More... | |
bool | operator== (const NcGroup &rhs) const |
equivalence operator More... | |
NcGroupAtt | putAtt (const std::string &name, size_t len, const char **dataValues) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const std::string &dataValues) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, short datumValue) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, int datumValue) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, long datumValue) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, float datumValue) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, double datumValue) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, unsigned short datumValue) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, unsigned int datumValue) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, unsigned long long datumValue) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, long long datumValue) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, size_t len, const unsigned char *dataValues) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, size_t len, const signed char *dataValues) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, size_t len, const short *dataValues) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, size_t len, const int *dataValues) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, size_t len, const long *dataValues) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, size_t len, const float *dataValues) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, size_t len, const double *dataValues) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, size_t len, const unsigned short *dataValues) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, size_t len, const unsigned int *dataValues) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, size_t len, const unsigned long long *dataValues) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, size_t len, const long long *dataValues) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
NcGroupAtt | putAtt (const std::string &name, const NcType &type, size_t len, const void *dataValues) const |
Creates a new NetCDF group attribute or if already exisiting replaces it. More... | |
void | sync () |
Synchronize an open netcdf dataset to disk. More... | |
Protected Attributes | |
int | myId |
bool | nullObject |
assignment operator More... | |
Class represents a netCDF root group.
The Ncfile class is the same as the NcGroup class with the additional functionality for opening and closing files.
|
inherited |
The enumeration list contains the options for selecting groups (used for returned set of NcGroup objects).
|
inherited |
The enumeration list contains the options for selecting groups.
NcFile::NcFile | ( | ) |
Constructor generates a null object.
Definition at line 41 of file ncFile.cpp.
netCDF::NcFile::NcFile | ( | const std::string & | filePath, |
FileMode | fMode | ||
) |
netCDF::NcFile::NcFile | ( | const std::string & | filePath, |
FileMode | fMode, | ||
FileFormat | fFormat | ||
) |
|
virtual |
destructor
Definition at line 15 of file ncFile.cpp.
|
inherited |
Adds a new netCDF UserDefined type.
name | Name of type. |
size | The size of the new type in bytes. |
Definition at line 1290 of file ncGroup.cpp.
|
inherited |
|
inherited |
|
inherited |
Adds a new netCDF enum type.
name | Name of type. For atomic types, the CDL name is expected. This is consistent with the string returned from NcType::getName(). |
enumType | The enumeration value of the object type. |
Definition at line 1261 of file ncGroup.cpp.
|
inherited |
Adds a new child netCDF group object.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
name | Variable name. |
Definition at line 265 of file ncGroup.cpp.
|
inherited |
Adds a new netCDF Opaque type.
name | Name of type. |
size | The size of the new type in bytes. |
Definition at line 1281 of file ncGroup.cpp.
Adds a new netCDF scalar variable.
The NcType must be non-null, and be defined in either the current group or a parent group. An NcNullType exception is thrown if the NcType object is invalid.
name | Variable name. |
typeName | Type name. |
Definition at line 400 of file ncGroup.cpp.
|
inherited |
Adds a new netCDF variable.
The NcType and NcDim objects must be non-null, and be defined in either the current group or a parent group. An NcNullType exception is thrown if the NcType object is invalid. An NcNullDim exception is thrown if the NcDim object is invalid.
name | Variable name. |
typeName | Type name. |
dimName | Dimension name. |
|
inherited |
|
inherited |
Adds a new netCDF multi-dimensional variable.
The NcType and NcDim objects must be non-null, and be defined in either the current group or a parent group. An NcNullType exception is thrown if the NcType object is invalid. An NcNullDim exception is thrown if the NcDim object is invalid.
name | Variable name. |
typeName | Type name. |
dimNames | Vector of dimension names. |
|
inherited |
|
inherited |
Adds a new netCDF Vlen type.
name | Name of type. |
basetype | A NcType object to be used for the basetype. |
Definition at line 1271 of file ncGroup.cpp.
void NcFile::close | ( | ) |
Close a file before destructor call.
Definition at line 30 of file ncFile.cpp.
void NcFile::enddef | ( | ) |
Leave define mode, used for classic model.
Definition at line 131 of file ncFile.cpp.
|
inherited |
Gets the named NcGroupAtt object.
name | Name of attribute |
location | Enumeration type controlling the groups to search. |
Definition at line 593 of file ncGroup.cpp.
|
inherited |
Gets the number of group attributes.
location | Enumeration type controlling the groups to search. |
Definition at line 507 of file ncGroup.cpp.
|
inherited |
Gets the collection of NcGroupAtt objects.
location | Enumeration type controlling the groups to search. |
Definition at line 542 of file ncGroup.cpp.
|
inherited |
Gets all NcGroupAtt objects with a given name.
name | Name of attribute |
location | Enumeration type controlling the groups to search. |
|
inherited |
Gets the NcDim and NcVar object pair for a named coordinate variable.
Coordinate variable have an NcDim and NcVar object with the same name defined in the same group.
location | Enumeration type controlling the groups to search. |
Definition at line 1339 of file ncGroup.cpp.
|
inherited |
Gets a collection of coordinate variables.
Coordinate variable have an NcDim and NcVar object with the same name defined in the same group.
location | Enumeration type controlling the groups to search. |
Definition at line 1300 of file ncGroup.cpp.
|
inherited |
Gets the named NcDim object.
name | Name of dimension. |
location | Enumeration type controlling the groups to search. |
Definition at line 984 of file ncGroup.cpp.
|
inherited |
Gets the number of NcDim objects.
location | Enumeration type controlling the groups to search. |
Definition at line 904 of file ncGroup.cpp.
|
inherited |
Gets the collection of NcDim objects.
location | Enumeration type controlling the groups to search. |
Definition at line 939 of file ncGroup.cpp.
|
inherited |
|
inherited |
Gets the named child NcGroup object.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
name | Group name. |
location | Enumeration type controlling the groups to search. |
Definition at line 236 of file ncGroup.cpp.
|
inherited |
Gets the number of NcGroup objects.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
location | Enumeration type controlling the groups to search. |
Definition at line 147 of file ncGroup.cpp.
|
inherited |
Gets the collection of NcGroup objects.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
location | Enumeration type controlling the groups to search. |
Definition at line 183 of file ncGroup.cpp.
|
inherited |
Gets NcGroup objects with a given name.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
name | Name of group. |
location | Enumeration type controlling the groups to search. |
Definition at line 250 of file ncGroup.cpp.
|
inherited |
Gets the group id.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
Definition at line 141 of file ncGroup.cpp.
|
inherited |
Gets the group name.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true).
fullName | If true then the full name is returned with subgroups separated by a forward slash "/" (default is false) |
Definition at line 97 of file ncGroup.cpp.
|
inherited |
Gets the parent group.
Method will throw an netCDF::exceptions::NcNullgrp exception if the group is null (ie NcGroup::isNull()=true). If the current root is the parent group, then return a null group.
Definition at line 125 of file ncGroup.cpp.
|
inherited |
Gets the NcType object with a given name.
name | Name of type. For atomic types, the CDL name is expected. This is consistent with the string returned from NcType::getName(). |
location | Enumeration type controlling the groups to search. |
Definition at line 1227 of file ncGroup.cpp.
|
inherited |
Gets the number of type objects.
location | Enumeration type controlling the groups to search. |
Definition at line 1040 of file ncGroup.cpp.
|
inherited |
Gets the number of type objects with a given enumeration type.
enumType | The enumeration value of the object type. |
location | Enumeration type controlling the groups to search. |
Definition at line 1078 of file ncGroup.cpp.
|
inherited |
Gets the collection of NcType objects.
location | Enumeration type controlling the groups to search. |
Definition at line 1122 of file ncGroup.cpp.
|
inherited |
Gets the collection of NcType objects with a given name.
name | Name of type. For atomic types, the CDL name is expected. This is consistent with the string returned from NcType::getName(). |
location | Enumeration type controlling the groups to search. |
|
inherited |
Gets the collection of NcType objects with a given data type.
enumType | Enumeration type specifying the data type. |
location | Enumeration type controlling the groups to search. |
Definition at line 1186 of file ncGroup.cpp.
|
inherited |
Gets the collection of NcType objects with a given name and data type.
name | Name of type. For atomic types, the CDL name is expected. This is consistent with the string returned from NcType::getName(). |
enumType | Enumeration type specifying the data type. |
location | Enumeration type controlling the groups to search. |
|
inherited |
Gets the named NcVar object.
name | Variable name. |
location | Enumeration type controlling the groups to search. |
Definition at line 388 of file ncGroup.cpp.
|
inherited |
Gets the number of NcVar objects in this group.
location | Enumeration type controlling the groups to search. |
Definition at line 279 of file ncGroup.cpp.
|
inherited |
Get the collection of NcVar objects.
location | Enumeration type controlling the groups to search. |
Definition at line 313 of file ncGroup.cpp.
|
inherited |
|
inlineinherited |
|
inherited |
Returns true if this is the root group, otherwise returns false.
Definition at line 119 of file ncGroup.cpp.
void netCDF::NcFile::open | ( | const std::string & | filePath, |
FileMode | fMode | ||
) |
void netCDF::NcFile::open | ( | const std::string & | filePath, |
FileMode | fMode, | ||
FileFormat | fFormat | ||
) |
|
inherited |
!= operator
Definition at line 86 of file ncGroup.cpp.
|
inherited |
equivalence operator
Definition at line 77 of file ncGroup.cpp.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
Creates a new NetCDF group attribute or if already exisiting replaces it.
If you are writing a Fill_Value attribute, and will tell the HDF5 layer to use the specified fill value for that variable.
name | Name of attribute. |
type | The attribute type. |
len | The length of the attribute (number of Nctype repeats). |
dataValues | Data Values to put into the new attribute. If the type of data values differs from the netCDF variable type, type conversion will occur. (However, no type conversion is carried out for variables using the user-defined data types: nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.) |
void NcFile::sync | ( | ) |
Synchronize an open netcdf dataset to disk.
Definition at line 126 of file ncFile.cpp.
|
protectedinherited |