MetNoFimex::CDM Class Reference

Data structure of the Common Data Model. More...

#include <CDM.h>

List of all members.

Public Types

typedef std::map< std::string,
CDMAttribute
StrAttrMap
typedef std::map< std::string,
StrAttrMap
StrStrAttrMap
typedef std::map< std::string,
CDMDimension
StrDimMap
typedef std::map< std::string,
CDMVariable
StrVarMap

Public Member Functions

 CDM ()
virtual ~CDM ()
void addVariable (const CDMVariable &var) throw (CDMException)
 add variable to cdm
CDMVariablegetVariable (const std::string &varName) throw (CDMException)
 get a reference of a variable
const CDMVariablegetVariable (const std::string &varName) const throw (CDMException)
 get a reference of a variable
std::vector< std::stringfindVariables (const std::string &attrName, const std::string &attrValueRegExp) const
 search for variable with certain attribute-value
std::vector< std::stringfindVariables (const std::map< std::string, std::string > &findAttributes, const std::vector< std::string > &findDimensions) const
 search for variable with attribute-values and dimensions
bool checkVariableAttribute (const std::string &varName, const std::string &attribute, const boost::regex &attrValue) const
void removeVariable (const std::string &variableName)
 remove a variable and corresponding attributes
void addDimension (const CDMDimension &dim) throw (CDMException)
 add a dimension to cdm
CDMDimensiongetDimension (const std::string &dimName) throw (CDMException)
 get a reference to a dimension
const CDMDimensiongetDimension (const std::string &dimName) const throw (CDMException)
const CDMDimensiongetUnlimitedDim () const
 retrieve the unlimited dimension
bool hasUnlimitedDim (const CDMVariable &var) const
 test if a variable contains the unlimited dim
void addAttribute (const std::string &varName, const CDMAttribute &attr) throw (CDMException)
void addOrReplaceAttribute (const std::string &varName, const CDMAttribute &attr) throw (CDMException)
void removeAttribute (const std::string &varName, const std::string &attrName)
void toXMLStream (std::ostream &os) const
 print a xml representation to the stream
const StrDimMapgetDimensions () const
 get the dimension
const StrVarMapgetVariables () const
 get the variables
const StrStrAttrMapgetAttributes () const
 get the attributes
std::vector< CDMAttributegetAttributes (const std::string &varName) const
 get the attributes of an variable
CDMAttributegetAttribute (const std::string &varName, const std::string &attrName) throw (CDMException)
 get an attribute
const CDMAttributegetAttribute (const std::string &varName, const std::string &attrName) const throw (CDMException)
 get an const attribute
double getFillValue (const std::string &varName) const
void generateProjectionCoordinates (const std::string &projectionVariable, const std::string &xDim, const std::string &yDim, const std::string &lonDim, const std::string &latDim) throw (CDMException)
 generate the projection coordinates (usually named "lat lon")
bool getProjectionAndAxesUnits (std::string &projectionName, std::string &xAxis, std::string &yAxis, std::string &xAxisUnits, std::string &yAxisUnits) const throw (CDMException)
 extract the names of the projection-variable and the corresponding projection-axes

Static Public Member Functions

static const std::stringglobalAttributeNS ()
 the namespace for global attributes


Detailed Description

Data structure of the Common Data Model.

This class implements the data-structure of the Common Data Model version 1 http://www.unidata.ucar.edu/software/netcdf-java/CDM.html


Member Typedef Documentation

typedef std::map<std::string, CDMAttribute> MetNoFimex::CDM::StrAttrMap
 

typedef std::map<std::string, CDMDimension> MetNoFimex::CDM::StrDimMap
 

typedef std::map<std::string, StrAttrMap> MetNoFimex::CDM::StrStrAttrMap
 

typedef std::map<std::string, CDMVariable> MetNoFimex::CDM::StrVarMap
 


Constructor & Destructor Documentation

MetNoFimex::CDM::CDM  ) 
 

MetNoFimex::CDM::~CDM  )  [virtual]
 


Member Function Documentation

void MetNoFimex::CDM::addAttribute const std::string varName,
const CDMAttribute attr
throw (CDMException)
 

add an attribute to cdm

Parameters:
varName name of the variablt the attribute belongs to
attr the CDMAttribute
Exceptions:
CDMException if varName doesn't exist, or attr.getName() already exists

void MetNoFimex::CDM::addDimension const CDMDimension dim  )  throw (CDMException)
 

add a dimension to cdm

Parameters:
dim the dimension
Exceptions:
CDMException if dim-name already exists

void MetNoFimex::CDM::addOrReplaceAttribute const std::string varName,
const CDMAttribute attr
throw (CDMException)
 

add or replace an attribute of the cdm

Parameters:
varName name of variable the attribute belongs to
attr the CDMAttribute
Exceptions:
CDMException if vaName doesn't exist

void MetNoFimex::CDM::addVariable const CDMVariable var  )  throw (CDMException)
 

add variable to cdm

Parameters:
var the variable to add
Exceptions:
CDMException if var.varName() already exists

bool MetNoFimex::CDM::checkVariableAttribute const std::string varName,
const std::string attribute,
const boost::regex &  attrValue
const
 

check if a variable contains a attributes with a matching string-value

Parameters:
varName variable
attribute the attribute name
attrValue the regexp the string-value of the attribute will match against

std::vector< std::string > MetNoFimex::CDM::findVariables const std::map< std::string, std::string > &  findAttributes,
const std::vector< std::string > &  findDimensions
const
 

search for variable with attribute-values and dimensions

And AND search for attributes and dimensions.

Parameters:
findAttributes map with (attribute => string-value regExp) pairs
findDimensions vector with dimensions contained in variable
Returns:
copies of the attributes matching the request

std::vector< std::string > MetNoFimex::CDM::findVariables const std::string attrName,
const std::string attrValueRegExp
const
 

search for variable with certain attribute-value

Parameters:
attrName name of the attribute
attrValueRegExp regular expression the 'string'-value needs to match
Returns:
copies of the attributes matching the request

void MetNoFimex::CDM::generateProjectionCoordinates const std::string projectionVariable,
const std::string xDim,
const std::string yDim,
const std::string lonDim,
const std::string latDim
throw (CDMException)
 

generate the projection coordinates (usually named "lat lon")

Parameters:
projectionVariable the variable containing the projection information
xDim the x dimension (the corresponding variable needs to contain data and units)
yDim the y dimension (the corresponding variable needs to contain data and units)
lonDim name of the longitude variable
latDim name of the latitude variable
Exceptions:
CDMException if any information is missing

const CDMAttribute & MetNoFimex::CDM::getAttribute const std::string varName,
const std::string attrName
const throw (CDMException)
 

get an const attribute

Parameters:
varName name of variable
attrName name of attribute

CDMAttribute & MetNoFimex::CDM::getAttribute const std::string varName,
const std::string attrName
throw (CDMException)
 

get an attribute

Parameters:
varName name of variable
attrName name of attribute

std::vector< CDMAttribute > MetNoFimex::CDM::getAttributes const std::string varName  )  const
 

get the attributes of an variable

Parameters:
varName name of variable

const StrStrAttrMap& MetNoFimex::CDM::getAttributes  )  const [inline]
 

get the attributes

Returns:
map of type <variableName <attributeName, attribute>>

const CDMDimension & MetNoFimex::CDM::getDimension const std::string dimName  )  const throw (CDMException)
 

CDMDimension & MetNoFimex::CDM::getDimension const std::string dimName  )  throw (CDMException)
 

get a reference to a dimension

Parameters:
dimName name of the dimension
Exceptions:
CDMException if dimension doesn't exist

const StrDimMap& MetNoFimex::CDM::getDimensions  )  const [inline]
 

get the dimension

double MetNoFimex::CDM::getFillValue const std::string varName  )  const
 

get the fill value of an variable (_FillValue attribute)

Returns:
value of _FillValue attribute, or MIFI_UNDEFINED_F

bool MetNoFimex::CDM::getProjectionAndAxesUnits std::string projectionName,
std::string xAxis,
std::string yAxis,
std::string xAxisUnits,
std::string yAxisUnits
const throw (CDMException)
 

extract the names of the projection-variable and the corresponding projection-axes

Parameters:
projectionName output of the projection variables name
xAxis output of the spatial x axis
yAxis output of the spation y axis
xAxisUnit output of unit for x axis
yAxisUnit output of unit for y axis
Returns:
true if unique result, false (and print warning) if results are not unique
Exceptions:
CDMException if no projection with corresponding axes can be found

const CDMDimension * MetNoFimex::CDM::getUnlimitedDim  )  const
 

retrieve the unlimited dimension

Returns:
unLimDim pointer with the unlimited dimension, the pointer will be deleted with the CDM

const CDMVariable & MetNoFimex::CDM::getVariable const std::string varName  )  const throw (CDMException)
 

get a reference of a variable

this is a constant version of CDMVariable::getVariable}

Parameters:
varName name of the variable
Exceptions:
CDMException if varName doesn't exist

CDMVariable & MetNoFimex::CDM::getVariable const std::string varName  )  throw (CDMException)
 

get a reference of a variable

Parameters:
varName name of the variable
Exceptions:
CDMException if varName doesn't exist

const StrVarMap& MetNoFimex::CDM::getVariables  )  const [inline]
 

get the variables

static const std::string& MetNoFimex::CDM::globalAttributeNS  )  [inline, static]
 

the namespace for global attributes

bool MetNoFimex::CDM::hasUnlimitedDim const CDMVariable var  )  const
 

test if a variable contains the unlimited dim

Returns:
true/false

void MetNoFimex::CDM::removeAttribute const std::string varName,
const std::string attrName
 

remove an attribute from the cdm

Parameters:
varName name of variable the attribute belongs to
attr the CDMAttribute

void MetNoFimex::CDM::removeVariable const std::string variableName  ) 
 

remove a variable and corresponding attributes

Parameters:
variableName the variable to remove

void MetNoFimex::CDM::toXMLStream std::ostream os  )  const
 

print a xml representation to the stream


The documentation for this class was generated from the following files:
Generated on Thu Jun 5 14:58:24 2008 for MI - Fimex by  doxygen 1.4.6