WXP C++ Library Version 6.74.9
|
This class defines a grid. More...
#include "../include/Grid.h"
Public Member Functions | |
Grid () | |
Grid (int rnx, int rny) | |
Grid (const Grid &grid) | |
~Grid () | |
int | init () |
int | copy (const Grid &grid) |
int | copyInfo (const Grid &grid) |
int | copyData (const Grid &grid) |
Grid | operator= (const Grid &grid) |
int | setType (int val) |
int | getType () |
int | setSource (int val) |
int | getSource () |
int | setVersion (int val) |
int | getVersion () |
int | setDatim (const char *str) |
int | setDatim (String &str) |
const char * | getDatim () |
int | setInfo (const char *str) |
const char * | getInfo () |
int | setDate (Date &d) |
int | setDate (DateVal &dv) |
Date | getDate () |
Date | getDate (Date &rdate) |
Date | getInitDate () |
DateVal | getDateVal () |
int | setSize (int x, int y) |
int | getSize (int &x, int &y) |
int | getNx () |
int | getNy () |
float | getDx () |
float | getDy () |
int | setGridType (int type) |
int | getGridType () |
int | setDomain (DomainVal &dv) |
int | setDomain (Domain &dom) |
DomainVal | getDomainVal () |
Domain | getDomain () |
int | getDomain (Domain &dom) |
int | getProj () |
int | tran (EarthPoint ept, Point &pt) |
int | tran (Point pt, EarthPoint &ept) |
int | tran (GridPoint gpt, Point &pt) |
int | tran (Point pt, GridPoint &gpt) |
int | tran (EarthPoint ept, GridPoint &gpt) |
int | tran (GridPoint gpt, EarthPoint &ept) |
int | tran (Domain &dom, Point pt1, Point &pt2) |
int | tran (Point pt1, Domain &dom, Point &pt2) |
float | adjustDir (float dir, Point &pt) |
float | unadjustDir (float dir, Point &pt) |
int | setModel (int val) |
int | getModel () |
int | setGenName (const char *str) |
const char * | getGenName () |
int | setVar (VarSpec v) |
int | getVar (VarSpec &v) |
VarSpec | getVarSpec () |
int | setLevel (const char *str) |
int | setLevel (Level &l) |
int | getLevel (Level &l) |
Level | getLevel () |
int | getLevelType () |
int | setForeTime (const char *str) |
int | setForeTime (ForeTime &t) |
int | getForeTime (ForeTime &t) |
ForeTime | getForeTime () |
float | getForeHours () |
int | getForeSeconds () |
int | setVar (const char *str) |
int | setVar (Variable &v) |
const char * | getUnits () |
int | setUnits (const char *units) |
Variable | getVar () |
GridSpec | getSpec () |
int | getSpec (GridSpec &spec) |
int | allocData () |
int | allocLocate () |
int | setData (float *array, int order=0) |
int | setData (FloatArray &array, int order=0) |
int | setValue (int x, int y, float val) |
int | setValue1 (int x, int y, float val) |
float | getValue (int x, int y) |
float | getValue1 (int x, int y) |
float | getValue (GridPoint gpt) |
float | getValue (EarthPoint ept) |
float | getValue (Point pt) |
bool | isLocate () |
bool | isData () |
bool | isValue () |
int | setLocate (int x, int y, Point &pt) |
int | getLocate (int x, int y, Point &pt) |
Point | getLocate (int x, int y) |
int | getValid () |
float | getAverage () |
int | getRange (float &min, float &max) |
int | getRange (Range &range) |
int | scale (float scale) |
int | offset (float offset) |
int | print () |
int | printInfo () |
int | printStats () |
int | printData () |
Static Public Member Functions | |
static int | copyInfo (Grid &grid1, const Grid &grid2) |
static int | copyData (Grid &grid1, const Grid &grid2) |
static int | copy (Grid &grid1, const Grid &grid2) |
Static Public Attributes | |
static const int | Y = 1 |
static const int | INV = 2 |
This class defines a grid.
Grid::Grid | ( | int | rnx, |
int | rny | ||
) |
Constructor for Grid Initializes the grid parameters.
References allocData(), init(), and setSize().
Grid::Grid | ( | const Grid & | grid | ) |
Copy constructor for the grid class
grid | Grid class to copy from |
Grid::~Grid | ( | ) |
Destructor for Grid Deletes allocated data for grid (if needed).
float Grid::adjustDir | ( | float | dir, |
Point & | pt | ||
) |
Adjusts NS/EW direction based on location in grid to grid direction (up=0)
pt | Input point on grid projection plane |
dir | Input direction |
References WXP::Domain::adjustDir().
int Grid::allocData | ( | ) |
Allocates the gridpoints for the grid
References WXP::Const::MISS.
Referenced by WXP::GridMath::abs(), WXP::GridMath::add(), WXP::GridMath::cutoff(), WXP::GridMath::diff(), WXP::GridMath::div(), WXP::UpaXSectCont::draw(), WXP::UpaXSectPlot::draw(), WXP::GridMath::exp(), WXP::RadMask::getWinter(), Grid(), WXP::GridMath::interp(), WXP::GridMath::inv(), WXP::GridMath::locatePoint(), WXP::GridMath::log(), WXP::GridMath::log10(), WXP::GridMath::max(), WXP::GridMath::min(), WXP::GridMath::mod(), WXP::GridMath::mult(), WXP::GridMath::pow(), WXP::GribFile::readBDB(), WXP::GribFile::readDS(), WXP::GridMath::remap(), WXP::GridMath::revalue(), WXP::GridPiece::set(), setData(), setData(), and WXP::GridMath::sqrt().
int Grid::allocLocate | ( | ) |
Allocates the location points for the grid
Referenced by WXP::UpaXSectCont::draw(), WXP::UpaXSectPlot::draw(), and WXP::ContPlot::drawFill().
float Grid::getAverage | ( | ) |
DateVal Grid::getDateVal | ( | ) |
Get the date from the grid
References WXP::Date::get().
Referenced by WXP::GribFile::makeDatim().
const char * Grid::getDatim | ( | ) |
Gets the date/time string
Referenced by WXP::ContPlot::drawLabels(), and WXP::VectPlot::drawLabels().
Domain Grid::getDomain | ( | ) |
Gets the domain of the grid
Referenced by WXP::GridMath::adjustUV(), WXP::VectPlot::draw(), WXP::ContPlot::drawValues(), WXP::GridCont::getDomain(), WXP::GridPlot::getDomain(), WXP::GridVect::getDomain(), and WXP::ImagePlot::getDomain().
int Grid::getDomain | ( | Domain & | dom | ) |
Gets the domain of the grid
dom | The Domain class to put parameters |
DomainVal Grid::getDomainVal | ( | ) |
Gets the domain of the grid
References WXP::Domain::get().
Referenced by WXP::GridMath::isDomainEqual(), WXP::GridMath::isDomainEqual(), WXP::GridMath::isProjEqual(), WXP::GridMath::isProjEqual(), and WXP::GribFile::readBDB().
float Grid::getDx | ( | ) |
Gets the grid domain dx value
References WXP::Domain::getDx().
Referenced by WXP::VectPlot::draw(), and WXP::VectPlot::drawStreamline().
float Grid::getDy | ( | ) |
float Grid::getForeHours | ( | ) |
Gets the forecast time of the grid
t | Input forecast time class |
Referenced by WXP::ContPlot::drawLabels().
int Grid::getForeSeconds | ( | ) |
Gets the forecast time of the grid
t | Input forecast time class |
Referenced by WXP::VectPlot::drawLabels().
ForeTime Grid::getForeTime | ( | ) |
Gets the forecast time of the grid
int Grid::getForeTime | ( | ForeTime & | t | ) |
Gets the forecast time of the grid
t | Input forecast time class |
Referenced by WXP::VectPlot::drawLabels(), WXP::GribFile::makeDatim(), and WXP::GribFile::makeInfo().
const char * Grid::getInfo | ( | ) |
Gets the content/information string
Referenced by WXP::ContPlot::drawLabels().
int Grid::getLevel | ( | Level & | l | ) |
Gets the vertical level of the grid
l | Input Level class |
Referenced by WXP::VectPlot::drawLabels(), and WXP::GribFile::makeInfo().
int Grid::getLevelType | ( | ) |
Get the vertical level type
int Grid::getNx | ( | ) |
Gets the number of gridpoints in X
Referenced by WXP::GridMath::abs(), WXP::GridPiece::add(), WXP::GridMath::add(), WXP::GridMath::add(), WXP::GridMath::add(), WXP::GridMath::adjustUV(), WXP::GridMath::cutoff(), WXP::GridMath::diff(), WXP::GridMath::diff(), WXP::GridMath::div(), WXP::VectPlot::draw(), WXP::ContPlot::drawFill(), WXP::ContPlot::drawLine(), WXP::ContPlot::drawLineLabels(), WXP::ContPlot::drawMaxMin(), WXP::VectPlot::drawStreamline(), WXP::ContPlot::drawValues(), WXP::GridMath::exp(), WXP::RadMask::getWinter(), WXP::GridMath::interp(), WXP::GridMath::inv(), WXP::GridMath::locatePoint(), WXP::GridMath::log(), WXP::GridMath::log10(), WXP::GridMath::max(), WXP::GridMath::maxSpd(), WXP::GridMath::min(), WXP::GridMath::mod(), WXP::GridMath::mult(), WXP::GridMath::offset(), WXP::GridMath::pow(), WXP::GribFile::readDS(), WXP::GridMath::remap(), WXP::GridMath::resetMiss(), WXP::GridMath::revalue(), WXP::GridMath::scale(), WXP::GridMath::sqrt(), and WXP::GridMath::units().
int Grid::getNy | ( | ) |
Gets the number of gridpoints in Y
Referenced by WXP::GridMath::abs(), WXP::GridPiece::add(), WXP::GridMath::add(), WXP::GridMath::add(), WXP::GridMath::add(), WXP::GridMath::adjustUV(), WXP::GridMath::cutoff(), WXP::GridMath::diff(), WXP::GridMath::diff(), WXP::GridMath::div(), WXP::VectPlot::draw(), WXP::ContPlot::drawFill(), WXP::ContPlot::drawLine(), WXP::ContPlot::drawLineLabels(), WXP::ContPlot::drawMaxMin(), WXP::VectPlot::drawStreamline(), WXP::ContPlot::drawValues(), WXP::GridMath::exp(), WXP::RadMask::getWinter(), WXP::GridMath::interp(), WXP::GridMath::inv(), WXP::GridMath::locatePoint(), WXP::GridMath::log(), WXP::GridMath::log10(), WXP::GridMath::max(), WXP::GridMath::maxSpd(), WXP::GridMath::min(), WXP::GridMath::mod(), WXP::GridMath::mult(), WXP::GridMath::offset(), WXP::GridMath::pow(), WXP::GribFile::readDS(), WXP::GridMath::remap(), WXP::GridMath::resetMiss(), WXP::GridMath::revalue(), WXP::GridMath::scale(), WXP::GridMath::sqrt(), and WXP::GridMath::units().
int Grid::getProj | ( | ) |
int Grid::getRange | ( | float & | min, |
float & | max | ||
) |
Gets the max and min values from the grid
min | Minimum value of grid |
max | Maximum value of grid |
References WXP::Const::MISS.
Referenced by WXP::ImagePlot::draw(), WXP::RadPlot::draw(), WXP::ContPlot::drawFill(), WXP::ContPlot::drawLabels(), WXP::ContPlot::drawLine(), and WXP::ContPlot::drawValues().
int Grid::getSize | ( | int & | x, |
int & | y | ||
) |
Gets the size of the grid
x | The number of gridpoints in X |
y | The number of gridpoints in Y |
int Grid::getSource | ( | ) |
GridSpec Grid::getSpec | ( | ) |
Outputs grid specifications to GridSpec class
References WXP::GridSpec::set().
Referenced by WXP::RadMask::getGrids().
int Grid::getSpec | ( | GridSpec & | gs | ) |
Outputs grid specifications to GridSpec class
[out] | gs | Output GridSpec class |
References WXP::GridSpec::set().
int Grid::getType | ( | ) |
Get the grid type
int Grid::getValid | ( | ) |
Returns the number of valid points in the grid
References WXP::Const::MISS.
float Grid::getValue | ( | EarthPoint | ept | ) |
Gets a value from the grid
ept | Earthpoint class specifying location (lat,lon) |
References getValue(), and WXP::Domain::tran().
float Grid::getValue | ( | GridPoint | gpt | ) |
Gets a value from the grid
gpt | Gridpoint class specifying location |
References WXP::Const::MISS.
float Grid::getValue | ( | int | x, |
int | y | ||
) |
Gets a value from the grid
x | X location in grid |
y | Y location in grid |
References WXP::Const::MISS.
Referenced by WXP::GridMath::abs(), WXP::GridPiece::add(), WXP::GridMath::add(), WXP::GridMath::add(), WXP::GridMath::adjustUV(), WXP::NidsImage::applyMask(), WXP::GridCont::callback(), WXP::GridVect::callback(), WXP::GridMath::cutoff(), WXP::GridMath::diff(), WXP::GridMath::diff(), WXP::GridMath::div(), WXP::VectPlot::draw(), WXP::ContPlot::drawMaxMin(), WXP::VectPlot::drawStreamline(), WXP::ContPlot::drawValues(), WXP::GridMath::exp(), WXP::RadMask::getR150(), WXP::RadMask::getR150(), WXP::RadMask::getRSfc(), WXP::RadMask::getRSfc(), WXP::RadMask::getSiteFilter(), WXP::RadMask::getT0(), WXP::RadMask::getT0(), WXP::RadMask::getT150(), WXP::RadMask::getT150(), WXP::RadMask::getT60(), WXP::RadMask::getT60(), WXP::RadMask::getTSfc(), WXP::RadMask::getTSfc(), getValue(), getValue(), WXP::RadMask::getWinterFlag(), WXP::RadMask::getWinterFlag(), WXP::GridMath::interp(), WXP::GridMath::inv(), WXP::GridMath::log(), WXP::GridMath::log10(), WXP::ImageMath::maskGreater(), WXP::ImageMath::maskLesser(), WXP::GridMath::maxSpd(), WXP::GridMath::mod(), WXP::GridMath::mult(), WXP::GridMath::offset(), WXP::GridMath::pow(), WXP::GribFile::readBDB(), WXP::GribFile::readDS(), WXP::GridMath::remap(), WXP::GridMath::resetMiss(), WXP::GridMath::revalue(), WXP::GridMath::scale(), WXP::GridMath::sqrt(), and WXP::GridMath::units().
float Grid::getValue | ( | Point | pt | ) |
Gets a value from the grid
pt | Point class specifying projection location |
References getValue(), and WXP::Domain::tran().
Variable Grid::getVar | ( | ) |
Gets the variable parameters
int Grid::getVersion | ( | ) |
Gets the version number
int Grid::init | ( | ) |
Initializes the data in the Grid class
References WXP::Date::init(), WXP::Domain::init(), and WXP::Const::MISS.
Referenced by WXP::GridMath::abs(), WXP::GridMath::diff(), WXP::GridMath::div(), WXP::GridMath::exp(), WXP::GribFile::getHeader(), Grid(), Grid(), WXP::GridMath::inv(), WXP::GridMath::log(), WXP::GridMath::log10(), WXP::GridMath::max(), WXP::GridMath::min(), WXP::GridMath::mod(), WXP::GridMath::mult(), WXP::GridMath::pow(), WXP::GribFile::read(), and WXP::GridMath::sqrt().
int Grid::offset | ( | float | offset | ) |
Offsets the values in a grid
offset | Offsets factor to apply |
References WXP::Const::MISS, and offset().
Referenced by offset().
Assignment operator. Used to overload copying
grid | String class to copy from |
int Grid::print | ( | ) |
Prints class information to standard output
References WXP::String::get(), and WXP::Domain::print().
Referenced by WXP::GridCont::draw(), WXP::GridVect::draw(), WXP::RcmPlot::draw(), WXP::UpaXSectPlot::draw(), and WXP::RadMask::print().
int Grid::printInfo | ( | ) |
Prints basic grid information to standard output
References WXP::String::get().
int Grid::scale | ( | float | scale | ) |
Scales the values in a grid
scale | Scale factor to apply |
References WXP::Const::MISS, and scale().
Referenced by scale().
int Grid::setData | ( | float * | array, |
int | order = 0 |
||
) |
Sets grid point array from float array
array | input array of grid values (flattened) |
order | the order of incoming array, flip if needed |
References allocData().
int Grid::setData | ( | FloatArray & | array, |
int | order = 0 |
||
) |
Sets grid point array from FloatArray
array | input array of grid values (flattened) |
order | the order of incoming array, flip if needed |
References allocData().
int Grid::setDate | ( | Date & | d | ) |
int Grid::setDate | ( | DateVal & | dv | ) |
int Grid::setDatim | ( | const char * | str | ) |
Sets the date/time string
str | Date/time string |
References WXP::StrLib::copy().
Referenced by WXP::RcmPlot::draw(), and WXP::GribFile::makeDatim().
int Grid::setDatim | ( | String & | str | ) |
Sets the date/time string
str | Date/time string |
References WXP::StrLib::copy(), and WXP::String::get().
int Grid::setDomain | ( | DomainVal & | dv | ) |
Sets the domain of the grid.
dv | DomainVal struct containing domain parameters |
References WXP::DomainVal::nx, WXP::DomainVal::ny, and WXP::Domain::set().
Referenced by WXP::GribFile::getHeader(), WXP::GribFile::read(), WXP::GridMath::remap(), and WXP::GridPiece::set().
int Grid::setForeTime | ( | const char * | str | ) |
Sets the forecast time of the grid
t | Input forecast time class |
References WXP::VarSpec::set(), and WXP::ForeTime::set().
Referenced by WXP::GribFile::setPDB().
int Grid::setForeTime | ( | ForeTime & | t | ) |
Sets the forecast time of the grid
t | Input forecast time class |
References WXP::VarSpec::set().
int Grid::setGenName | ( | const char * | str | ) |
Sets the model generation name
str | Name |
References WXP::StrLib::copy().
Referenced by WXP::GribFile::setPDB().
int Grid::setInfo | ( | const char * | str | ) |
Sets the grid content/information string
str | The string use for information |
References WXP::StrLib::copy().
Referenced by WXP::GridMath::abs(), WXP::GridMath::add(), WXP::GridMath::diff(), WXP::GridMath::div(), WXP::GridPlot::draw(), WXP::MosPlot::draw(), WXP::SfcPlot::draw(), WXP::UpaPlot::draw(), WXP::GridMath::exp(), WXP::RadMask::getWinter(), WXP::GridMath::inv(), WXP::GridMath::locatePoint(), WXP::GridMath::log(), WXP::GridMath::log10(), WXP::GribFile::makeInfo(), WXP::GridMath::max(), WXP::GridMath::min(), WXP::GridMath::mod(), WXP::GridMath::mult(), WXP::GridMath::pow(), and WXP::GridMath::sqrt().
int Grid::setLevel | ( | const char * | str | ) |
Sets the vertical level of the grid
l | Input Level class |
References WXP::VarSpec::set(), and WXP::Level::set().
Referenced by WXP::GribFile::setPDB().
int Grid::setLevel | ( | Level & | l | ) |
int Grid::setLocate | ( | int | x, |
int | y, | ||
Point & | pt | ||
) |
Sets a location in the grid
x | X location in grid |
y | Y location in grid |
pt | Location of gridpoint on projection |
References WXP::Point::x, and WXP::Point::y.
Referenced by WXP::UpaXSectCont::draw(), WXP::UpaXSectPlot::draw(), and WXP::ContPlot::drawFill().
int Grid::setSize | ( | int | x, |
int | y | ||
) |
Sets the grid size
x | The number of gridpoints in X |
y | The number of gridpoints in Y |
References WXP::Domain::set().
Referenced by WXP::UpaXSectCont::draw(), WXP::UpaXSectPlot::draw(), and Grid().
int Grid::setSource | ( | int | val | ) |
int Grid::setType | ( | int | val | ) |
Set the grid type
val | Type of grid |
int Grid::setValue | ( | int | x, |
int | y, | ||
float | val | ||
) |
Sets a value in the grid
x | X location in grid |
y | Y location in grid |
val | Value to put into grid |
Referenced by WXP::GridMath::abs(), WXP::GridPiece::add(), WXP::GridMath::add(), WXP::GridMath::add(), WXP::GridMath::add(), WXP::GridMath::adjustUV(), WXP::GridMath::cutoff(), WXP::GridMath::diff(), WXP::GridMath::diff(), WXP::GridMath::div(), WXP::UpaXSectCont::draw(), WXP::UpaXSectPlot::draw(), WXP::GridMath::exp(), WXP::RadMask::getWinter(), WXP::GridMath::interp(), WXP::GridMath::inv(), WXP::GridMath::locatePoint(), WXP::GridMath::log(), WXP::GridMath::log10(), WXP::GridMath::max(), WXP::GridMath::min(), WXP::GridMath::mod(), WXP::GridMath::mult(), WXP::GridMath::offset(), WXP::GridMath::pow(), WXP::GribFile::readBDB(), WXP::GribFile::readDS(), WXP::GridMath::remap(), WXP::GridMath::resetMiss(), WXP::GridMath::revalue(), WXP::GridMath::scale(), WXP::GridMath::sqrt(), and WXP::GridMath::units().
int Grid::setVar | ( | const char * | str | ) |
Sets the variable parameters
v | Input variable class |
References WXP::Variable::print(), WXP::Variable::set(), and WXP::VarSpec::set().
int Grid::setVar | ( | Variable & | v | ) |
int Grid::setVersion | ( | int | val | ) |
Sets the version of the data
val | The version number |
Referenced by WXP::GribFile::setPDB().
Translates coordinates from another domain to the domain of the grid
dom | Secondary domain |
pt1 | Input point on secondary projection plane |
pt2 | Output point on grid projection plane |
References WXP::Domain::translate().
int Grid::tran | ( | EarthPoint | ept, |
GridPoint & | gpt | ||
) |
Translates coordinates given the domain of the grid
ept | Input earth point |
gpt | Output grid point |
References WXP::Domain::tran().
int Grid::tran | ( | EarthPoint | ept, |
Point & | pt | ||
) |
Translates coordinates given the domain of the grid
[in] | ept | Input earth point |
[out] | pt | Output point on projection plane |
References WXP::Domain::tran().
Referenced by WXP::NidsImage::applyMask(), WXP::GridCont::callback(), WXP::GridVect::callback(), WXP::VectPlot::draw(), WXP::ContPlot::drawFill(), WXP::ContPlot::drawMaxMin(), WXP::VectPlot::drawStreamline(), WXP::ContPlot::drawValues(), WXP::GridMath::locatePoint(), WXP::GridMath::remap(), and WXP::GridBox::set().
int Grid::tran | ( | GridPoint | gpt, |
EarthPoint & | ept | ||
) |
Translates coordinates given the domain of the grid
gpt | Input grid point |
ept | Output earth point |
References WXP::Domain::tran().
Translates coordinates given the domain of the grid
gpt | Input grid point |
pt | Output point on projection plane |
References WXP::Domain::tran().
int Grid::tran | ( | Point | pt, |
EarthPoint & | ept | ||
) |
Translates coordinates given the domain of the grid
[in] | pt | Input point on projection plane |
[out] | ept | Output earth point |
References WXP::Domain::tran().
Translates coordinates given the domain of the grid
pt | Input point on projection plane |
gpt | Output grid point |
References WXP::Domain::tran().
Translates coordinates from the domain of the grid to another domain
pt1 | Input point on grid projection plane |
dom | Secondary domain |
pt2 | Output point on secondary projection plane |
References WXP::Domain::translate().
float Grid::unadjustDir | ( | float | dir, |
Point & | pt | ||
) |
Adjusts grid direction based on location in grid to NS/EW direction (N=0)
pt | Input point on grid projection plane |
dir | Input direction |
References WXP::Domain::unadjustDir().
|
static |
Invert a grid that is y fastest
|
static |
Grid starts at bottom and goes up