OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
libdap Namespace Reference

Classes

class  BindNameFunction
 The LinearScaleFunction class encapsulates the linear_scale function 'function_linear_scale' along with additional meta-data regarding its use and applicability. More...
 
class  BindShapeFunction
 
class  GeoConstraint
 Encapsulate the logic needed to handle geographical constraints when they are applied to DAP Grid (and some Array) variables. More...
 
class  GeoGridFunction
 
class  GridFunction
 
class  GridGeoConstraint
 Geographical constraint applied to a grid. More...
 
struct  gse_arg
 Argument to the GSE parser. More...
 
class  GSEClause
 Holds the results of parsing one of the Grid Selection Expression clauses. More...
 
class  LinearScaleFunction
 The LinearScaleFunction class encapsulates the linear_scale function 'function_linear_scale' along with additional meta-data regarding its use and applicability. More...
 
class  MakeArrayFunction
 The LinearScaleFunction class encapsulates the linear_scale function 'function_linear_scale' along with additional meta-data regarding its use and applicability. More...
 
class  VersionFunction
 

Enumerations

enum  relop {
  dods_nop_op, dods_greater_op, dods_greater_equal_op, dods_less_op,
  dods_less_equal_op, dods_equal_op, dods_not_equal_op
}
 

Functions

void apply_grid_selection_expressions (Grid *grid, vector< GSEClause * >clauses)
 
void function_bind_name (int argc, BaseType *argv[], DDS &dds, BaseType **btpp)
 Bind a new name to a variable. More...
 
void function_bind_shape (int argc, BaseType *argv[], DDS &, BaseType **btpp)
 Bind a shape to a DAP2 Array that is a vector. More...
 
void function_geogrid (int argc, BaseType *argv[], DDS &, BaseType **btpp)
 The geogrid function returns the part of a Grid which includes a geographically specified rectangle. More...
 
void function_grid (int argc, BaseType *argv[], DDS &, BaseType **btpp)
 The grid function uses a set of relational expressions to form a selection within a Grid variable based on the values in the Grid's map vectors. More...
 
void function_linear_scale (int argc, BaseType *argv[], DDS &, BaseType **btpp)
 Given a BaseType, scale it using 'y = mx + b'. More...
 
void function_make_array (int argc, BaseType *argv[], DDS &dds, BaseType **btpp)
 Build a new DAP Array variable. More...
 
void function_version (int, BaseType *[], DDS &dds, BaseType **btpp)
 This server-side function returns version information for the server-side functions. More...
 
void getGrids (BaseType *bt, vector< Grid * > *grids)
 Recursively traverses the BaseType bt (if its a constructor type) and collects pointers to all of the Grid and places said pointers into the vector parameter 'grids'. More...
 
void getGrids (DDS &dds, vector< Grid * > *grids)
 Recursively traverses the DDS and collects pointers to all of the Grids and places said pointers into the vector parameter 'grids'. More...
 
bool isGeoGrid (Grid *grid)
 Evaluates a Grid to see if has suitable semantics for use with function_geogrid. More...
 
vector< int > parse_dims (const string &shape)
 Parse the shape 'expression'. More...
 
void parse_gse_expression (gse_arg *arg, BaseType *expr)
 
bool unit_or_name_match (set< string > units, set< string > names, const string &var_units, const string &var_name)
 
bool unit_or_name_match (set< string > units, set< string > names, const string &var_units, const string &var_name)
 Look in the containers which hold the units attributes and variable name prefixes which are considered as identifying a vector as being a latitude or longitude vector. More...
 

Enumeration Type Documentation

Enumerator
dods_nop_op 
dods_greater_op 
dods_greater_equal_op 
dods_less_op 
dods_less_equal_op 
dods_equal_op 
dods_not_equal_op 

Definition at line 47 of file GSEClause.h.

Function Documentation

void libdap::apply_grid_selection_expressions ( Grid *  grid,
vector< GSEClause * >  clauses 
)

Definition at line 166 of file grid_utils.cc.

Referenced by function_geogrid(), and function_grid().

void libdap::function_bind_name ( int  argc,
BaseType *  argv[],
DDS &  dds,
BaseType **  btpp 
)

Bind a new name to a variable.

The linear_scale() function applies the familiar y = mx + b equation to data.

The first argument to the function is the new name and the second argument is the BaseType* to (re)name. This function can be used to assign a name to an anonymous variable or change the name of a variable. If the variable is already part of the dataset, this function will make a copy and operate on that. In that case, the function will also read values into the variable.

Parameters
argcA count of the arguments
argvAn array of pointers to each argument, wrapped in a child of BaseType
btppA pointer to the return value; caller must delete.
Returns
The newly (re)named variable.
Exceptions
ErrorThrown for a variety of errors.

Definition at line 62 of file BindNameFunction.cc.

Referenced by libdap::BindNameFunction::BindNameFunction().

void libdap::function_bind_shape ( int  argc,
BaseType *  argv[],
DDS &  ,
BaseType **  btpp 
)

Bind a shape to a DAP2 Array that is a vector.

The product of the dimension sizes must match the number of elements in the vector. This function takes two arguments: A shape expression and a BaseType* to the DAP2 Array that holds the data. In practice, the Array can already have a shape (it's a vector, so that is a shape, e.g.) and this function simply changes that shape. The shape expression is the C bracket notation for array size and is parsed by this function.

Parameters
argcA count of the arguments
argvAn array of pointers to each argument, wrapped in a child of BaseType
btppA pointer to the return value; caller must delete.
Returns
The newly (re)named variable.
Exceptions
ErrorThrown for a variety of errors.

Definition at line 66 of file BindShapeFunction.cc.

References parse_dims().

Referenced by libdap::BindShapeFunction::BindShapeFunction().

Here is the call graph for this function:

void libdap::function_geogrid ( int  argc,
BaseType *  argv[],
DDS &  ,
BaseType **  btpp 
)

The geogrid function returns the part of a Grid which includes a geographically specified rectangle.

The arguments to the function are the name of a Grid, the left-top and right-bottom points of the rectangle and zero or more relational expressions of the sort that the grid function accepts. The constraints on the arguments are:

  • The Grid must have Latitude and Longitude map vectors. Those are discovered by looking for map vectors which satisfy enough of any one of a set of conventions to make the identification of those map vectors positive or by guessing which maps are which. The set of conventions supported is: COARDS, CF 1.0, GDT and CSC (see http://www.unidata.ucar.edu/software/netcdf/conventions.html). If the geogrid guesses at the maps, it adds an attribute (geogrid_warning) which says so. (in version 1.1)
  • The rectangle corner points are in Longitude-Latitude. Longitude may be given using -180 to 180 or 0 to 360. For data sources with global coverage, geogrid assumes that the Longitude axis is circular. For requests made using 0/359 notation, it assumes it is modulus 360. Requests made using -180/179 notation cannot use values outside that range.
  • The notation used to specify the rectangular region determines the notation used in the longitude/latitude map vectors of the Grid returned by the function.
  • There are no restrictions on the relational expressions beyond those for the grid() (see func_grid_select()) function.
Note
The geogrid() function is implemented as a 'BaseType function' which means that there can be only one function per request and no other variables may be named in the request.
Parameters
argcThe number of values in argv.
argvAn array of BaseType pointers which hold the arguments to be passed to geogrid. The arguments may be Strings, Integers, or Reals, subject to the above constraints.
btppA pointer to the return value; caller must delete.
Returns
The constrained and read Grid, ready to be sent.

Definition at line 80 of file GeoGridFunction.cc.

References libdap::GridGeoConstraint::apply_constraint_to_data(), apply_grid_selection_expressions(), arg, libdap::GridGeoConstraint::get_constrained_grid(), libdap::gse_arg::get_gsec(), gse_arg, parse_gse_expression(), and libdap::GeoConstraint::set_bounding_box().

Referenced by libdap::GeoGridFunction::GeoGridFunction().

Here is the call graph for this function:

void libdap::function_grid ( int  argc,
BaseType *  argv[],
DDS &  ,
BaseType **  btpp 
)

The grid function uses a set of relational expressions to form a selection within a Grid variable based on the values in the Grid's map vectors.

Thus, if a Grid has a 'temperature' map which ranges from 0.0 to 32.0 degrees, it's possible to request the values of the Grid that fall between 10.5 and 12.5 degrees without knowing to which array indexes those values correspond. The function takes one or more arguments:

  • The name of a Grid.
  • Zero or more strings which hold relational expressions of the form:
    • <map var> <relop> <constant>
    • <constant> <relop> <map var> <relop> <constant>

Each of the relation expressions is applied to the Grid and the result is returned.

Note
Since this is a function and one of the arguments is the grid, the grid is read (using the Grid::read() method) at the time the argument list is built.
Todo:
In order to be used by geogrid() , this code may have to be modified so that the maps and array are not re-read by the serialize() method. It might also be a good idea to change from the '?grid(SST,"10<time<20")' syntax in a URL to '?SST&grid(SST,"10<time<20")' even though it's more verbose in the URL, it would make the function a true 'selection operator' and allow several grids to be returned with selections in one request.
Parameters
argcThe number of values in argv.
argvAn array of BaseType pointers which hold the arguments to be passed to geogrid. The arguments may be Strings, Integers, or Reals, subject to the above constraints.
btppA pointer to the return value; caller must delete.
See also
geogrid() (func_geogrid_select) A function which has logic specific to longitude/latitude selection.

Definition at line 81 of file GridFunction.cc.

References apply_grid_selection_expressions(), arg, libdap::gse_arg::get_gsec(), gse_arg, and parse_gse_expression().

Referenced by libdap::GridFunction::GridFunction().

Here is the call graph for this function:

void libdap::function_linear_scale ( int  argc,
BaseType *  argv[],
DDS &  ,
BaseType **  btpp 
)

Given a BaseType, scale it using 'y = mx + b'.

The linear_scale() function applies the familiar y = mx + b equation to data.

Either provide the constants 'm' and 'b' or the function will look for the COARDS attributes 'scale_factor' and 'add_offset'.

Parameters
argcA count of the arguments
argvAn array of pointers to each argument, wrapped in a child of BaseType
btppA pointer to the return value; caller must delete.
Returns
The scaled variable, represented using Float64
Exceptions
ErrorThrown if scale_factor is not given and the COARDS attributes cannot be found OR if the source variable is not a numeric scalar, Array or Grid.

Definition at line 169 of file LinearScaleFunction.cc.

Referenced by libdap::LinearScaleFunction::LinearScaleFunction().

void libdap::function_make_array ( int  argc,
BaseType *  argv[],
DDS &  dds,
BaseType **  btpp 
)

Build a new DAP Array variable.

The linear_scale() function applies the familiar y = mx + b equation to data.

Read the type, shape and values from the arg list. The variable will be named anon<number> and is guaranteed not to shadow the name of an existing variable in the DDS.

See also
function_bind_name
Parameters
argcA count of the arguments
argvAn array of pointers to each argument, wrapped in a child of BaseType
btppA pointer to the return value; caller must delete.
Returns
The new DAP Array variable.
Exceptions
ErrorThrown for a variety of errors.

Definition at line 130 of file MakeArrayFunction.cc.

References BESDEBUG, and parse_dims().

Referenced by libdap::MakeArrayFunction::MakeArrayFunction().

Here is the call graph for this function:

void libdap::function_version ( int  ,
BaseType *  [],
DDS &  dds,
BaseType **  btpp 
)

This server-side function returns version information for the server-side functions.

Note that this function takes no arguments and returns a String using the BaseType value/result parameter.

Parameters
btppA pointer to the return value; caller must delete. Change implementation to use libxml2 objects and NOT strings.

Definition at line 49 of file VersionFunction.cc.

Referenced by libdap::VersionFunction::VersionFunction().

void libdap::getGrids ( BaseType *  bt,
vector< Grid * > *  grids 
)

Recursively traverses the BaseType bt (if its a constructor type) and collects pointers to all of the Grid and places said pointers into the vector parameter 'grids'.

If the BaseType parameter bt is an instance of Grid the it is placed in the vector.

Parameters
btThe BaseType to evaluate
gridsA vector into which to place a pointer to every Grid.

Definition at line 54 of file grid_utils.cc.

Referenced by libdap::GeoGridFunction::canOperateOn(), libdap::GridFunction::canOperateOn(), and getGrids().

void libdap::getGrids ( DDS &  dds,
vector< Grid * > *  grids 
)

Recursively traverses the DDS and collects pointers to all of the Grids and places said pointers into the vector parameter 'grids'.

Parameters
ddsThe dds to search
gridsA vector into which to place a pointer to every Grid in the DDS.

Definition at line 87 of file grid_utils.cc.

References getGrids().

Here is the call graph for this function:

bool libdap::isGeoGrid ( Grid *  grid)

Evaluates a Grid to see if has suitable semantics for use with function_geogrid.

Note
Add an 'is' method to GeoGrid so that this code can its logic without having it throw an exception.
Parameters
gridthe Grid to evaluate.
Returns
True if the grid will work with the GeoGrid function, otherwise false.

Definition at line 104 of file grid_utils.cc.

Referenced by libdap::GeoGridFunction::canOperateOn().

vector< int > libdap::parse_dims ( const string &  shape)

Parse the shape 'expression'.

The form of the expression is '[' size ']'

Note
Also used by bind_shape()
Returns
A vector of ints

Definition at line 66 of file MakeArrayFunction.cc.

Referenced by function_bind_shape(), and function_make_array().

void libdap::parse_gse_expression ( gse_arg arg,
BaseType *  expr 
)

Definition at line 116 of file grid_utils.cc.

References gse_delete_buffer(), gse_parse(), gse_restart(), and gse_string().

Referenced by function_geogrid(), and function_grid().

Here is the call graph for this function:

bool libdap::unit_or_name_match ( set< string >  units,
set< string >  names,
const string &  var_units,
const string &  var_name 
)
bool libdap::unit_or_name_match ( set< string >  units,
set< string >  names,
const string &  var_units,
const string &  var_name 
)

Look in the containers which hold the units attributes and variable name prefixes which are considered as identifying a vector as being a latitude or longitude vector.

Parameters
unitsA container with a bunch of units attribute values.
namesA container with a bunch of variable name prefixes.
var_unitsThe value of the 'units' attribute for this variable.
var_nameThe name of the variable.
Returns
True if the units_value matches any of the accepted attributes exactly or if the name_value starts with any of the accepted prefixes

Definition at line 82 of file GeoConstraint.cc.