bes
Updated for version 3.20.6
|
A class that provides static methods to help write out attributes for a given variable. More...
#include <FONcAttributes.h>
Static Public Member Functions | |
static void | add_attributes (int ncid, int varid, AttrTable &attrs, const string &var_name, const string &prepend_attr) |
helper function for add_attributes More... | |
static void | add_original_name (int ncid, int varid, const string &var_name, const string &orig) |
Adds an attribute for the variable if the variable name had to be modified in any way. More... | |
static void | add_variable_attributes (int ncid, int varid, BaseType *b) |
Add the attributes for an OPeNDAP variable to the netcdf file. More... | |
A class that provides static methods to help write out attributes for a given variable.
Given a BaseType from a DataDDS, these functions can write out attributes for that BaseType as well as all parent classes of that BaseType. Since netcdf is a flattened data structure, any variables within a structure or grid will write out attributes for the structure or grid along with its own attributes.
Definition at line 53 of file FONcAttributes.h.
|
static |
helper function for add_attributes
ncid | The id of the netcdf file being written to |
varid | The netcdf variable id |
attrs | The OPenDAP AttrTable containing the attributes |
var_name | any variable name to prepend to the attribute name |
prepend_attr | Any name to prepend to the name of the attribute. As far as I know, this is no longer used; when standard attributes are prefixed client programs will (often) fail to recognize the standard attributes (since the names are no longer really standard). |
BESInternalError | if there are any problems writing out the attributes for the data object. |
Definition at line 129 of file FONcAttributes.cc.
|
static |
Adds an attribute for the variable if the variable name had to be modified in any way.
When generating a new name for a variable, the original name might contain characters that are not allowed in netcdf files. For this reason, the characters are modified and we add an attribute to the netcdf file for that variable to signify the change.
ncid | The id of the netcdf open file |
varid | The id of the variable to add the attribute to |
var_name | The name of the variable as it appears in the new * file |
orig | The name of the variable before it was modified |
Definition at line 415 of file FONcAttributes.cc.
|
static |
Add the attributes for an OPeNDAP variable to the netcdf file.
This method writes out any attributes for the provided variable and for any parent BaseType objects of this variable. For example, if this variable is a part of a structure, which is a part of another structure, then we write out all of the attributes for the outermost structure, the inner structure, and the variable of the structure. For example, if there is a structure Alpha with attribute a1, that contains a structure Point with attribute s2, which contains two variables x, with attribute a3, and y, with attribute a4, then variable Alpha.Point.x will contain attributes Alpha.a1, Alpha.Point.s2, and a3 and Alpha.Point.y will contain attributes Alpha.a1, Alpha.Point.s2, and a4.
Attributes can also be attribute containers, and not just simple attributes. In this case, just as with structures, we flatten out the attribute containers. For example, if there is an attribute container called name, with attributes first and last contained in it, then two attributes are created called name.first and name.last.
OPeNDAP can have multiple string values for a given attribute. This can not be represented in netcdf3 (can in netcdf4). To accomplish this we take each of the string values for the given attribute and append them together using a newline as a separator (recommended by Unidata).
ncid | The id of the netcdf file being written to |
varid | The netcdf variable id to associate the attributes to |
b | The OPeNDAP variable containing the attributes. |
BESInternalError | if there is a problem writing the attributes for the variable. |
Definition at line 77 of file FONcAttributes.cc.