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 #2357 wind #2358

Merged
merged 1 commit into from
Nov 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions src/libcode/vx_data2d/var_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,21 @@ void VarInfo::set_dict(Dictionary &dict) {
SetAttrIsProb =
parse_set_attr_flag(dict, conf_key_is_prob);

// At most one wind attribute flag can be set
n = 0;
if(SetAttrIsUWind == 1) n++;
if(SetAttrIsVWind == 1) n++;
if(SetAttrIsWindSpeed == 1) n++;
if(SetAttrIsWindDirection == 1) n++;
if(n > 1) {
mlog << Error << "\nVarInfo::set_dict() -> "
<< "At most one wind attribute flag ("
<< conf_key_is_u_wind << ", " << conf_key_is_v_wind << ", "
<< conf_key_is_wind_speed << ", " << conf_key_is_wind_direction
<< ") can be set to true for each field.\n\n";
exit(1);
}

return;
}

Expand Down Expand Up @@ -790,22 +805,21 @@ int parse_set_attr_flag(Dictionary &dict, const char *key) {
}

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

////////////////////////////////////////////////////////////////////////
//
// Code for class EnsVarInfo
//
////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

EnsVarInfo::EnsVarInfo() {
ctrl_info = NULL;
}

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

EnsVarInfo::~EnsVarInfo() {
clear();
}

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

EnsVarInfo::EnsVarInfo(const EnsVarInfo &f) {
Expand All @@ -815,7 +829,7 @@ EnsVarInfo::EnsVarInfo(const EnsVarInfo &f) {
assign(f);
}

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

void EnsVarInfo::clear() {
vector<InputInfo>::const_iterator it;
Expand All @@ -841,25 +855,25 @@ void EnsVarInfo::assign(const EnsVarInfo &v) {
return;
}

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

void EnsVarInfo::add_input(InputInfo input) {
inputs.push_back(input);
}

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

int EnsVarInfo::inputs_n() {
return inputs.size();
}

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

void EnsVarInfo::set_ctrl(VarInfo * ctrl) {
ctrl_info = ctrl;
}

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

VarInfo * EnsVarInfo::get_ctrl(int index) {
if(ctrl_info) {
Expand All @@ -868,7 +882,7 @@ VarInfo * EnsVarInfo::get_ctrl(int index) {
return inputs[index].var_info;
}

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

VarInfo * EnsVarInfo::get_var_info(int index) {
if(inputs[index].var_info) {
Expand All @@ -877,26 +891,26 @@ VarInfo * EnsVarInfo::get_var_info(int index) {
return inputs[0].var_info;
}

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

ConcatString EnsVarInfo::get_file(int index) {
int file_index = inputs[index].file_index;
return (*inputs[index].file_list)[file_index];
}

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

int EnsVarInfo::get_file_index(int index) {
return inputs[index].file_index;
}

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

ConcatString EnsVarInfo::get_ens_member_id(int index) {
return inputs[index].ens_member_id;
}

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

ConcatString raw_magic_str(Dictionary i_edict, GrdFileType file_type) {
ConcatString magic_str;
Expand Down