Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 1936 madis nc #1963

Closed
wants to merge 10 commits into from
Closed
3 changes: 3 additions & 0 deletions met/data/config/Madis2NcConfig_default
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
// when the obs name is given instead of grib_code
//

// Removed following variables from 2017
mesonet_opt_var = [ "precip3hr", "precip6hr", "precip12hr", "precip10min" ];

time_summary = {
flag = FALSE;
raw_data = FALSE;
Expand Down
12 changes: 11 additions & 1 deletion met/docs/Users_Guide/reformat_point.rst
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ Optional arguments for madis2nc
An example of the madis2nc calling sequence is shown below:

.. code-block:: none

madis2nc sample_madis_obs.nc \
sample_madis_obs_met.nc -log madis.log -v 3

Expand All @@ -704,6 +704,16 @@ _________________

The configuration options listed above are common to many MET tools and are described in :numref:`config_options`.

_________________


.. code-block:: none

mesonet_opt_var = [ "precip3hr", "precip6hr", "precip12hr", "precip10min" ];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
mesonet_opt_var = [ "precip3hr", "precip6hr", "precip12hr", "precip10min" ];
mesonet_opt_var = [ "precip3hr", "precip6hr", "precip12hr", "precip10min" ];



This entry is an array of variables which are optional variables for the MESONET input data. Above variables are not available from sometime in 2016.

__________________


Expand Down
6 changes: 6 additions & 0 deletions met/src/basic/vx_config/config_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,12 @@ static const char conf_key_nc_output [] = "nc_output";
static const char conf_key_txt_output [] = "txt_output";
static const char conf_key_do_polylines_flag [] = "do_polylines";

//
// MADIS2NC specific parameter key names
//

static const char conf_key_mesonet_opt_var[] = "mesonet_opt_var";

//
// PB2NC specific parameter key names
//
Expand Down
278 changes: 131 additions & 147 deletions met/src/tools/other/madis2nc/madis2nc.cc

Large diffs are not rendered by default.

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
12 changes: 12 additions & 0 deletions test/xml/unit_madis2nc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@
</output>
</test>

<test name="madis2nc_MESONET_optional_vars">
<exec>&MET_BIN;/madis2nc</exec>
<param> \
&DATA_DIR_OBS;/madis/mesonet/mesonet_20170101_0000.nc \
&OUTPUT_DIR;/madis2nc/mesonet_20170101_0000_F000.nc \
-type mesonet -mask_grid G207 -v 2
</param>
<output>
<point_nc>&OUTPUT_DIR;/madis2nc/mesonet_20170101_0000_F000.nc</point_nc>
</output>
</test>

<test name="madis2nc_ACARS_PROFILES">
<exec>&MET_BIN;/madis2nc</exec>
<param> \
Expand Down