WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
WXP::GridMath Class Reference

This class does math on grids. More...

#include "../include/GridMath.h"

Public Types

enum  { UVGRID , UVEW }
 

Static Public Member Functions

static int process (const char *str, Grid &ogrid, Grids &grids)
 
static int process (const char *str, Grid &ogrid1, Grid &ogrid2, Grids &grids)
 
static bool checkVar (Grid &grid, const char *var)
 
static bool isVectFunc (const char *var)
 
static int setInfo (Grid &ogrid, const char *name, const char *units)
 
static int units (Grid &grid, const char *units)
 
static bool isDomainEqual (Grid &grd1, Grid &grd2)
 
static bool isDomainEqual (Grid &grd1, Domain &dom)
 
static bool isProjEqual (Grid &grd1, Grid &grd2)
 
static bool isProjEqual (Grid &grd1, Domain &dom)
 
static float maxSpd (Grid &ugrid, Grid &vgrid)
 
static int remap (Grid &ogrid, Domain &domain, Grid &igrid)
 
static int revalue (Grid &ogrid, const char *str, Grid &igrid)
 
static int cutoff (Grid &ogrid, const char *cmd, float cutoff, float nval, Grid &igrid)
 
static int resetMiss (Grid &grid, float nval)
 
static int scale (Grid &ogrid, float scale)
 
static int offset (Grid &ogrid, float off)
 
static int interp (Grid &ogrid, Grid &grid1, float ival, Grid &grid2)
 
static int add (Grid &ogrid, Grid &igrid)
 
static int add (Grid &ogrid, Grid &agrid, Grid &bgrid)
 
static int add (Grid &ogrid, Grids &grids)
 
static int avg (Grid &ogrid, Grids &grids)
 
static int diff (Grid &ogrid, Grid &igrid)
 
static int diff (Grid &ogrid, Grid &grida, Grid &gridb)
 
static int mult (Grid &ogrid, Grid &grida, Grid &gridb)
 
static int div (Grid &ogrid, Grid &grida, Grid &gridb)
 
static int mod (Grid &ogrid, Grid &grida, Grid &gridb)
 
static int max (Grid &ogrid, Grids &grids)
 
static int min (Grid &ogrid, Grids &grids)
 
static int sqrt (Grid &ogrid, Grid &grid)
 
static int abs (Grid &ogrid, Grid &grid)
 
static int inv (Grid &ogrid, Grid &grid)
 
static int log (Grid &ogrid, Grid &grid)
 
static int log10 (Grid &ogrid, Grid &grid)
 
static int exp (Grid &ogrid, Grid &grid)
 
static int pow (Grid &ogrid, Grid &grida, Grid &gridb)
 
static int adjustUV (Grid &ugrid, Grid &vgrid)
 
static int locatePoint (Grid &ogrid, Grid &grid, const char *oper)
 
static int coriolis (Grid &ogrid, Grid &grid, const char *oper)
 
static int dx (Grid &ogrid, Grid &grid)
 
static int dy (Grid &ogrid, Grid &grid)
 
static int laplacian (Grid &ogrid, Grid &grid)
 
static int converge (Grid &ogrid, Grid &ugrid, Grid &vgrid, Grid &zgrid)
 
static int converge (Grid &ogrid, Grid &ugrid, Grid &vgrid)
 
static int vorticity (Grid &ogrid, Grid &ugrid, Grid &vgrid)
 
static int deformation1 (Grid &ogrid, Grid &ugrid, Grid &vgrid)
 
static int deformation2 (Grid &ogrid, Grid &ugrid, Grid &vgrid)
 
static int advection (Grid &ogrid, Grid &ugrid, Grid &vgrid, Grid &zgrid)
 
static int windSpd (Grid &ogrid, Grid &ugrid, Grid &vgrid)
 
static int windDir (Grid &ogrid, Grid &ugrid, Grid &vgrid, int flag)
 
static int windU (Grid &ogrid, Grid &dgrid, Grid &sgrid, int flag)
 
static int windV (Grid &ogrid, Grid &dgrid, Grid &sgrid, int flag)
 
static int dewTemp (Grid &ogrid, Grid &tgrid, Grid &rgrid)
 
static int relHum (Grid &ogrid, Grid &tgrid, Grid &dgrid)
 
static int specHum (Grid &ogrid, Grid &tgrid, Grid &dgrid)
 
static int wetBulb (Grid &ogrid, Grid &tgrid, Grid &rgrid)
 
static int mixRatio (Grid &ogrid, Grid &tgrid, Grid &rgrid)
 
static int windChill (Grid &ogrid, const char *func, Grid &tgrid, Grid &sgrid)
 
static int heatIndex (Grid &ogrid, Grid &tgrid, Grid &rgrid)
 
static int potTemp (Grid &ogrid, Grid &grid)
 
static int virtTemp (Grid &ogrid, Grid &tgrid, Grid &rgrid)
 
static int virtPotTemp (Grid &ogrid, Grid &tgrid, Grid &rgrid)
 
static int equivPotTemp (Grid &ogrid, Grid &tgrid, Grid &rgrid)
 
static int geosU (Grid &ogrid, Grid &hgrid)
 
static int geosV (Grid &ogrid, Grid &hgrid)
 
static int showalter (Grid &ogrid, Grid &t8grid, Grid &r8grid, Grid &t5grid)
 
static int adjustDir (Grid &ugrid, Grid &vgrid, Domain &dom, int flag)
 

Detailed Description

This class does math on grids.

Author
Dan Vietor

Member Function Documentation

◆ abs()

int GridMath::abs ( Grid ogrid,
Grid grid 
)
static

Takes the absolute value of each value in the grid

Return values
ogridOutput grid
Parameters
gridInput grid

References WXP::Grid::allocData(), WXP::String::get(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Grid::init(), WXP::Const::MISS, WXP::Grid::setInfo(), WXP::Grid::setValue(), and WXP::VarSpec::toInfoLabel().

◆ add() [1/3]

int GridMath::add ( Grid ogrid,
Grid agrid,
Grid bgrid 
)
static

Adds two grids O = A + B

Return values
ogridOutput grid
Parameters
agridInput grid, will be added to ogrid
bgridInput grid, will be added to ogrid

References WXP::Grid::allocData(), WXP::String::get(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), isDomainEqual(), WXP::Const::MISS, WXP::Grid::setInfo(), WXP::Grid::setValue(), and WXP::VarSpec::toInfoLabel().

◆ add() [2/3]

int GridMath::add ( Grid ogrid,
Grid igrid 
)
static

Adds two grids O = O + I

Return values
ogridOutput grid
Parameters
igridInput grid, will be added to ogrid

References WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), isDomainEqual(), WXP::Const::MISS, and WXP::Grid::setValue().

◆ add() [3/3]

int GridMath::add ( Grid ogrid,
Grids grids 
)
static

Adds a number of grids O = I0 + I1 + ...

Return values
ogridOutput grid
Parameters
gridsInput grids to be added

References WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Const::MISS, and WXP::Grid::setValue().

◆ adjustUV()

int GridMath::adjustUV ( Grid ugrid,
Grid vgrid 
)
static

This function adjusts U and V wind components from a north-east coordinate system to a grid coordinate system.

Return values
ogridOutput grid
Parameters
agridInput grid
bgridInput grid

References WXP::Domain::adjustDir(), WXP::Const::DRC, WXP::Grid::getDomain(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), isDomainEqual(), WXP::Const::MISS, WXP::Point::set(), WXP::Grid::setValue(), WXP::Domain::tran(), WXP::Calc::windDir(), WXP::Calc::windSpd(), WXP::Calc::windU(), and WXP::Calc::windV().

◆ cutoff()

int GridMath::cutoff ( Grid ogrid,
const char *  cmd,
float  cutoff,
float  nval,
Grid igrid 
)
static

Cuts off value in a grid. This would make all values lower/higher than a cutoff to nval

Return values
ogridOutput grid
Parameters
cmdCommand (lower, higher)
cutoffCutoff value
nvalNew value to set gridpoints to
igridGrid to use

References WXP::Grid::allocData(), cutoff(), WXP::StrLib::equal(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Const::MISS, and WXP::Grid::setValue().

Referenced by cutoff().

◆ diff() [1/2]

int GridMath::diff ( Grid ogrid,
Grid agrid,
Grid bgrid 
)
static

Subtracts two grids O = A - B

Return values
ogridOutput grid
Parameters
agridInput grid
bgridInput grid

References WXP::Grid::allocData(), WXP::String::get(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Grid::init(), isDomainEqual(), WXP::Const::MISS, WXP::Grid::setInfo(), WXP::Grid::setValue(), and WXP::VarSpec::toInfoLabel().

◆ diff() [2/2]

int GridMath::diff ( Grid ogrid,
Grid igrid 
)
static

Subtracts two grids O = O - I

Return values
ogridOutput grid
Parameters
igridInput grid, will be subtracted from ogrid

References WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), isDomainEqual(), WXP::Const::MISS, and WXP::Grid::setValue().

◆ div()

int GridMath::div ( Grid ogrid,
Grid agrid,
Grid bgrid 
)
static

◆ exp()

int GridMath::exp ( Grid ogrid,
Grid grid 
)
static

Takes the exponentiation of each value in the grid

Return values
ogridOutput grid
Parameters
gridInput grid

References WXP::Grid::allocData(), WXP::String::get(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Grid::init(), WXP::Const::MISS, WXP::Grid::setInfo(), WXP::Grid::setValue(), and WXP::VarSpec::toInfoLabel().

◆ interp()

int GridMath::interp ( Grid ogrid,
Grid agrid,
float  factor,
Grid bgrid 
)
static

Interpolates between grids

Return values
ogridOutput grid
Parameters
agridFirst grid to be used
factorInterpolation factor
bgridSecond grid to be used

References WXP::Grid::allocData(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), isDomainEqual(), WXP::Const::MISS, and WXP::Grid::setValue().

◆ inv()

int GridMath::inv ( Grid ogrid,
Grid grid 
)
static

◆ isDomainEqual() [1/2]

bool GridMath::isDomainEqual ( Grid grd,
Domain dom 
)
static

Compares a domain to a grids

Parameters
grdGrid
domDomain to compare to
Returns
Whether two domains are equal

References WXP::DomainVal::compare(), WXP::Domain::get(), and WXP::Grid::getDomainVal().

◆ isDomainEqual() [2/2]

bool GridMath::isDomainEqual ( Grid grd1,
Grid grd2 
)
static

Compares the domains of two grids

Parameters
grd1Grid 1
grd2Grid 2
Returns
Whether two domains are equal

References WXP::DomainVal::compare(), and WXP::Grid::getDomainVal().

Referenced by add(), add(), adjustUV(), diff(), diff(), div(), WXP::VectPlot::draw(), WXP::ContPlot::drawFill(), interp(), maxSpd(), mod(), mult(), pow(), and WXP::GridBox::set().

◆ isProjEqual() [1/2]

bool GridMath::isProjEqual ( Grid grd,
Domain dom 
)
static

Compares a domain to a grids

Parameters
grdGrid
domDomain to compare to
Returns
Whether two domains are equal

References WXP::DomainVal::compareProj(), WXP::Domain::get(), and WXP::Grid::getDomainVal().

◆ isProjEqual() [2/2]

bool GridMath::isProjEqual ( Grid grd1,
Grid grd2 
)
static

Compares the domains of two grids

Parameters
grd1Grid 1
grd2Grid 2
Returns
Whether two domains are equal

References WXP::DomainVal::compareProj(), and WXP::Grid::getDomainVal().

◆ locatePoint()

int GridMath::locatePoint ( Grid ogrid,
Grid grid,
const char *  oper 
)
static

Outputs a grid with location information for each gridpoint. For example, lat will return a grid with each gridpoint containing the latitude of that gridpoint.

Return values
ogridOutput grid
Parameters
gridInput grid
operOperation (lat, lon, projx, projy)

References WXP::Grid::allocData(), WXP::StrLib::equal(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::EarthPoint::lat, WXP::EarthPoint::lon, WXP::GridPoint::set(), WXP::Grid::setInfo(), WXP::Grid::setValue(), WXP::Grid::tran(), WXP::Point::x, and WXP::Point::y.

◆ log()

int GridMath::log ( Grid ogrid,
Grid grid 
)
static

Takes the logarithm of each value in the grid

Return values
ogridOutput grid
Parameters
gridInput grid

References WXP::Grid::allocData(), WXP::String::get(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Grid::init(), WXP::Const::MISS, WXP::Grid::setInfo(), WXP::Grid::setValue(), and WXP::VarSpec::toInfoLabel().

◆ log10()

int GridMath::log10 ( Grid ogrid,
Grid grid 
)
static

Takes the logarithm base 10 of each value in the grid

Return values
ogridOutput grid
Parameters
gridInput grid

References WXP::Grid::allocData(), WXP::String::get(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Grid::init(), WXP::Const::MISS, WXP::Grid::setInfo(), WXP::Grid::setValue(), and WXP::VarSpec::toInfoLabel().

◆ max()

int GridMath::max ( Grid ogrid,
Grids grids 
)
static

Gets max of a number of grids

Return values
ogridOutput grid
Parameters
gridsInput grids

References WXP::Grid::allocData(), WXP::String::get(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::init(), max(), WXP::Const::MISS, WXP::Grid::setInfo(), WXP::Grid::setValue(), and WXP::VarSpec::toInfoLabel().

Referenced by max(), and maxSpd().

◆ maxSpd()

float GridMath::maxSpd ( Grid ugrid,
Grid vgrid 
)
static

Computes the max wind speed

Parameters
ugridU wind component grid
vgridV wind component grid
Returns
maximum speed

References WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), isDomainEqual(), max(), and WXP::Const::MISS.

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

◆ min()

int GridMath::min ( Grid ogrid,
Grids grids 
)
static

Gets min of a number of grids

Return values
ogridOutput grid
Parameters
gridsInput grids

References WXP::Grid::allocData(), WXP::String::get(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::init(), min(), WXP::Const::MISS, WXP::Grid::setInfo(), WXP::Grid::setValue(), and WXP::VarSpec::toInfoLabel().

Referenced by min().

◆ mod()

int GridMath::mod ( Grid ogrid,
Grid agrid,
Grid bgrid 
)
static

◆ mult()

int GridMath::mult ( Grid ogrid,
Grid agrid,
Grid bgrid 
)
static

Multiplies two grids O = A * B

Return values
ogridOutput grid
Parameters
agridInput grid
bgridInput grid

References WXP::Grid::allocData(), WXP::String::get(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Grid::init(), isDomainEqual(), WXP::Const::MISS, WXP::Grid::setInfo(), WXP::Grid::setValue(), and WXP::VarSpec::toInfoLabel().

◆ offset()

int GridMath::offset ( Grid ogrid,
float  off 
)
static

Offset grid values

Return values
ogridOutput grid
Parameters
offOffset value

References WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Const::MISS, and WXP::Grid::setValue().

◆ pow()

int GridMath::pow ( Grid ogrid,
Grid agrid,
Grid bgrid 
)
static

Takes the power of values in grida to power of gridb

Return values
ogridOutput grid
Parameters
agridInput grid1
bgridInput grid2

References WXP::Grid::allocData(), WXP::String::get(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Grid::init(), isDomainEqual(), WXP::Const::MISS, WXP::Grid::setInfo(), WXP::Grid::setValue(), and WXP::VarSpec::toInfoLabel().

◆ remap()

int GridMath::remap ( Grid ogrid,
Domain domain,
Grid igrid 
)
static

Remaps grid to new domain

Return values
ogridOutput grid in new domain
Parameters
domainNew domain
igridGrid to remap

References WXP::Grid::allocData(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Domain::isSet(), WXP::GridPoint::set(), WXP::Grid::setDomain(), WXP::Grid::setValue(), and WXP::Grid::tran().

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

◆ resetMiss()

int GridMath::resetMiss ( Grid grid,
float  nval 
)
static

Resets the MISS value in a grid.

Return values
gridGrid
Parameters
nvalNew value to set MISS gridpoints to

References WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Const::MISS, and WXP::Grid::setValue().

◆ revalue()

int GridMath::revalue ( Grid ogrid,
const char *  str,
Grid igrid 
)
static

Remaps grid to new domain

Return values
ogridOutput grid in new domain
Parameters
domainNew domain
igridGrid to remap

References WXP::Grid::allocData(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), and WXP::Grid::setValue().

◆ scale()

int GridMath::scale ( Grid ogrid,
float  scale 
)
static

Scales grid values

Return values
ogridOutput grid
Parameters
scaleScale value

References WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Const::MISS, scale(), and WXP::Grid::setValue().

Referenced by scale().

◆ sqrt()

int GridMath::sqrt ( Grid ogrid,
Grid grid 
)
static

◆ units()

int GridMath::units ( Grid grid,
const char *  units 
)
static

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