WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
WXP::Grid Class Reference

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

Detailed Description

This class defines a grid.

Author
Dan Vietor

Constructor & Destructor Documentation

◆ Grid() [1/3]

Grid::Grid ( )

Constructor for Grid Initializes the grid parameters.

References init().

Referenced by copy(), copyData(), copyInfo(), Grid(), and operator=().

◆ Grid() [2/3]

Grid::Grid ( int rnx,
int rny )

Constructor for Grid Initializes the grid parameters.

Parameters
[in]rnxSize of grid in x
[in]rnySize of grid in y

References allocData(), init(), and setSize().

◆ Grid() [3/3]

Grid::Grid ( const Grid & grid)

Copy constructor for the grid class

Parameters
[in]gridGrid class to copy from

References copy(), and Grid().

◆ ~Grid()

Grid::~Grid ( )

Destructor for Grid Deletes allocated data for grid (if needed).

Member Function Documentation

◆ adjustDir()

float Grid::adjustDir ( float dir,
Point & pt )

Adjusts NS/EW direction based on location in grid to grid direction (up=0)

Parameters
ptInput point on grid projection plane
dirInput direction
Returns
Adjusted direction

◆ allocData()

◆ allocLocate()

int Grid::allocLocate ( )

Allocates the location points for the grid

Referenced by WXP::UpaXSectCont::draw(), WXP::UpaXSectPlot::draw(), and WXP::ContPlot::drawFill().

◆ copy()

int Grid::copy ( const Grid & grid)

Copies info,data from one Grid to another

Parameters
[in]gridGrid to copy from

References copyData(), copyInfo(), and Grid().

Referenced by Grid(), and operator=().

◆ copyData()

int Grid::copyData ( const Grid & grid)

Copies gridpoint data from one Grid to another

Parameters
[in]gridGrid to copy from

References copyData(), and Grid().

Referenced by copy(), and copyData().

◆ copyInfo()

◆ getAverage()

float Grid::getAverage ( )

Gets the average value from the grid

Returns
Average

References WXP::Const::MISS.

◆ getDateVal()

DateVal Grid::getDateVal ( )

Get the date from the grid

Returns
Date values

Referenced by WXP::GribFile::makeDatim().

◆ getDatim()

const char * Grid::getDatim ( )

Gets the date/time string

Returns
The date/time string

Referenced by WXP::ContPlot::drawLabels(), and WXP::VectPlot::drawLabels().

◆ getDomain() [1/2]

Domain Grid::getDomain ( )

Gets the domain of the grid

Returns
Domain object containing domain parameters

Referenced by WXP::GridMath::adjustUV(), WXP::VectPlot::draw(), WXP::ContPlot::drawValues(), WXP::GridVect::getDomain(), and WXP::ImagePlot::getDomain().

◆ getDomain() [2/2]

int Grid::getDomain ( Domain & dom)

Gets the domain of the grid

Return values
domThe Domain class to put parameters

◆ getDomainVal()

DomainVal Grid::getDomainVal ( )

Gets the domain of the grid

Returns
DomainVal struct containing domain parameters

Referenced by WXP::GridMath::isDomainEqual(), WXP::GridMath::isDomainEqual(), WXP::GridMath::isProjEqual(), WXP::GridMath::isProjEqual(), and WXP::GribFile::readBDB().

◆ getDx()

float Grid::getDx ( )

Gets the grid domain dx value

Returns
Dx value

Referenced by WXP::VectPlot::draw(), and WXP::VectPlot::drawStreamline().

◆ getDy()

float Grid::getDy ( )

Gets the grid domain dx value

Returns
Dx value

◆ getForeHours()

float Grid::getForeHours ( )

Gets the forecast time of the grid

Return values
tInput forecast time class

Referenced by WXP::ContPlot::drawLabels().

◆ getForeSeconds()

int Grid::getForeSeconds ( )

Gets the forecast time of the grid

Return values
tInput forecast time class

Referenced by WXP::VectPlot::drawLabels().

◆ getForeTime() [1/2]

ForeTime Grid::getForeTime ( )

Gets the forecast time of the grid

Returns
Output forecast time class

References WXP::ForeTime::getFore().

◆ getForeTime() [2/2]

int Grid::getForeTime ( ForeTime & t)

Gets the forecast time of the grid

Return values
tInput forecast time class

References WXP::ForeTime::getFore().

Referenced by WXP::VectPlot::drawLabels(), WXP::GribFile::makeDatim(), and WXP::GribFile::makeInfo().

◆ getInfo()

const char * Grid::getInfo ( )

Gets the content/information string

Returns
The information string

Referenced by WXP::ContPlot::drawLabels().

◆ getLevel() [1/2]

Level Grid::getLevel ( )

Gets the vertical level of the grid

Returns
Output Level class

◆ getLevel() [2/2]

int Grid::getLevel ( Level & l)

Gets the vertical level of the grid

Return values
lInput Level class

Referenced by WXP::VectPlot::drawLabels(), and WXP::GribFile::makeInfo().

◆ getLevelType()

int Grid::getLevelType ( )

Get the vertical level type

Returns
level type

◆ getNx()

◆ getNy()

◆ getProj()

int Grid::getProj ( )

Gets the grid domain projection ID

Returns
Numeric projection ID

References WXP::Domain::getProj().

◆ getRange()

int Grid::getRange ( float & min,
float & max )

Gets the max and min values from the grid

Return values
minMinimum value of grid
maxMaximum 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().

◆ getSize()

int Grid::getSize ( int & x,
int & y )

Gets the size of the grid

Return values
xThe number of gridpoints in X
yThe number of gridpoints in Y

◆ getSource()

int Grid::getSource ( )

Gets the source of the data

Returns
Source of data

Referenced by WXP::GribFile::setPDB().

◆ getSpec() [1/2]

GridSpec Grid::getSpec ( )

Outputs grid specifications to GridSpec class

Returns
Output GridSpec class

References WXP::GridSpec::set().

Referenced by WXP::RadMask::getGrids().

◆ getSpec() [2/2]

int Grid::getSpec ( GridSpec & gs)

Outputs grid specifications to GridSpec class

Parameters
[out]gsOutput GridSpec class

References WXP::GridSpec::set().

◆ getType()

int Grid::getType ( )

Get the grid type

Returns
grid type

◆ getValid()

int Grid::getValid ( )

Returns the number of valid points in the grid

Returns
Number of valid points

References WXP::Const::MISS.

◆ getValue() [1/4]

float Grid::getValue ( EarthPoint ept)

Gets a value from the grid

Parameters
eptEarthpoint class specifying location (lat,lon)
Returns
Value from grid or MISS

References getValue().

◆ getValue() [2/4]

float Grid::getValue ( GridPoint gpt)

Gets a value from the grid

Parameters
gptGridpoint class specifying location
Returns
Value from grid or MISS

References WXP::Const::MISS.

◆ getValue() [3/4]

◆ getValue() [4/4]

float Grid::getValue ( Point pt)

Gets a value from the grid

Parameters
ptPoint class specifying projection location
Returns
Value from grid or MISS

References getValue().

◆ getVar()

Variable Grid::getVar ( )

Gets the variable parameters

Returns
Output variable class

◆ getVersion()

int Grid::getVersion ( )

Gets the version number

Returns
The version number

◆ init()

◆ offset()

int Grid::offset ( float offset)

Offsets the values in a grid

Parameters
offsetOffsets factor to apply

References WXP::Const::MISS, and offset().

Referenced by offset().

◆ operator=()

Grid Grid::operator= ( const Grid & grid)

Assignment operator. Used to overload copying

Parameters
[in]gridString class to copy from
Returns
Updated object

References copy(), and Grid().

◆ print()

int Grid::print ( )

Prints class information to standard output

References WXP::String::get().

Referenced by WXP::RcmPlot::draw(), and WXP::UpaXSectPlot::draw().

◆ printInfo()

int Grid::printInfo ( )

Prints basic grid information to standard output

References WXP::String::get().

◆ scale()

int Grid::scale ( float scale)

Scales the values in a grid

Parameters
scaleScale factor to apply

References WXP::Const::MISS, and scale().

Referenced by scale().

◆ setData() [1/2]

int Grid::setData ( float * array,
int order = 0 )

Sets grid point array from float array

Parameters
arrayinput array of grid values (flattened)
orderthe order of incoming array, flip if needed

References allocData().

◆ setData() [2/2]

int Grid::setData ( FloatArray & array,
int order = 0 )

Sets grid point array from FloatArray

Parameters
arrayinput array of grid values (flattened)
orderthe order of incoming array, flip if needed

References allocData().

◆ setDate() [1/2]

int Grid::setDate ( Date & d)

Sets the date of the grid

Parameters
[in]dDate class to use

Referenced by WXP::GribFile::setPDB().

◆ setDate() [2/2]

int Grid::setDate ( DateVal & dv)

Sets the date of the grid

Parameters
dvDate values to set date

References WXP::Date::set().

◆ setDatim() [1/2]

int Grid::setDatim ( const char * str)

Sets the date/time string

Parameters
[in]strDate/time string

References WXP::StrLib::copy().

Referenced by WXP::RcmPlot::draw(), and WXP::GribFile::makeDatim().

◆ setDatim() [2/2]

int Grid::setDatim ( String & str)

Sets the date/time string

Parameters
[in]strDate/time string

References WXP::StrLib::copy(), and WXP::String::get().

◆ setDomain()

int Grid::setDomain ( DomainVal & dv)

Sets the domain of the grid.

Parameters
dvDomainVal struct containing domain parameters

References WXP::DomainVal::nx, and WXP::DomainVal::ny.

Referenced by WXP::GribFile::getHeader(), WXP::GribFile::read(), WXP::GridMath::remap(), and WXP::GridPiece::set().

◆ setForeTime() [1/2]

int Grid::setForeTime ( const char * str)

Sets the forecast time of the grid

Parameters
tInput forecast time class

References WXP::ForeTime::set().

Referenced by WXP::GribFile::setPDB().

◆ setForeTime() [2/2]

int Grid::setForeTime ( ForeTime & t)

Sets the forecast time of the grid

Parameters
tInput forecast time class

◆ setGenName()

int Grid::setGenName ( const char * str)

Sets the model generation name

Parameters
strName

References WXP::StrLib::copy().

Referenced by WXP::GribFile::setPDB().

◆ setInfo()

◆ setLevel() [1/2]

int Grid::setLevel ( const char * str)

Sets the vertical level of the grid

Parameters
lInput Level class

References WXP::Level::set().

Referenced by WXP::GribFile::setPDB().

◆ setLevel() [2/2]

int Grid::setLevel ( Level & l)

Sets the vertical level of the grid

Parameters
lInput Level class

◆ setLocate()

int Grid::setLocate ( int x,
int y,
Point & pt )

Sets a location in the grid

Parameters
xX location in grid
yY location in grid
ptLocation of gridpoint on projection

References WXP::Point::x, and WXP::Point::y.

Referenced by WXP::UpaXSectCont::draw(), WXP::UpaXSectPlot::draw(), and WXP::ContPlot::drawFill().

◆ setSize()

int Grid::setSize ( int x,
int y )

Sets the grid size

Parameters
xThe number of gridpoints in X
yThe number of gridpoints in Y

References WXP::DateVal::set().

Referenced by WXP::UpaXSectCont::draw(), WXP::UpaXSectPlot::draw(), and Grid().

◆ setSource()

int Grid::setSource ( int val)

Set the source of the data

Parameters
[in]valSource of data

Referenced by WXP::GribFile::setPDB().

◆ setType()

int Grid::setType ( int val)

Set the grid type

Parameters
[in]valType of grid

◆ setValue()

◆ setVar() [1/2]

int Grid::setVar ( const char * str)

Sets the variable parameters

Parameters
vInput variable class

References WXP::Variable::print(), and WXP::Variable::set().

◆ setVar() [2/2]

int Grid::setVar ( Variable & v)

Sets the variable parameters

Parameters
vInput variable class

◆ setVersion()

int Grid::setVersion ( int val)

Sets the version of the data

Parameters
[in]valThe version number

Referenced by WXP::GribFile::setPDB().

◆ tran() [1/8]

int Grid::tran ( Domain & dom,
Point pt1,
Point & pt2 )

Translates coordinates from another domain to the domain of the grid

Parameters
domSecondary domain
pt1Input point on secondary projection plane
Return values
pt2Output point on grid projection plane

References WXP::Domain::translate().

◆ tran() [2/8]

int Grid::tran ( EarthPoint ept,
GridPoint & gpt )

Translates coordinates given the domain of the grid

Parameters
eptInput earth point
Return values
gptOutput grid point

◆ tran() [3/8]

int Grid::tran ( EarthPoint ept,
Point & pt )

Translates coordinates given the domain of the grid

Parameters
[in]eptInput earth point
[out]ptOutput point on projection plane

Referenced by WXP::NidsImage::applyMask(), 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().

◆ tran() [4/8]

int Grid::tran ( GridPoint gpt,
EarthPoint & ept )

Translates coordinates given the domain of the grid

Parameters
gptInput grid point
Return values
eptOutput earth point

◆ tran() [5/8]

int Grid::tran ( GridPoint gpt,
Point & pt )

Translates coordinates given the domain of the grid

Parameters
gptInput grid point
Return values
ptOutput point on projection plane

◆ tran() [6/8]

int Grid::tran ( Point pt,
EarthPoint & ept )

Translates coordinates given the domain of the grid

Parameters
[in]ptInput point on projection plane
[out]eptOutput earth point

◆ tran() [7/8]

int Grid::tran ( Point pt,
GridPoint & gpt )

Translates coordinates given the domain of the grid

Parameters
ptInput point on projection plane
Return values
gptOutput grid point

◆ tran() [8/8]

int Grid::tran ( Point pt1,
Domain & dom,
Point & pt2 )

Translates coordinates from the domain of the grid to another domain

Parameters
pt1Input point on grid projection plane
domSecondary domain
Return values
pt2Output point on secondary projection plane

References WXP::Domain::translate().

◆ unadjustDir()

float Grid::unadjustDir ( float dir,
Point & pt )

Adjusts grid direction based on location in grid to NS/EW direction (N=0)

Parameters
ptInput point on grid projection plane
dirInput direction
Returns
Adjusted direction

Member Data Documentation

◆ INV

const int WXP::Grid::INV = 2
static

Invert a grid that is y fastest

◆ Y

const int WXP::Grid::Y = 1
static

Grid starts at bottom and goes up


The documentation for this class was generated from the following files: