WXP C++ Library Version 6.74.6
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
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 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)
 

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().

◆ Grid() [2/3]

Grid::Grid ( int  rnx,
int  rny 
)

Constructor for Grid Initializes the grid parameters.

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

◆ Grid() [3/3]

Grid::Grid ( const Grid grid)

Copy constructor for the grid class

Parameters
gridGrid class to copy from

◆ ~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

References WXP::Domain::adjustDir().

◆ allocData()

int Grid::allocData ( )

◆ allocLocate()

int Grid::allocLocate ( )

Allocates the location points for the grid

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

◆ 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

References WXP::Date::get().

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 ( )

◆ 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

References WXP::Domain::get().

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

◆ getDx()

float Grid::getDx ( )

Gets the grid domain dx value

Returns
Dx value

References WXP::Domain::getDx().

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

◆ getDy()

float Grid::getDy ( )

Gets the grid domain dx value

Returns
Dx value

References WXP::Domain::getDy().

◆ 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

◆ getForeTime() [2/2]

int Grid::getForeTime ( ForeTime t)

Gets the forecast time of the grid

Return values
tInput forecast time class

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()

int Grid::getNx ( )

◆ getNy()

int Grid::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

Return values
OutputGridSpec 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(), and WXP::Domain::tran().

◆ 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]

float Grid::getValue ( int  x,
int  y 
)

◆ 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(), and WXP::Domain::tran().

◆ 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()

int Grid::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
gridString class to copy from

◆ print()

int Grid::print ( )

◆ 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().

◆ setDate() [1/2]

int Grid::setDate ( Date d)

Sets the date of the grid

Parameters
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
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
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, WXP::DomainVal::ny, and WXP::Domain::set().

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::VarSpec::set(), and 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

References WXP::VarSpec::set().

◆ setGenName()

int Grid::setGenName ( const char *  str)

Sets the model generation name

Parameters
strName

References WXP::StrLib::copy().

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

◆ setInfo()

int Grid::setInfo ( const char *  str)

◆ setLevel() [1/2]

int Grid::setLevel ( const char *  str)

Sets the vertical level of the grid

Parameters
lInput Level class

References WXP::VarSpec::set(), and 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

References WXP::VarSpec::set().

◆ 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::Domain::set().

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

◆ setSource()

int Grid::setSource ( int  val)

Set the source of the data

Parameters
valSource of data

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

◆ setType()

int Grid::setType ( int  val)

Set the grid type

Parameters
valType of grid

◆ setValue()

int Grid::setValue ( int  x,
int  y,
float  val 
)

◆ setVar() [1/2]

int Grid::setVar ( const char *  str)

Sets the variable parameters

Parameters
vInput variable class

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

◆ setVar() [2/2]

int Grid::setVar ( Variable v)

Sets the variable parameters

Parameters
vInput variable class

References WXP::VarSpec::set().

◆ setVersion()

int Grid::setVersion ( int  val)

Sets the version of the data

Parameters
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

References WXP::Domain::tran().

◆ tran() [3/8]

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

◆ 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

References WXP::Domain::tran().

◆ 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

References WXP::Domain::tran().

◆ tran() [6/8]

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

Translates coordinates given the domain of the grid

Parameters
ptInput point on projection plane
Return values
eptOutput earth point

References WXP::Domain::tran().

◆ 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

References WXP::Domain::tran().

◆ 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

References WXP::Domain::unadjustDir().


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