WXP C++ Library Version 6.74.9
|
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) |
This class does math on grids.
Takes the absolute value of each value in the grid
ogrid | Output grid |
grid | Input 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().
Adds two grids O = A + B
ogrid | Output grid |
agrid | Input grid, will be added to ogrid |
bgrid | Input 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().
Adds two grids O = O + I
ogrid | Output grid |
igrid | Input grid, will be added to ogrid |
References WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), isDomainEqual(), WXP::Const::MISS, and WXP::Grid::setValue().
Adds a number of grids O = I0 + I1 + ...
ogrid | Output grid |
grids | Input grids to be added |
References WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Const::MISS, and WXP::Grid::setValue().
This function adjusts U and V wind components from a north-east coordinate system to a grid coordinate system.
ogrid | Output grid |
agrid | Input grid |
bgrid | Input 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().
|
static |
Cuts off value in a grid. This would make all values lower/higher than a cutoff to nval
ogrid | Output grid |
cmd | Command (lower, higher) |
cutoff | Cutoff value |
nval | New value to set gridpoints to |
igrid | Grid 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().
Subtracts two grids O = A - B
ogrid | Output grid |
agrid | Input grid |
bgrid | Input 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().
Subtracts two grids O = O - I
ogrid | Output grid |
igrid | Input grid, will be subtracted from ogrid |
References WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), isDomainEqual(), WXP::Const::MISS, and WXP::Grid::setValue().
Divides two grids O = A / B
ogrid | Output grid |
agrid | Input grid |
bgrid | Input 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().
Takes the exponentiation of each value in the grid
ogrid | Output grid |
grid | Input 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().
Interpolates between grids
ogrid | Output grid |
agrid | First grid to be used |
factor | Interpolation factor |
bgrid | Second 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().
Inverts each value in the grid
ogrid | Output grid |
grid | Input 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().
Compares a domain to a grids
References WXP::DomainVal::compare(), WXP::Domain::get(), and WXP::Grid::getDomainVal().
Compares the domains of two grids
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().
Compares a domain to a grids
References WXP::DomainVal::compareProj(), WXP::Domain::get(), and WXP::Grid::getDomainVal().
Compares the domains of two grids
References WXP::DomainVal::compareProj(), and WXP::Grid::getDomainVal().
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.
ogrid | Output grid |
grid | Input grid |
oper | Operation (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.
Takes the logarithm of each value in the grid
ogrid | Output grid |
grid | Input 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().
Takes the logarithm base 10 of each value in the grid
ogrid | Output grid |
grid | Input 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().
Gets max of a number of grids
ogrid | Output grid |
grids | Input 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().
Computes the max wind speed
ugrid | U wind component grid |
vgrid | V wind component grid |
References WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), isDomainEqual(), max(), and WXP::Const::MISS.
Referenced by WXP::VectPlot::draw().
Gets min of a number of grids
ogrid | Output grid |
grids | Input 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().
Modulus two grids O = A % B
ogrid | Output grid |
agrid | Input grid |
bgrid | Input 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().
Multiplies two grids O = A * B
ogrid | Output grid |
agrid | Input grid |
bgrid | Input 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().
|
static |
Offset grid values
ogrid | Output grid |
off | Offset value |
References WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Const::MISS, and WXP::Grid::setValue().
Takes the power of values in grida to power of gridb
ogrid | Output grid |
agrid | Input grid1 |
bgrid | Input 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().
Remaps grid to new domain
ogrid | Output grid in new domain |
domain | New domain |
igrid | Grid 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().
|
static |
Resets the MISS value in a grid.
grid | Grid |
nval | New value to set MISS gridpoints to |
References WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Const::MISS, and WXP::Grid::setValue().
Remaps grid to new domain
ogrid | Output grid in new domain |
domain | New domain |
igrid | Grid to remap |
References WXP::Grid::allocData(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), and WXP::Grid::setValue().
|
static |
Scales grid values
ogrid | Output grid |
scale | Scale value |
References WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Const::MISS, scale(), and WXP::Grid::setValue().
Referenced by scale().
Square roots each value in the grid
ogrid | Output grid |
grid | Input 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().
|
static |
Changes the units of a grid
grid | Grid to change |
units | New units (C to F, ft to m) |
References WXP::Unit::convert(), WXP::Unit::equal(), WXP::Grid::getNx(), WXP::Grid::getNy(), WXP::Grid::getValue(), WXP::Grid::setValue(), units(), WXP::Unit::valid(), and WXP::StrLib::valid().
Referenced by WXP::GridPlot::draw(), WXP::MosPlot::draw(), WXP::SfcPlot::draw(), WXP::UpaPlot::draw(), WXP::RadMask::getGrids(), and units().