bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
FONcUtils Class Reference

Utilities used to help in the return of an OPeNDAP DataDDS object as a netcdf file. More...

#include <FONcUtils.h>

Collaboration diagram for FONcUtils:
Collaboration graph

Static Public Member Functions

static FONcBaseTypeconvert (libdap::BaseType *v, const string &version, const bool classic_model)
 
static FONcBaseTypeconvert (libdap::BaseType *v, const string &version, const bool classic_model, map< string, int > &, vector< int > &)
 
static string gen_name (const vector< string > &embed, const string &name, string &original)
 generate a new name for the embedded variable
 
static nc_type get_nc_type (libdap::BaseType *element, bool isNC4_ENHANCED)
 translate the OPeNDAP data type to a netcdf data type
 
static void handle_error (int stax, const string &err, const string &file, int line)
 handle any netcdf errors
 
static string id2netcdf (string in)
 convert the provided string to a netcdf allowed identifier.
 
static void reset ()
 Resets the FONc transformation for a new input and out file.
 

Static Public Attributes

static string name_prefix = ""
 If a variable name, dimension name, or attribute name begins with a character that is not supported by netcdf, then use this prefix to prepend to the name.
 

Detailed Description

Utilities used to help in the return of an OPeNDAP DataDDS object as a netcdf file.

This class includes static functions to help with the conversion of an OPeNDAP DataDDS object into a netcdf file.

Definition at line 58 of file FONcUtils.h.

Member Function Documentation

◆ gen_name()

string FONcUtils::gen_name ( const vector< string > & embed,
const string & name,
string & original )
static

generate a new name for the embedded variable

This function takes the name of a variable as it exists in a data file, and generates a new name given that netcdf does not have structures or grids. Variables within structures and grids are considered embedded variables, so a new name needs to be generated.

The new name is then passed top id2netcdf to remove any characters that are not allowed by netcdf.

Parameters
embedA list of names for parent structures
nameThe name of the variable to use for the new name
originalThe variable name before calling id2netcdf
Returns
the newly generated name with embedded names preceeding it, and converted using id2netcdf

Definition at line 182 of file FONcUtils.cc.

◆ get_nc_type()

nc_type FONcUtils::get_nc_type ( libdap::BaseType * element,
bool isNC4_ENHANCED )
static

translate the OPeNDAP data type to a netcdf data type

Parameters
elementThe OPeNDAP element to translate
IsNC4_ENHANCEDthe flag to indicate the output is in netCDF enhanced model
Returns
the netcdf data type

Definition at line 115 of file FONcUtils.cc.

◆ handle_error()

void FONcUtils::handle_error ( int stax,
const string & err,
const string & file,
int line )
static

handle any netcdf errors

Looks up the netcdf error message associated with the provided netcdf return value and throws an exception with that information appended to the provided error message.

Note
Modified: This used to test the value of stax and return without doing anything if stax == NC_NOERR. This should not be called if there is no error.
Parameters
staxA netcdf return value. Should be any value other than NC_NOERR
errA provided error message to begin the error message with
fileThe source code file name where the error was generated
lineThe source code line number where the error was generated
Returns
Never returns
Exceptions
BESErrorif the return value represents a netcdf error

Definition at line 429 of file FONcUtils.cc.

◆ id2netcdf()

string FONcUtils::id2netcdf ( string in)
static

convert the provided string to a netcdf allowed identifier.

The function makes a copy of the incoming parameter to use and returns the new string.

Parameters
inidentifier to convert
Returns
new netcdf compliant identifier

Definition at line 87 of file FONcUtils.cc.

◆ reset()

void FONcUtils::reset ( )
static

Resets the FONc transformation for a new input and out file.

Definition at line 70 of file FONcUtils.cc.

Member Data Documentation

◆ name_prefix

string FONcUtils::name_prefix = ""
static

If a variable name, dimension name, or attribute name begins with a character that is not supported by netcdf, then use this prefix to prepend to the name.

Definition at line 60 of file FONcUtils.h.


The documentation for this class was generated from the following files: