Skip to content

Commit

Permalink
#3007 Derived from IODADataConfInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard Soh committed Dec 17, 2024
1 parent 2e4fbcd commit 922b3ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
21 changes: 10 additions & 11 deletions src/tools/other/ioda2nc/ioda2nc_conf_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ void IODA2NCConfInfo::init_from_scratch() {

void IODA2NCConfInfo::clear() {

IODADataConfInfo::clear();

// Initialize values
message_type.clear();
station_id.clear();
Expand All @@ -66,7 +68,7 @@ void IODA2NCConfInfo::clear() {
beg_level = end_level = bad_data_double;
quality_mark_thresh = bad_data_int;
version.clear();
obs_name_map.clear();
obs_var.clear();
message_type_map.clear();

return;
Expand All @@ -75,7 +77,7 @@ void IODA2NCConfInfo::clear() {
////////////////////////////////////////////////////////////////////////

void IODA2NCConfInfo::read_config(const char *default_file_name,
const char *user_file_name) {
const char *user_file_name) {

// Read the config file constants
conf.read(replace_path(config_const_filename).c_str());
Expand Down Expand Up @@ -104,6 +106,10 @@ void IODA2NCConfInfo::process_config() {

// Initialize
clear();
// Done by the base class
// Conf: missing_thresh
// Conf: obs_name_map, metadata_map, obs_to_qc_map
IODADataConfInfo::process_config();

// Conf: version
version = parse_conf_version(&conf);
Expand All @@ -112,8 +118,7 @@ void IODA2NCConfInfo::process_config() {
message_type = conf.lookup_string_array(conf_key_message_type);

// Conf: message_type_group_map
map<ConcatString,StringArray> group_map;
group_map = parse_conf_message_type_group_map(&conf);
map<ConcatString,StringArray> group_map = parse_conf_message_type_group_map(&conf);

// Expand the values for any message type group names
for(i=0; i<message_type.n_elements(); i++) {
Expand Down Expand Up @@ -154,9 +159,6 @@ void IODA2NCConfInfo::process_config() {
// Conf: quality_mark_thresh
quality_mark_thresh = conf.lookup_int(conf_key_quality_mark_thresh);

// Conf: missing_thresh
missing_thresh = conf.lookup_thresh_array(conf_key_missing_thresh, false);

// Check the value
if(quality_mark_thresh < 0 || quality_mark_thresh > 15) {
mlog << Warning << "\nIODA2NCConfInfo::process_config() -> "
Expand All @@ -165,11 +167,8 @@ void IODA2NCConfInfo::process_config() {
<< ") should be set between 0 and 15.\n\n";
}

// Conf: obs_name_map
obs_name_map = parse_conf_obs_name_map(&conf);
// Conf: message_type_map
message_type_map = parse_conf_message_type_map(&conf);
metadata_map = parse_conf_metadata_map(&conf);
obs_to_qc_map = parse_conf_obs_to_qc_map(&conf);

return;
}
Expand Down
11 changes: 3 additions & 8 deletions src/tools/other/ioda2nc/ioda2nc_conf_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
#include "vx_util.h"
#include "vx_cal.h"
#include "vx_math.h"
#include "ioda_data_conf_info.h"

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

class IODA2NCConfInfo {
class IODA2NCConfInfo : public IODADataConfInfo {

private:

Expand All @@ -33,7 +34,6 @@ class IODA2NCConfInfo {
public:

// IODA2NC configuration object
MetConfig conf;

// Store data parsed from the IODA2NC configuration object
StringArray message_type; // Obseration message type
Expand All @@ -49,15 +49,11 @@ class IODA2NCConfInfo {
double end_elev;
double beg_level; // Range of level values to be retained
double end_level;
StringArray obs_var; // IODA variiable names
StringArray obs_var; // IODA variable names
int quality_mark_thresh; // Quality marks to be retained
ThreshArray missing_thresh; // Fill value thresh array
ConcatString version; // Config file version

std::map<ConcatString,ConcatString> obs_name_map;
std::map<ConcatString,ConcatString> message_type_map;
std::map<ConcatString,StringArray> metadata_map;
std::map<ConcatString,StringArray> obs_to_qc_map;
StringArray surface_message_types;
TimeSummaryInfo timeSummaryInfo;

Expand All @@ -66,7 +62,6 @@ class IODA2NCConfInfo {

void clear();

std::map<ConcatString,ConcatString> getObsVarMap() const { return obs_name_map; }
std::map<ConcatString,ConcatString> getMessageTypeMap() const { return message_type_map; }
TimeSummaryInfo getSummaryInfo() const { return timeSummaryInfo; };

Expand Down

0 comments on commit 922b3ce

Please sign in to comment.