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

Warn user if var_order_menu does not match used variables #1466

Merged
merged 1 commit into from
Jan 6, 2025
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
19 changes: 19 additions & 0 deletions pyaerocom/aeroval/setup_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
computed_field,
field_serializer,
field_validator,
model_validator,
)

from pyaerocom import __version__, const
Expand Down Expand Up @@ -356,6 +357,24 @@ class EvalSetup(BaseModel):

_aux_funs: dict = {}

@model_validator(mode="after")
def model_validator(self) -> Self:
# Warn user if var_order_menu does not match used variables.
var_order_menu = set(self.webdisp_opts.var_order_menu)
obs_cfg = self.obs_cfg

variables = set()
for entry in obs_cfg:
for var in entry.obs_vars:
variables.add(var)

if not var_order_menu.issuperset(variables):
logger.warning(
f"Some variables are configured as obsvars but not included in var_order_menu. They may not show up on aerovalweb. Missing variables: {list(variables - var_order_menu)}"
)

return self

@computed_field
@cached_property
def proj_info(self) -> ProjectInfo:
Expand Down
Loading