Skip to content

Conversation

@dayantur
Copy link

@dayantur dayantur commented Nov 12, 2025

Overview

Add comprehensive documentation tracking all validation rules in the SUEWS validator codebase.

CSV Files

  1. parameters_to_ruleclass.csv
  • Main reference: all parameters
  • Columns: parameter_name; category; sub-model; pipeline; rule_class; should be consistent with; additional notes
  • Classification: C0 (fundamental), C1 (physical ranges), C2 (complex/cross-parameters), CM (no validation)
  • Parameters can have combined C0/C1 + C2 rules
  1. C0_rulebook.csv
  • All C0 rules are collected here
  1. C1_rulebook.csv
  • All C1 rules are collected here
  1. C2_rulebook.csv
  • All C2 rules are collected here

Next

  • CSVs should become .md files for developers detailed documentation, and then referenced in the read-the-docs

@dayantur dayantur self-assigned this Nov 12, 2025
Co-authored-by: dayantur <71443948+dayantur@users.noreply.github.com>
@github-actions
Copy link

🤖 I've automatically formatted the code in this PR using:

  • Python: ruff v0.8.6
  • Fortran: fprettify v0.3.7

Please pull the latest changes before making further edits.

@dayantur dayantur changed the title Dayantur/feat/documenting all range rules Doc: Add comprehensive validation rules catalog for validator pipeline Nov 12, 2025
@github-actions
Copy link

🤖 I've automatically formatted the code in this PR using:

  • Python: ruff v0.8.6
  • Fortran: fprettify v0.3.7

Please pull the latest changes before making further edits.

dayantur and others added 2 commits November 14, 2025 15:22
Co-authored-by: dayantur <71443948+dayantur@users.noreply.github.com>
@github-actions
Copy link

🤖 I've automatically formatted the code in this PR using:

  • Python: ruff v0.8.6
  • Fortran: fprettify v0.3.7

Please pull the latest changes before making further edits.

c2_rulebook.csv Outdated
A,cross_parameter,nlayer_dimension_match,nlayer specified,"validates vertical-layer array dimensions vs nlayer: veg_frac/veg_scale/building_frac/building_scale must have nlayer elements; height must have nlayer+1; roofs/walls must contain nlayer substructures. If too short, pads with nulls (or null-template substructures) and records dimension_errors; if too long, records error (does not trim).",phase_a.py:validate_nlayer_dimensions,nlayer; veg_frac; veg_scale; building_frac; building_scale; height,nlayer; veg_frac; veg_scale; building_frac; building_scale; height,
A,data_validation,forcing_data_validation,forcing_file specified,"validates forcing data file(s) referenced in YAML: checks existence, handles RefValue/list entries, loads files and runs quality checks (missing critical vars, NaNs, physical ranges, irregular time steps), adds filename context; returns (forcing_errors, forcing_file_paths); can be disabled via --forcing off",phase_a.py:validate_forcing_data,forcing_file,forcing_file,
B,conditional_required,physics_parameters_completeness,always triggered,validates that all critical physics parameters are present and non-null,phase_b.py:validate_physics_parameters,model.physics,model.physics,
B,cross_parameter,model_option_dependencies,always triggered,validates interdependency rules between physics options: rslmethod==2 requires stabilitymethod==3; stabilitymethod==1 requires rslmethod present; storageheatmethod==1 requires ohmincqf==0,phase_b.py:validate_model_option_dependencies,rslmethod; stabilitymethod; storageheatmethod; ohmincqf,rslmethod; stabilitymethod; storageheatmethod; ohmincqf,
Copy link
Author

@dayantur dayantur Dec 1, 2025

Choose a reason for hiding this comment

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

@sunt05 - rule in row 6 covers physics model option dependencies (these need to be removed from here to avoid duplicates with #865 )

c2_rulebook.csv Outdated
B,cross_parameter,dls_calculation,startdls or enddls specified,"validates DOY values for startdls/enddls (consistency both set or both None), enforces DOY range and leap‑year rules (DOY 366 only allowed in leap years when model_year known), compares user values to location‐based calculated DLS and records INFO/WARNING messages; populate startdls/enddls when missing or different from the calculated ones",phase_b.py:validate_dls_doy / DLSCheck helpers,start_time; lat; lng,startdls; enddls,
C/Pydantic,conditional_required,parameter_completeness,always triggered,"validates all site parameters are complete; runs site-by-site checks and conditional validations (STEBBS, RSL, storage)",config.py:validate_parameter_completeness,model.physics; site.properties.,all site properties; all model physics options,
C/Pydantic,conditional_required,stebbs_completeness,stebbsmethod == 1,all STEBBS parameters must be present and non-null when stebbsmethod=1,config.py:_validate_stebbs,stebbsmethod,all STEBBS parameters,
C/Pydantic,conditional_required,rsl_faibldg_required,rslmethod == 2 & bldgs.sfr > 0,"when rslmethod=2 and buildings present (bldgs.sfr > 0), faibldg parameter must be set",config.py:_validate_rsl,rslmethod; bldgs.sfr,faibldg,
Copy link
Author

@dayantur dayantur Dec 1, 2025

Choose a reason for hiding this comment

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

@sunt05 as a different example, rule in row 17, still need to be handled with a dedicated validator/function/rule in config.py

@dayantur
Copy link
Author

dayantur commented Jan 16, 2026

after a feedback from @MatthewPaskin and as discussed with @suegrimmond, each rule will be assigned with a number key, and then referenced both in the code/report and in the doc, so users will be able to:

a - understand what has been checked in their YAML
b - understand where they can find more info about the rule in the docs

to the sake of clarity, I will add the keys here but I will implement this change in the doc in a separate PR, as that will require a bit of more work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant