Skip to content

Commit

Permalink
if no modules or model name are provided, model name is empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraney committed Jul 25, 2023
1 parent 7b59a64 commit 2f81833
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions python/ngen_conf/src/ngen/config/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MultiBMI(BMIParams, smart_union=True):
# NOTE this is derived from the list of modules
main_output_variable: Optional[str]
#NOTE aliases don't propagate to subclasses, so we have to repeat the alias
model_name: str = Field(alias="model_type_name")
model_name: str = Field(None, alias="model_type_name")

#override const since these shouldn't be used for multi bmi, but are currently
#required to exist as keys for ngen
Expand All @@ -40,8 +40,9 @@ def resolve_paths(self, relative_to: Optional['Path']=None):
def build_model_name(cls, values: Mapping[str, Any]):
"""Construct the model name, if none provided.
If no model name is provided, the multiBMI model_type_name
is constructed by joining each module's name using `_`
If no model name is provided, the multiBMI model_type_name is constructed by joining
each module's name using `_`. If no module's are provided, model name is the empty
string ''.
Args:
values (Mapping[str, Any]): Attributes to assgign to the class, including all defaults
Expand All @@ -62,6 +63,8 @@ def build_model_name(cls, values: Mapping[str, Any]):
except KeyError:
names.append(m['params']['model_type_name'])
values['model_name'] = '_'.join( names )
elif not name:
values['model_name'] = ''
return values

@root_validator(pre=True)
Expand Down

0 comments on commit 2f81833

Please sign in to comment.