WXP C++ Library Version 6.74.6
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
WXP::ForeTime Class Reference

This class defines forecast time parameters. More...

#include "../include/ForeTime.h"

Public Member Functions

 ForeTime ()
 
 ForeTime (int t, int t1, int t2)
 
 ForeTime (int t)
 
 ForeTime (const char *str)
 
int init ()
 
bool isSet ()
 
int decode (const char *str)
 
int toString (String &str)
 
float getFore ()
 
float getHours ()
 
int getSeconds ()
 
int toTimeLabelDay (String &str)
 
int toTimeLabel (String &str)
 
int toVarLabel (String &str)
 
int set (int t, float t1, float t2)
 
int set (int t, int u, float t1, float t2)
 
int set (int val)
 
int set (const char *str)
 
int setEnd (DateVal &dv)
 
int setOffset (int val)
 
float getOffset ()
 
int setTypeOffset (float t)
 
float getTypeOffset ()
 
int setType (int t)
 
int getType ()
 
bool isTypeComplex ()
 
int setTime1 (float val)
 
float getTime1 ()
 
int setTime2 (float val)
 
float getTime2 ()
 
DateVal getEnd ()
 
bool validEnd ()
 
bool valid ()
 
int toCode ()
 
int print ()
 

Static Public Member Functions

static int toTimeLabel (float ftime, String &str)
 

Static Public Attributes

static const int NONE = -9999
 
static const int FORE = 0
 
static const int ANAL = 1
 
static const int RNG = 2
 
static const int AVG = 3
 
static const int ACC = 4
 
static const int DIFF = 5
 
static const int MAX = 6
 
static const int MIN = 7
 
static const int ANY = 9
 
static const int MINUTE = 0
 
static const int HOUR = 1
 
static const int DAY = 2
 
static const int MONTH = 3
 
static const int YEAR = 4
 

Detailed Description

This class defines forecast time parameters.

Author
Dan Vietor

Constructor & Destructor Documentation

◆ ForeTime() [1/2]

ForeTime::ForeTime ( )

Constructor. Initializes values

References init().

◆ ForeTime() [2/2]

ForeTime::ForeTime ( const char *  str)

Constructor. Decode from string

Parameters
strString to decode forecast time from

References init(), and set().

Member Function Documentation

◆ decode()

int ForeTime::decode ( const char *  str)

Decodes forecast time date from string

Parameters
strString to decode

References ACC, ANAL, ANY, AVG, DIFF, FORE, WXP::StrLib::iequal(), init(), MAX, MIN, WXP::Const::MISS, RNG, and WXP::StrLib::valid().

Referenced by set().

◆ getFore()

float ForeTime::getFore ( )

Return a single time value dependent on type of forecast time

Returns
Time value

References WXP::Const::MISS.

Referenced by WXP::DateTool::createLabel(), WXP::GridPlot::draw(), WXP::GridPlot::setFilename(), toTimeLabel(), and toTimeLabelDay().

◆ getHours()

float ForeTime::getHours ( )

Return a single time value in hours dependent on type of forecast time

Returns
Time value in hours

◆ getSeconds()

int ForeTime::getSeconds ( )

Return a single time value in hours dependent on type of forecast time

Returns
Time value in seconds

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

◆ init()

int ForeTime::init ( )

Initializes class data

References HOUR, and WXP::Const::MISS.

Referenced by decode(), ForeTime(), and WXP::VarSpec::init().

◆ isSet()

bool WXP::ForeTime::isSet ( )
inline

Returns if object values set

Referenced by WXP::GridPlot::draw(), and WXP::GridPlot::setFilename().

◆ print()

int ForeTime::print ( )

Prints class data to standard output

References ACC, ANY, AVG, DIFF, FORE, MAX, MIN, WXP::Const::MISS, and RNG.

Referenced by WXP::VarSpec::printDetails().

◆ set() [1/4]

int ForeTime::set ( const char *  str)

Sets the forecast time parameters from string

Parameters
strString to decode

References decode().

◆ set() [2/4]

int ForeTime::set ( int  t,
float  t1,
float  t2 
)

Sets the forecast time parameters individually

Parameters
tType of time
t1First time value
t2Second time value

Referenced by ForeTime(), WXP::GribFile::makeDatim(), WXP::GribFile::readPDB(), WXP::GribFile::readPDS(), and WXP::Grid::setForeTime().

◆ set() [3/4]

int ForeTime::set ( int  t,
int  u,
float  t1,
float  t2 
)

Sets the forecast time parameters individually

Parameters
tType of time
uUnit of time (HOUR, DAY, ...)
t1First time value
t2Second time value

◆ set() [4/4]

int ForeTime::set ( int  val)

Sets the forecast time values from integer code

Parameters
valInteger code

References DAY, and MONTH.

◆ toCode()

int ForeTime::toCode ( )

Encodes forecast time parameters to a single integer

Returns
Output integer code

References ACC, ANY, AVG, DAY, DIFF, MAX, MIN, WXP::Const::MISS, MONTH, and RNG.

Referenced by WXP::WmoIngest::process().

◆ toString()

int ForeTime::toString ( String str)

Converts forecast time parameters to a string

Return values
strOutput string

References ACC, ANY, WXP::String::append(), WXP::String::aprintf(), AVG, WXP::String::clear(), WXP::String::copy(), DIFF, MAX, MIN, WXP::Const::MISS, WXP::String::printf(), and RNG.

Referenced by WXP::VarSpec::print().

◆ toTimeLabel() [1/2]

int ForeTime::toTimeLabel ( float  fhour,
String str 
)
static

Create a label string

Return values
strOutput string

References WXP::String::clear(), WXP::Const::MISS, and WXP::String::printf().

Referenced by WXP::DateTool::createLabel(), and WXP::GribFile::makeDatim().

◆ toTimeLabel() [2/2]

int ForeTime::toTimeLabel ( String str)

Create a label string

Return values
strOutput string

References WXP::String::clear(), getFore(), WXP::Const::MISS, and WXP::String::printf().

◆ toTimeLabelDay()

int ForeTime::toTimeLabelDay ( String str)

Create a label string with time in days

Return values
strOutput string

References WXP::String::clear(), getFore(), WXP::Const::MISS, and WXP::String::printf().

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

◆ toVarLabel()

int ForeTime::toVarLabel ( String str)

Create a label string for combination with variable data

Return values
strOutput string

References ACC, WXP::String::append(), AVG, DIFF, MAX, MIN, WXP::String::printf(), and RNG.

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

Member Data Documentation

◆ ACC

const int WXP::ForeTime::ACC = 4
static

◆ ANAL

const int WXP::ForeTime::ANAL = 1
static

◆ ANY

const int WXP::ForeTime::ANY = 9
static

Match any type

Referenced by decode(), print(), toCode(), and toString().

◆ AVG

const int WXP::ForeTime::AVG = 3
static

◆ DAY

const int WXP::ForeTime::DAY = 2
static

Time in Days

Referenced by WXP::GribFile::readPDB(), set(), and toCode().

◆ DIFF

const int WXP::ForeTime::DIFF = 5
static

Difference between two forecast times

Referenced by decode(), print(), WXP::GribFile::readPDB(), WXP::GribFile::readPDS(), toCode(), toString(), and toVarLabel().

◆ FORE

const int WXP::ForeTime::FORE = 0
static

◆ HOUR

const int WXP::ForeTime::HOUR = 1
static

Time in Hours

Referenced by init(), and WXP::GribFile::readPDB().

◆ MAX

const int WXP::ForeTime::MAX = 6
static

Maximum over a period

Referenced by decode(), print(), WXP::GribFile::readPDS(), toCode(), toString(), and toVarLabel().

◆ MIN

const int WXP::ForeTime::MIN = 7
static

Minimum over a period

Referenced by decode(), print(), WXP::GribFile::readPDS(), toCode(), toString(), and toVarLabel().

◆ MINUTE

const int WXP::ForeTime::MINUTE = 0
static

Time in Minutes

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

◆ MONTH

const int WXP::ForeTime::MONTH = 3
static

Time in Months

Referenced by WXP::GribFile::readPDB(), set(), and toCode().

◆ RNG

const int WXP::ForeTime::RNG = 2
static

◆ YEAR

const int WXP::ForeTime::YEAR = 4
static

Time in Years


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