code::RadialSet Class Reference

Inheritance diagram for code::RadialSet:

code::Collection< X > code::SimpleCollection< X > code::DataType List of all members.

Detailed Description

Store a complete polar grid, with no loss in information.

VCP: This object (depending on the data source) usually provides an attribute called "vcp" ( getAttributeValue("vcp") ) which maps to the vcp number. Use NexradVCP to map this number into a set of elevation angles. Note that where a volume product (e.g: ReflecVol) is available, using that volume product is preferable to mucking around with vcps trying to find the relative location of this RadialSet inside the radar volume.

It is a good idea to call setElevation() after constructing this object because the target elevation is a good thing to know.

Typical construction process is:

once
      ref = new RadialSet( radarLoc,
                          Length::Meters( radial.radial_header.range_to_first_gate_ref ) );
      ref->setTypeName( "Reflectivity" );
      ref->setAttributeValue( "vcp", radial.radial_header.vcp );

set up the elevation of the radial set as the target elevation
      NexradVCP nvcp( radial.radial_header.vcp );
      int swp_no = nvcp.getCorrectedSweepNo(radial.radial_header.swp_no);
      Angle elev = nvcp.elevation( swp_no );
      ref->setElevation( elev ); // or (radial.radial_header.vcp, swp_no);

for every radial
      Radial r( Angle::Degrees( currAzimuth ),
              Angle::Degrees( beamWidth ),
              Angle::Degrees(radial.radial_header.getElevation()),
              SpaceTimeRef( firstGate, radialTime ),
              Length::Meters( radial.radial_header.gate_width_ref ),
              Data1D<Length,float>(data) );
      ref->data().push_back( r );
      
See also:
NexradVCP

getAttributeValue

Author:
Lakshman
Version:
Author
lakshman
Date
2009/06/02 20:17:37
RCSfile
code_RadialSet.h,v


Public Types

typedef __normal_iterator<
float > 
iterator
typedef __normal_iterator<
const float > 
const_iterator
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

iterator begin ()
iterator end ()
iterator get_iterator (size_t row, size_t col)
const_iterator begin () const
const_iterator end () const
const_iterator get_iterator (size_t row, size_t col) const
virtual SpaceTimeRef getSpaceTimeRef () const
 reimplemented to return the radar (center) location and the time of the first radial in this set.
 RadialSet ()
 RadialSet (const Location &radar, const Length &dist_to_first_gate)
 Constructs an empty array; Use data().push_back() to fill this in.
 RadialSet (const Location &radar)
 Constructs an empty array; Use data().push_back() to fill this in.
 RadialSet (const Location &radar, const Length &dist_to_first_gate, size_t num_elements)
 Constructs the object of requested size and fills its with the default constructor D() values.
 RadialSet (const Location &radar, size_t num_elements)
 Constructs the object of requested size and fills its with the default constructor D() values.
 RadialSet (const Location &radar, const Length &dist_to_first_gate, SmartPtr< std::vector< Radial > > new_val)
 Constructor with already existing values.
 RadialSet (const Location &radar, SmartPtr< std::vector< Radial > > new_val)
 Constructor with already existing values.
virtual void invoke (Algorithm &alg)
 Use this to invoke an algorithm given only the base type.
void replace (const float &old_value, const float &new_value)
RadialSet clone () const
 Returns a completely separate copy of this data.
virtual short getType () const
 Get enum type of this class.
const LocationgetRadarLocation () const
 Return the location of the radar.
Length getDistanceToFirstGate () const
 Return the distance to the first gate.
Angle getElevation () const
 The elevation of this sweep.
void setDistanceToFirstGate (const code::Length &)
 Set the range to the first gate of this sweep.
void setElevation (const Angle &targetElev)
 Set the target elevation of this sweep.
void setElevation (int vcp, int elevation_no)
 convenience setElevation method that takes the NexradVCP and the corrected elevation number.
Radial getRadial (const Angle &az) const throw ( std::string )
 Return the radial at this azimuth.
code::Speed getNyquistVelocity (const code::Angle &az) const throw (std::string)
 For velocity product, sometimes the nyquist is different for different radials.
code::Speed getNyquistVelocity (int radial_no=0) const
 For velocity product, sometimes the nyquist is different for different radials.
size_t getRadialNum (const Angle &az) const throw ( std::string )
void rotateRadials (const Angle &ang)
 Change the angle of each of the radials (add this quantity) to the radials' azimuth.
bool makeClockwise ()
 Make the radials in this radial set go clockwise i.e.
SpaceTimeRef reference (int i, int j) const
 Gets location (lat/lon) and time information of ith radial and jth bin.
size_t size (size_t i) const
 the number of gates in the ith radial
size_t size () const
size_t size_d (size_t i) const
size_t size_d () const
void set_val (size_t i, size_t j, const float &value)
float get_val (size_t i, size_t j) const
void set_1d (int i, const float *first, const float *last)
 Reassign a row of elements.
void set_1d (int i, const std::vector< float > &v)
 Reassign a row of elements.
void get_1d_bounds (int i, float *&setme_begin, float *&setme_end)
void get_1d_bounds (int i, const float *&setme_begin, const float *&setme_end) const
void fill (const float &val)
virtual double getRawValue (const Location &p, bool throwOnElevationError=false) const throw ( std::string )
 Given a point on this radial set, return the value.
double getRawValue (const Angle &az, const Length &range, bool throwOnElevationError=true) const throw ( std::string )
void makeLogical360 (bool strictly_under_360=false)
 This Radial Set may contain more than 360 degrees of data, which is crippling to algorithms that perform image processing, since they assume that a RadialSet has <= 360 degrees of data.
Angle getCumulativeAngle (bool add_only_one_sector) const
 How much angular space does this radial set cover? A radial set that goes from 50 degrees to 270 covers 220deg, while, if it wraps around and then goes to 52, it covers 362.
Angle getMedianAzimuthalSpacing () const
 The median azimuthal spacing of the radial set.
bool isUniformGrid (float tolerance) const
 Is this a uniform radial set, i.e.
bool isSectorScan (float tolerance=0) const
 Does this radial set cover the entire angular space or only part of it? Specify tolerance to control how close the "full" coverage is.
void normalizeGateNumber ()
 In a RadialSet, we usually want all the radials to be the same size (otherwise, the getNumGates() method will not be current).
void stormMotionAdjust (const Speed &speed, const Angle &direction)
 For velocity product, you can use this to adjust storm motion.
virtual ~RadialSet ()
 This class is meant to be subclassed.
const X & operator[] (size_t i) const
 Return the ith member of the array.
X & operator[] (size_t i)
 Return the ith member of the array.
const std::vector< X > & data () const
 Return the internal vector of Data1D.
std::vector< X > & data ()
 Return the internal vector of Data1D.
value (size_t i) const
 Another way to use the class, instead of using [].
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.
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 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 void getGeometricAzimuthRangeElev (const Location &radarLocation, const Location &p, Angle &az, Length &rn, Angle &elev)
 Given a point on the earth's surface, get the az-ran for it at this elevation.

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

Location radar_location
Length distance_to_first_gate
SmartPtr< AngleelevAngle

Classes

class  __normal_iterator


Member Typedef Documentation

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

key-value pairs that describe the data.

typedef __normal_iterator<const float> code::RadialSet::const_iterator

typedef __normal_iterator<float> code::RadialSet::iterator


Member Enumeration Documentation

enum code::DataType::Type [inherited]

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


Constructor & Destructor Documentation

code::RadialSet::RadialSet (  )  [inline]

code::RadialSet::RadialSet ( const Location radar,
const Length dist_to_first_gate 
) [inline]

Constructs an empty array; Use data().push_back() to fill this in.

code::RadialSet::RadialSet ( const Location radar  )  [inline]

Constructs an empty array; Use data().push_back() to fill this in.

code::RadialSet::RadialSet ( const Location radar,
const Length dist_to_first_gate,
size_t  num_elements 
) [inline]

Constructs the object of requested size and fills its with the default constructor D() values.

code::RadialSet::RadialSet ( const Location radar,
size_t  num_elements 
) [inline]

Constructs the object of requested size and fills its with the default constructor D() values.

code::RadialSet::RadialSet ( const Location radar,
const Length dist_to_first_gate,
SmartPtr< std::vector< Radial > >  new_val 
) [inline]

Constructor with already existing values.

code::RadialSet::RadialSet ( const Location radar,
SmartPtr< std::vector< Radial > >  new_val 
) [inline]

Constructor with already existing values.

virtual code::RadialSet::~RadialSet (  )  [inline, virtual]

This class is meant to be subclassed.


Member Function Documentation

const_iterator code::RadialSet::begin (  )  const [inline]

iterator code::RadialSet::begin (  )  [inline]

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

RadialSet code::RadialSet::clone (  )  const

Returns a completely separate copy of this data.

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.

std::vector< X >& code::SimpleCollection< X >::data (  )  [inline, inherited]

Return the internal vector of Data1D.

const std::vector< X >& code::SimpleCollection< X >::data (  )  const [inline, inherited]

Return the internal vector of Data1D.

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

const_iterator code::RadialSet::end (  )  const [inline]

iterator code::RadialSet::end (  )  [inline]

void code::RadialSet::fill ( const float &  val  )  [inline]

void code::RadialSet::get_1d_bounds ( int  i,
const float *&  setme_begin,
const float *&  setme_end 
) const [inline]

void code::RadialSet::get_1d_bounds ( int  i,
float *&  setme_begin,
float *&  setme_end 
) [inline]

const_iterator code::RadialSet::get_iterator ( size_t  row,
size_t  col 
) const [inline]

iterator code::RadialSet::get_iterator ( size_t  row,
size_t  col 
) [inline]

float code::RadialSet::get_val ( size_t  i,
size_t  j 
) const [inline]

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.

Angle code::RadialSet::getCumulativeAngle ( bool  add_only_one_sector  )  const

How much angular space does this radial set cover? A radial set that goes from 50 degrees to 270 covers 220deg, while, if it wraps around and then goes to 52, it covers 362.

If only_one_sector is true, then the cumulative angle returns MISSING_DATA if the radial set contains more than one sector. Otherwise, the different sectors are accumulated separately.

Length code::RadialSet::getDistanceToFirstGate (  )  const

Return the distance to the first gate.

If the distance not supplied in the constructor, we calculate it. Assumption made: that the distance to the first gate is constant for each radial of this elevation scan. If this is not the case for your data set, please email ngw-disc@doplight.nssl.noaa.gov

Angle code::RadialSet::getElevation (  )  const

The elevation of this sweep.

This will be the target elevation if the setElevation() method was called, otherwise, the elevation angle of the first radial is returned.

If there are no radials in this sweep, the elevation angle is returned as zero.

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.

static void code::RadialSet::getGeometricAzimuthRangeElev ( const Location radarLocation,
const Location p,
Angle az,
Length rn,
Angle elev 
) [static]

Given a point on the earth's surface, get the az-ran for it at this elevation.

WARNING! This computation uses CPoints and is simply trigonometric. If you want to calculate along a beam path, please see

See also:
Location::getAzimuthRangeElev

Angle code::RadialSet::getMedianAzimuthalSpacing (  )  const

The median azimuthal spacing of the radial set.

Useful for radars where the azimuthal spacing slowly ramps up and down when scanning a constant elevation.

Note that this involves on-the-fly computation, so you should save this value if you can.

code::Speed code::RadialSet::getNyquistVelocity ( int  radial_no = 0  )  const

For velocity product, sometimes the nyquist is different for different radials.

Normal behavior is to return the Nyquist velocity of the radial set as a whole.

code::Speed code::RadialSet::getNyquistVelocity ( const code::Angle az  )  const throw (std::string)

For velocity product, sometimes the nyquist is different for different radials.

This function will find the nearest radial and call getNyquistVel(radial_no) on it.

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

const Location& code::RadialSet::getRadarLocation (  )  const [inline]

Return the location of the radar.

Radial code::RadialSet::getRadial ( const Angle az  )  const throw ( std::string )

Return the radial at this azimuth.

The radials are assumed to cover the entire gate width.

Throws a string if the radial corresponding to the azimuth passed in is not available (such as in incomplete scans)

size_t code::RadialSet::getRadialNum ( const Angle az  )  const throw ( std::string )

double code::RadialSet::getRawValue ( const Angle az,
const Length range,
bool  throwOnElevationError = true 
) const throw ( std::string )

virtual double code::RadialSet::getRawValue ( const Location p,
bool  throwOnElevationError = false 
) const throw ( std::string ) [virtual]

Given a point on this radial set, return the value.

Note that we assume that the given Location is within the geometry (the elevation angle) of this RadialSet. To force a check on this constraint, pass in a throwOnError of true. Regardless of this setting, other errors (such as missing radials, out of range, etc.) will throw.

Reimplemented from code::DataType.

virtual SpaceTimeRef code::RadialSet::getSpaceTimeRef (  )  const [virtual]

reimplemented to return the radar (center) location and the time of the first radial in this set.

Reimplemented from code::Collection< X >.

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

Get enum type of this class.

Reimplemented from code::DataType.

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::RadialSet::invoke ( Algorithm alg  )  [inline, virtual]

Use this to invoke an algorithm given only the base type.

Reimplemented from code::Collection< X >.

bool code::RadialSet::isSectorScan ( float  tolerance = 0  )  const

Does this radial set cover the entire angular space or only part of it? Specify tolerance to control how close the "full" coverage is.

For example, if tolerance is 0.1, then a RadialSet that covers only 359.9 degrees will not be treated as a sector scan.

A good value for the tolerance would be 0.5*beamwidth

bool code::RadialSet::isUniformGrid ( float  tolerance  )  const

Is this a uniform radial set, i.e.

do all the radials line up regularly?

This is done by computing the cumulative angle by going through the radials and comparing with the cumulative angle obtained by looking only at the end radials.

Tolerance is how much the two methods can differ and still be considered a regular (uniform) grid.

bool code::RadialSet::makeClockwise (  ) 

Make the radials in this radial set go clockwise i.e.

increasing azimuth angle. Returns whether a change was done. Note that the radials will NOT be reordered; only reversed. The azimuth of the first two radials is considered to determine whether or not this radial set is clockwise.

void code::RadialSet::makeLogical360 ( bool  strictly_under_360 = false  ) 

This Radial Set may contain more than 360 degrees of data, which is crippling to algorithms that perform image processing, since they assume that a RadialSet has <= 360 degrees of data.

This function returns the subset of this RadialSet (as a RadialSet) that contains the latest <= 360 degrees of data. It actually alters the underlying data of the RadialSet. If you wish to retain the purity of the RadialSet, first use the clone() func, and then this func.

Parameters:
strictly_under_360 Because radials have varying beamwidths it is very unlikely that we will be able to reach an exact 360-degrees. Thus, there are two options: to go slightly over 360 (the default) or to limit the selected set of radials to be strictly under 360.

void code::RadialSet::normalizeGateNumber (  ) 

In a RadialSet, we usually want all the radials to be the same size (otherwise, the getNumGates() method will not be current).

Call this method to normalize the RadialSet to be a constant number of gates per radial.

X & code::SimpleCollection< X >::operator[] ( size_t  i  )  [inline, inherited]

Return the ith member of the array.

No bounds check is done.

const X & code::SimpleCollection< X >::operator[] ( size_t  i  )  const [inline, inherited]

Return the ith member of the array.

No bounds check is done.

SpaceTimeRef code::RadialSet::reference ( int  i,
int  j 
) const [inline]

Gets location (lat/lon) and time information of ith radial and jth bin.

void code::RadialSet::replace ( const float &  old_value,
const float &  new_value 
) [inline]

void code::RadialSet::rotateRadials ( const Angle ang  ) 

Change the angle of each of the radials (add this quantity) to the radials' azimuth.

void code::RadialSet::set_1d ( int  i,
const std::vector< float > &  v 
) [inline]

Reassign a row of elements.

void code::RadialSet::set_1d ( int  i,
const float *  first,
const float *  last 
) [inline]

Reassign a row of elements.

void code::RadialSet::set_val ( size_t  i,
size_t  j,
const float &  value 
) [inline]

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.

void code::RadialSet::setDistanceToFirstGate ( const code::Length  ) 

Set the range to the first gate of this sweep.

void code::RadialSet::setElevation ( int  vcp,
int  elevation_no 
)

convenience setElevation method that takes the NexradVCP and the corrected elevation number.

The corrected elevation number can be obtained from the level2 sweep number using NexradVCP.

See also:
NexradVCP for coverage patterns understood.

void code::RadialSet::setElevation ( const Angle targetElev  ) 

Set the target elevation of this sweep.

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

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

Set the TypeName of this DataType.

size_t code::RadialSet::size (  )  const [inline]

size_t code::RadialSet::size ( size_t  i  )  const [inline]

the number of gates in the ith radial

size_t code::RadialSet::size_d (  )  const [inline]

size_t code::RadialSet::size_d ( size_t  i  )  const [inline]

void code::RadialSet::stormMotionAdjust ( const Speed speed,
const Angle direction 
)

For velocity product, you can use this to adjust storm motion.

X code::SimpleCollection< X >::value ( size_t  i  )  const [inline, inherited]

Another way to use the class, instead of using [].


Member Data Documentation

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

Length code::RadialSet::distance_to_first_gate [protected]

SmartPtr< Angle > code::RadialSet::elevAngle [protected]

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

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

Location code::RadialSet::radar_location [protected]

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