code::SparseGrid3D< T > Class Template Reference

Inheritance diagram for code::SparseGrid3D< T >:

code::SparseGrid code::DataType List of all members.

Detailed Description

template<class T>
class code::SparseGrid3D< T >

This is a memory optimization of LatLonHeightGrid when the data are sparse within the grid.

Specifically, if more than 3/4 of the pixels in a grid are missing, this optimization will outperform.

The coordinate system is as follows:

          z or h :  the height dimension starting at bottom
          x or a:   the latitude dimension going north to south 
          y or b:   the longitude dimension going west to east
       
So that (0,0,0) is the bottom-north-west corner

Author:
Lakshman
Version:
Id
code_SparseGrid.h,v 1.19 2011/01/28 17:05:46 lakshman Exp


Public Types

typedef std::map< std::string,
SmartPtr< DataColumn > > 
AttrMap
 key-value pairs that describe the data.
 RadialSet
 LatLonGrid
 LatLonHeightGrid
 CartesianGrid2D
 Grid2D
 DataTable
 WindField
 WindFieldLLGVolume
 ElevationVolume
 ContourData
 Other
enum  Type {
  RadialSet, LatLonGrid, LatLonHeightGrid, CartesianGrid2D,
  Grid2D, DataTable, WindField, WindFieldLLGVolume,
  ElevationVolume, ContourData, Other
}

Public Member Functions

 SparseGrid3D ()
 for STL use only .
 SparseGrid3D (const T &grid, SentinelDouble backgroundValue=Constants::MissingData)
 construct from the regular grid (LatLonHeightGrid, etc.
const std::vector< Pixel > & getPixels () const
SmartPtr< std::vector< Pixel > > getPixelVector ()
float getCompressionRatio () const
short dimx () const
short dimy () const
short dimz () const
virtual double getRawValue (const Location &, bool=false) const
 Gets raw value from data set.
virtual SpaceTimeRef getSpaceTimeRef () const
 Return a SpaceTimeRef that best corresponds to this DataType.
std::string getTypeClassName () const
 returns a string such as RadialSet, LatLonGrid, etc.
void copyDataType (const DataType &dt)
 A convenience function provided for subclasses that implement clone() -- will copy into this data type all the attributes in the type dt.
const std::string & getTypeName () const
 Return the TypeName of this DataType.
virtual short getType () const
 Get enum type of this class.
void setTypeName (const std::string &)
 Set the TypeName of this DataType.
SmartPtr< DataCellgetAttributeValue (const std::string &key) const
 Return a single value associated with an attribute key corresponding to the function's argument.
bool getAttributeValue (const std::string &key, std::string &setme) const
 Assign `setme' with the attribute corresponding to `key'.
bool getAttributeValue (const std::string &key, double &setme) const
 Assign `setme' with the attribute corresponding to `key'.
void setAttributeValue (const std::string &key, const std::string &value, const std::string &unit="dimensionless")
 Set a single-valued attribute that describes this DataType.
void setAttributeValue (const std::string &key, double value, const std::string &unit="dimensionless", const std::string &format="%g")
 Set a single-valued attribute that describes this DataType.
void setAttribute (const std::string &key, SmartPtr< DataColumn > value)
 Set a multiple-valued attribute that describes this DataType.
SmartPtr< DataColumngetAttribute (const std::string &key) const
 Get the attribute value for a particular key.
const AttrMapgetAttributes () const
 Get the entire map of attributes available for this data type.
virtual void invoke (Algorithm &)
 Report an error, and halt execution because this function MUST be overridden in every descendant of DataType.
virtual TimeInterval getExpiryInterval () const
 Return 15 minutes as the length of time for which this DataType is valid.
bool hasQuality () const
const DataTypegetQuality () const
void setQuality (SmartPtr< DataType > dt)
void clearAttributes ()

Static Public Member Functions

static float estimateCompressionRatio (const T &grid, SentinelDouble backgroundValue=Constants::MissingData, int *pixels=0, short *dim_z=0, short *dim_x=0, short *dim_y=0)
 You can use the compression ratio to decide whether it is worthwhile to create a sparse grid for your data.
template<class T2>
static void setDimensions (const T &regularGrid, const T2 &origsize, short &dimh, short &dima, short &dimb)
static SentinelDouble getBackgroundValue (const DataType &data)
 Convenience function to obtain sparse-grid threshold from an attribute of the data.

Static Public Attributes

static const std::string IsTableData
static const std::string Unit
static const std::string ColorMap
static const std::string ExpiryInterval

Protected Member Functions

virtual void deep_copy (const DataType &source)

Protected Attributes

SpaceTimeRef stref

Classes

class  Pixel


Member Typedef Documentation

typedef std::map< std::string, SmartPtr<DataColumn> > code::DataType::AttrMap [inherited]

key-value pairs that describe the data.


Member Enumeration Documentation

enum code::DataType::Type [inherited]

Enumerator:
RadialSet 
LatLonGrid 
LatLonHeightGrid 
CartesianGrid2D 
Grid2D 
DataTable 
WindField 
WindFieldLLGVolume 
ElevationVolume 
ContourData 
Other 


Constructor & Destructor Documentation

template<class T>
code::SparseGrid3D< T >::SparseGrid3D (  )  [inline]

for STL use only .

..

template<class T>
code::SparseGrid3D< T >::SparseGrid3D ( const T &  grid,
SentinelDouble  backgroundValue = Constants::MissingData 
) [inline]

construct from the regular grid (LatLonHeightGrid, etc.

)


Member Function Documentation

void code::DataType::clearAttributes (  )  [inline, inherited]

void code::DataType::copyDataType ( const DataType dt  )  [inherited]

A convenience function provided for subclasses that implement clone() -- will copy into this data type all the attributes in the type dt.

Attributes with the same name will be over-written, other attributes will remain unchanged.

virtual void code::DataType::deep_copy ( const DataType source  )  [inline, protected, virtual, inherited]

template<class T>
short code::SparseGrid3D< T >::dimx (  )  const [inline]

template<class T>
short code::SparseGrid3D< T >::dimy (  )  const [inline]

template<class T>
short code::SparseGrid3D< T >::dimz (  )  const [inline]

template<class T>
static float code::SparseGrid3D< T >::estimateCompressionRatio ( const T &  grid,
SentinelDouble  backgroundValue = Constants::MissingData,
int *  pixels = 0,
short *  dim_z = 0,
short *  dim_x = 0,
short *  dim_y = 0 
) [inline, static]

You can use the compression ratio to decide whether it is worthwhile to create a sparse grid for your data.

The compression ratio ranges from 0 to 1 and is the ratio of the size of the sparse grid to the size of your data. Smaller numbers are better. So, you might want to say that if the compression ratio is less than 0.5 you are willing to save your data as sparse grids. Optionally, you can retreive the sizes dim_x and dim_y of the grid here, as well as the number of non-background pixels.

SmartPtr< DataColumn > code::DataType::getAttribute ( const std::string &  key  )  const [inherited]

Get the attribute value for a particular key.

Parameters:
key attribute key
Returns:
value attribute value in unit-safe manner, or an invalid SmartPtr on error.
See also:
getAttributeValue()

getAttributes() if you don't know the attribute key.

const AttrMap& code::DataType::getAttributes (  )  const [inline, inherited]

Get the entire map of attributes available for this data type.

See also:
getAttribute for a more selective get.

getAttributeValue for a convenient get.

bool code::DataType::getAttributeValue ( const std::string &  key,
double &  setme 
) const [inherited]

Assign `setme' with the attribute corresponding to `key'.

Returns:
true on success; false if no such attribute exists

bool code::DataType::getAttributeValue ( const std::string &  key,
std::string &  setme 
) const [inherited]

Assign `setme' with the attribute corresponding to `key'.

Returns:
true on success; false if no such attribute exists

SmartPtr< DataCell > code::DataType::getAttributeValue ( const std::string &  key  )  const [inherited]

Return a single value associated with an attribute key corresponding to the function's argument.

If no such attribute key exists, then return the NULL SmartPtr. In case multiple values are associated with the key, only the first item is returned.

See also:
getAttribute() to get all values.

static SentinelDouble code::SparseGrid::getBackgroundValue ( const DataType data  )  [inline, static, inherited]

Convenience function to obtain sparse-grid threshold from an attribute of the data.

The SparseGrid class does not use this function -- it uses whatever is passed into the command line. However, users can use this function to decide what to tell SparseGrid.

template<class T>
float code::SparseGrid3D< T >::getCompressionRatio (  )  const [inline]

virtual TimeInterval code::DataType::getExpiryInterval (  )  const [virtual, inherited]

Return 15 minutes as the length of time for which this DataType is valid.

Override this function in the descendant of DataType as appropriate.

Reimplemented in code::DEM.

template<class T>
const std::vector<Pixel>& code::SparseGrid3D< T >::getPixels (  )  const [inline]

template<class T>
SmartPtr< std::vector<Pixel> > code::SparseGrid3D< T >::getPixelVector (  )  [inline]

const DataType& code::DataType::getQuality (  )  const [inline, inherited]

virtual double code::SparseGrid::getRawValue ( const Location ,
bool  = false 
) const [inline, virtual, inherited]

Gets raw value from data set.

Reimplemented from code::DataType.

virtual SpaceTimeRef code::SparseGrid::getSpaceTimeRef (  )  const [inline, virtual, inherited]

Return a SpaceTimeRef that best corresponds to this DataType.

The Time component corresponds to the beginning of the TimeInterval during which this DataType is valid.

Implements code::DataType.

virtual short code::DataType::getType (  )  const [inline, virtual, inherited]

Get enum type of this class.

Reimplemented in code::CartesianGrid2D, code::ContourData, code::DataTable, code::ElevationVolume, code::Grid2D, code::LatLonGrid, code::LatLonHeightGrid, code::PolarGrid, code::RadialSet, code::WindFieldLLGVolume, and code::WindFieldStruct< T >.

std::string code::DataType::getTypeClassName (  )  const [inherited]

returns a string such as RadialSet, LatLonGrid, etc.

See the enum Type for all the possible options. Subclasses need only to over-ride getType()

const std::string& code::DataType::getTypeName (  )  const [inherited]

Return the TypeName of this DataType.

bool code::DataType::hasQuality (  )  const [inline, inherited]

virtual void code::DataType::invoke ( Algorithm  )  [virtual, inherited]

Report an error, and halt execution because this function MUST be overridden in every descendant of DataType.

The descendant's implementation should pass this or *this, as is appropriate, into the argument's process() member.

Reimplemented in code::BasicIcon, code::AlgTrackStruct, code::LtgoIconStruct, code::MesoIconStruct, code::BwerIconStruct, code::CartesianGrid2D, code::CartesianGrid3D, code::SingleContourData, code::ContourData, code::DataTable, code::DEM, code::Datum< X >, code::Collection< X >, code::ElevationVolume, code::FieldArrowStruct, code::Grid2D, code::IconData, code::LatLonGrid, code::LatLonHeightGrid, code::PolarGrid, code::Radial, code::RadialSet, code::WindFieldStruct< T >, code::Collection< code::Radial >, and code::Collection< code::SingleContourData >.

void code::DataType::setAttribute ( const std::string &  key,
SmartPtr< DataColumn value 
) [inherited]

Set a multiple-valued attribute that describes this DataType.

If value is 0 (i.e. invalid), this attribute will be removed from the map.

void code::DataType::setAttributeValue ( const std::string &  key,
double  value,
const std::string &  unit = "dimensionless",
const std::string &  format = "%g" 
) [inherited]

Set a single-valued attribute that describes this DataType.

This is a convenience function that allows you to set a dimensionless number as the value of an attribute.

If the attribute key does not already exist, then it will be constructed.

See also:
setAttribute() to set multiple values for an attribute.

void code::DataType::setAttributeValue ( const std::string &  key,
const std::string &  value,
const std::string &  unit = "dimensionless" 
) [inherited]

Set a single-valued attribute that describes this DataType.

This is a convenience function that allows you to set a text string as the value of an attribute.

If the attribute key does not already exist, then it will be constructed. The empty string may NOT be used as a value for the attribute; this function will return immediately if the value is the empty string.

See also:
setAttribute() to set multiple values for an attribute.

template<class T>
template<class T2>
static void code::SparseGrid3D< T >::setDimensions ( const T &  regularGrid,
const T2 &  origsize,
short &  dimh,
short &  dima,
short &  dimb 
) [inline, static]

void code::DataType::setQuality ( SmartPtr< DataType dt  )  [inline, inherited]

void code::DataType::setTypeName ( const std::string &   )  [inherited]

Set the TypeName of this DataType.


Member Data Documentation

const std::string code::DataType::ColorMap [static, inherited]

const std::string code::DataType::ExpiryInterval [static, inherited]

const std::string code::DataType::IsTableData [static, inherited]

SpaceTimeRef code::SparseGrid::stref [protected, inherited]

const std::string code::DataType::Unit [static, inherited]


Generated on Fri May 4 13:40:11 2012 for WDSS-IIw2 by  doxygen 1.4.7