Skip to content

Commit

Permalink
recent changes ported to NONE
Browse files Browse the repository at this point in the history
  • Loading branch information
h-dh committed Oct 21, 2015
1 parent 6e1e84b commit e400f08
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 52 deletions.
16 changes: 11 additions & 5 deletions include/qa_NONE.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _QA_H
#define _QA_H
#ifndef _QA_NONE_H
#define _QA_NONE_H

#include "hdhC.h"
#include "date.h"
Expand Down Expand Up @@ -77,6 +77,9 @@ class VariableMetaData
void forkAnnotation(Annotation *p);
void setAnnotation(Annotation *p);
void setParent(QA *p){pQA=p;}

//! Verify units % or 1 by data range
void verifyPercent(void);
};

class QA_Exp
Expand All @@ -100,7 +103,7 @@ class QA_Exp
std::string
getTableEntryID(std::string vName);

void init(QA*, std::vector<std::string>&);
void init(std::vector<std::string>&);

//! Initialisation of flushing gathered results to netCDF file.
/*! Parameter indicates the number of variables. */
Expand All @@ -116,6 +119,8 @@ class QA_Exp
//! Check the path to the tables;
void inqTables(void){return;}

void setParent(QA*);

bool testPeriod(void); //{return false;}

std::vector<VariableMetaData> varMeDa;
Expand All @@ -129,7 +134,8 @@ class QA_Exp
// init for test about times
bool isCaseInsensitiveVarName;
bool isClearBits;

bool isUseStrict; // dummy

std::vector<std::string> excludedAttribute;
std::vector<std::string> overruleAllFlagsOption;

Expand All @@ -141,7 +147,7 @@ class QA_Exp
std::string frequency;
std::string fVarname;

void pushBackVarMeDa(Variable*);
void pushBackVarMeDa(Variable*);
};

#endif
35 changes: 10 additions & 25 deletions src/QA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,9 @@ QA::init(void)

notes->init(); // safe

qaExp.setParent(this);
qaTime.setParent(this);

// default for the qaFile
setFilename( pIn->file );

Expand All @@ -516,8 +519,11 @@ QA::init(void)
// exclude user-defined data variables from any checking
pIn->excludeVars();

if(! (isCheckTime && qaTime.init(optStr)) )
isCheckTime=false;

// experiment specific obj: set parent, pass over options
qaExp.init(this, optStr);
qaExp.init(optStr);

// check existance of any data at all
if( (isCheckTime || isCheckData )
Expand All @@ -541,29 +547,6 @@ QA::init(void)
}
}

if(qaTime.init(pIn, notes, this))
{
// init the time obj.
// note that freq is compared to the first column of the time table
qaTime.applyOptions(optStr);
qaTime.initTimeTable( qaExp.getFrequency() );

// note that this test is not part of the QA_Time class, because
// coding depends on projects
if( qaExp.testPeriod() )
{
std::string key("9_2");
if( notes->inq( key, qaTime.name) )
{
std::string capt("status is apparently in progress");

(void) notes->operate(capt) ;
}
}
}
else
isCheckTime=false;

notes->setConstraintFreq( qaExp.getFrequency() );

// enable detection of outlier and replicated records
Expand Down Expand Up @@ -725,9 +708,11 @@ QA::initGlobalAtts(InFile &in)
nc->setGlobalAtt( "QA revision", revision);
nc->setGlobalAtt( "contact", "hollweg@dkrz.de");

#ifndef NONE
std::string t("csv formatted ");
t += qaExp.varReqTable.basename + "xlsx" ;
t += qaExp.varReqTable.basename ;
nc->setGlobalAtt( "standard_table", t);
#endif

nc->setGlobalAtt( "creation_date", today);

Expand Down
32 changes: 10 additions & 22 deletions src/QA_NONE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,6 @@ QA_Exp::getFrequency()
// get frequency from attribute (it is required)
frequency = pQA->pIn->nc.getAttString("frequency") ;

if( frequency.size() )
return frequency;
else if( frequency_pos > -1 )
{
// try the frequency posdition within the filename
std::string f( pQA->pIn->file.basename );
Split splt;
splt.enableEmptyItems();
splt.setSeparator("_");

splt = f ;

// test the last two items for time type. If both are,
// then this would mean that they are separated by '_'.
if( static_cast<int>(splt.size()) > frequency_pos )
frequency = splt[ frequency_pos ] ;
}

return frequency ;
}

Expand All @@ -93,11 +75,8 @@ QA_Exp::getTableEntryID(std::string vName)
}

void
QA_Exp::init(QA* p, std::vector<std::string>& optStr)
QA_Exp::init(std::vector<std::string>& optStr)
{
pQA = p;
notes = p->notes;

// apply parsed command-line args
applyOptions(optStr);

Expand All @@ -120,6 +99,7 @@ void
QA_Exp::initDefaults(void)
{
isCaseInsensitiveVarName=false;
isUseStrict=false;

bufferSize=1500;

Expand Down Expand Up @@ -201,6 +181,14 @@ QA_Exp::pushBackVarMeDa(Variable *var)
return;
}

void
QA_Exp::setParent(QA* p)
{
pQA = p;
notes = p->notes;
return;
}

bool
QA_Exp::testPeriod(void)
{
Expand Down

0 comments on commit e400f08

Please sign in to comment.