Skip to content

Commit

Permalink
Per #1904, simplify variable names.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway committed Sep 28, 2021
1 parent 3b9a0d5 commit 9c65882
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
16 changes: 8 additions & 8 deletions met/src/tools/other/gen_ens_prod/gen_ens_prod.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ void process_command_line(int argc, char **argv) {
conf_info.process_config(etype);

// Allocate arrays to store threshold counts
thresh_cnt_na = new NumArray [conf_info.get_max_n_cat_ta()];
thresh_nbrhd_cnt_na = new NumArray * [conf_info.get_max_n_cat_ta()];
thresh_cnt_na = new NumArray [conf_info.get_max_n_cat()];
thresh_nbrhd_cnt_na = new NumArray * [conf_info.get_max_n_cat()];

for(i=0; i<conf_info.get_max_n_cat_ta(); i++) {
for(i=0; i<conf_info.get_max_n_cat(); i++) {
thresh_nbrhd_cnt_na[i] = new NumArray [conf_info.get_n_nbrhd()];
}

Expand Down Expand Up @@ -228,7 +228,7 @@ void process_grid(const Grid &fcst_grid) {

// Parse regridding logic
RegridInfo ri;
if(conf_info.get_n_ens_var() > 0) {
if(conf_info.get_n_var() > 0) {
ri = conf_info.ens_info[0]->regrid();
}
else {
Expand Down Expand Up @@ -305,7 +305,7 @@ void process_ensemble() {
unixtime max_init_ut = bad_data_ll;

// Loop through each of the ensemble fields to be processed
for(i_var=0; i_var<conf_info.get_n_ens_var(); i_var++) {
for(i_var=0; i_var<conf_info.get_n_var(); i_var++) {

mlog << Debug(2) << "\n" << sep_str << "\n\n"
<< "Processing ensemble field: "
Expand Down Expand Up @@ -417,7 +417,7 @@ void clear_counts() {
sum_na.set_const(0.0, nxy);
ssq_na.set_const(0.0, nxy);
stdev_cnt_na.set_const(0.0, nxy);
for(i=0; i<conf_info.get_max_n_cat_ta(); i++) {
for(i=0; i<conf_info.get_max_n_cat(); i++) {
thresh_cnt_na[i].set_const(0.0, nxy);
for(j=0; j<conf_info.get_n_nbrhd(); j++) {
thresh_nbrhd_cnt_na[i][j].set_const(0.0, nxy);
Expand Down Expand Up @@ -960,14 +960,14 @@ void clean_up() {

// Deallocate threshold count arrays
if(thresh_cnt_na) {
for(i=0; i<conf_info.get_max_n_cat_ta(); i++) {
for(i=0; i<conf_info.get_max_n_cat(); i++) {
thresh_cnt_na[i].clear();
}
delete [] thresh_cnt_na;
thresh_cnt_na = (NumArray *) 0;
}
if(thresh_nbrhd_cnt_na) {
for(i=0; i<conf_info.get_max_n_cat_ta(); i++) {
for(i=0; i<conf_info.get_max_n_cat(); i++) {
for(j=0; j<conf_info.get_n_nbrhd(); j++) {
thresh_nbrhd_cnt_na[i][j].clear();
}
Expand Down
12 changes: 5 additions & 7 deletions met/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ void GenEnsProdConfInfo::clear() {
version.clear();

// Reset counts
n_ens_var = 0;
max_n_cat_ta = 0;
n_nbrhd = 0;
n_var = 0;
max_n_cat = 0;

return;
}
Expand Down Expand Up @@ -127,15 +126,15 @@ void GenEnsProdConfInfo::process_config(GrdFileType etype) {
edict = conf.lookup_array(conf_key_ens_field);

// Determine the number of ensemble fields to be processed
if((n_ens_var = parse_conf_n_vx(edict)) == 0) {
if((n_var = parse_conf_n_vx(edict)) == 0) {
mlog << Error << "\nGenEnsProdConfInfo::process_config() -> "
<< "At least one field must be specified in the \""
<< conf_key_ens_field << "\" dictionary!\n\n";
exit(1);
}

// Parse the ensemble field information
for(i=0,max_n_cat_ta=0; i<n_ens_var; i++) {
for(i=0,max_n_cat=0; i<n_var; i++) {

// Allocate new VarInfo object
ens_info.push_back(info_factory.new_var_info(etype));
Expand Down Expand Up @@ -167,7 +166,7 @@ void GenEnsProdConfInfo::process_config(GrdFileType etype) {
}

// Keep track of the maximum number of thresholds
if(cat_ta[i].n() > max_n_cat_ta) max_n_cat_ta = cat_ta[i].n();
if(cat_ta[i].n() > max_n_cat) max_n_cat = cat_ta[i].n();

// Conf: ensemble_flag
nc_info.push_back(parse_nc_info(&i_edict));
Expand Down Expand Up @@ -197,7 +196,6 @@ void GenEnsProdConfInfo::process_config(GrdFileType etype) {

// Conf: nbrhd_prob
nbrhd_prob = parse_conf_nbrhd(edict, conf_key_nbrhd_prob);
n_nbrhd = nbrhd_prob.width.n();

// Conf: nmep_smooth
nmep_smooth = parse_conf_interp(edict, conf_key_nmep_smooth);
Expand Down
19 changes: 9 additions & 10 deletions met/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ class GenEnsProdConfInfo {
void init_from_scratch();

// Ensemble processing
int n_ens_var; // Number of ensemble fields to be processed
int max_n_cat_ta; // Maximum number of ensemble thresholds
int n_nbrhd; // Number of neighborhood sizes
int n_var; // Number of ensemble fields to be processed
int max_n_cat; // Maximum number of ensemble thresholds

public:

Expand Down Expand Up @@ -102,18 +101,18 @@ class GenEnsProdConfInfo {
GenEnsProdNcOutInfo parse_nc_info(Dictionary *);

// Accessor functions
int get_n_ens_var() const;
int get_max_n_cat_ta() const;
int get_n_nbrhd() const;
int get_n_var() const;
int get_max_n_cat() const;
int get_n_nbrhd() const;
int get_compression_level();
};

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

inline int GenEnsProdConfInfo::get_n_ens_var() const { return(n_ens_var); }
inline int GenEnsProdConfInfo::get_max_n_cat_ta() const { return(max_n_cat_ta); }
inline int GenEnsProdConfInfo::get_n_nbrhd() const { return(n_nbrhd); }
inline int GenEnsProdConfInfo::get_compression_level() { return(conf.nc_compression()); }
inline int GenEnsProdConfInfo::get_n_var() const { return(n_var); }
inline int GenEnsProdConfInfo::get_max_n_cat() const { return(max_n_cat); }
inline int GenEnsProdConfInfo::get_n_nbrhd() const { return(nbrhd_prob.width.n()); }
inline int GenEnsProdConfInfo::get_compression_level() { return(conf.nc_compression()); }

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

Expand Down

0 comments on commit 9c65882

Please sign in to comment.