Skip to content

Commit

Permalink
#1936 Added mesonet_optional_vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard Soh committed Nov 10, 2021
1 parent cb30e07 commit 3431e64
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 20 deletions.
36 changes: 20 additions & 16 deletions met/src/tools/other/madis2nc/madis2nc_conf_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,43 +52,47 @@ void Madis2NcConfInfo::init_from_scratch()

void Madis2NcConfInfo::clear()
{
mesonet_optional_vars.clear();
_version.clear();
}

////////////////////////////////////////////////////////////////////////

void Madis2NcConfInfo::read_config(const string &default_filename,
const string &user_filename)
const string &user_filename)
{
// Read the config file constants
// Read the config file constants

_conf.read(replace_path(config_const_filename).c_str());

// Read the default config file
_conf.read(replace_path(config_const_filename).c_str());

_conf.read(replace_path(default_filename).c_str());
// Read the default config file

// Read the user config file
_conf.read(replace_path(default_filename).c_str());

_conf.read(user_filename.c_str());
// Read the user config file

// Process the configuration file
_conf.read(user_filename.c_str());

process_config();
// Process the configuration file

return;
process_config();

return;
}

////////////////////////////////////////////////////////////////////////

void Madis2NcConfInfo::process_config()
{

_version = parse_conf_version(&_conf);
check_met_version(_version.c_str());

_timeSummaryInfo = parse_conf_time_summary(&_conf);

_version = parse_conf_version(&_conf);
check_met_version(_version.c_str());

StringArray sa = _conf.lookup_string_array(conf_key_mesonet_opt_var, false);
for(int i=0; i<sa.n_elements(); i++) mesonet_optional_vars.add(sa[i]);

_timeSummaryInfo = parse_conf_time_summary(&_conf);

return;
}

Expand Down
16 changes: 12 additions & 4 deletions met/src/tools/other/madis2nc/madis2nc_conf_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,25 @@
class Madis2NcConfInfo {

public:

Madis2NcConfInfo();
~Madis2NcConfInfo();

void read_config(const string &default_filename,
const string &user_filename);
const string &user_filename);

StringArray get_mosonet_optional_vars() const
{
return mesonet_optional_vars;
}

TimeSummaryInfo getSummaryInfo() const
{
return _timeSummaryInfo;
}

int get_compression_level() { return _conf.nc_compression(); }

protected:

///////////////////////
Expand All @@ -47,6 +52,9 @@ class Madis2NcConfInfo {

MetConfig _conf;

// Mesonet optional variables
StringArray mesonet_optional_vars;

// Config file version

ConcatString _version;
Expand Down

0 comments on commit 3431e64

Please sign in to comment.