From 6851ff85016fadc5c76683bcc8c210d681e0bb0c Mon Sep 17 00:00:00 2001 From: David Almeida Date: Tue, 7 Apr 2026 11:52:38 +0200 Subject: [PATCH 1/5] Move DataValidator and RequiredDataValidator documentation to API section --- docs/api.rst | 2 ++ .../datavalidator.rst} | 9 +++++---- .../requireddatavalidator.rst} | 13 +++++++------ docs/user_guide/validation.rst | 17 ----------------- 4 files changed, 14 insertions(+), 27 deletions(-) rename docs/{user_guide/validation/data-validation.rst => api/datavalidator.rst} (95%) rename docs/{user_guide/validation/required-data-validation.rst => api/requireddatavalidator.rst} (87%) delete mode 100644 docs/user_guide/validation.rst diff --git a/docs/api.rst b/docs/api.rst index c45b47a9..185bec7c 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -13,6 +13,8 @@ API documentation api/datastructureconfig api/codelist api/regionprocessor + api/datavalidator + api/requireddatavalidator api/countries api/nuts api/testing diff --git a/docs/user_guide/validation/data-validation.rst b/docs/api/datavalidator.rst similarity index 95% rename from docs/user_guide/validation/data-validation.rst rename to docs/api/datavalidator.rst index e86360d8..2a9ecba5 100644 --- a/docs/user_guide/validation/data-validation.rst +++ b/docs/api/datavalidator.rst @@ -2,8 +2,8 @@ .. currentmodule:: nomenclature -Data validation -=============== +**DataValidator** +================= **Data validation** checks if timeseries data values are within specified ranges. @@ -67,8 +67,6 @@ tolerance of 1 to the value of 2, with warning level ``error`` by default. Standard usage -------------- -Run the following in a Python script to check that an IAMC dataset has valid data. - .. code-block:: python from nomenclature.processor import DataValidator @@ -76,3 +74,6 @@ Run the following in a Python script to check that an IAMC dataset has valid dat # ...setting directory/file paths and loading dataset DataValidator.from_file(data_val_yaml).apply(df) + +.. autoclass:: DataValidator + :members: from_file, from_codelist, apply diff --git a/docs/user_guide/validation/required-data-validation.rst b/docs/api/requireddatavalidator.rst similarity index 87% rename from docs/user_guide/validation/required-data-validation.rst rename to docs/api/requireddatavalidator.rst index 1631c09f..38d9a844 100644 --- a/docs/user_guide/validation/required-data-validation.rst +++ b/docs/api/requireddatavalidator.rst @@ -2,10 +2,10 @@ .. currentmodule:: nomenclature -Required data validation -======================== +**RequiredDataValidator** +========================= -**Required data validation** checks if certain models, variables, regions and/or +**Required data validation** checks if certain models, variables, regions and/or periods of time are covered in the timeseries data. For this, a configuration file specifies the model(s) and dimension(s) expected @@ -31,9 +31,6 @@ years 2020, 2030, 2040 and 2050. Standard usage -------------- -Run the following in a Python script to check that an IAMC dataset has valid -required data. - .. code-block:: python from nomenclature import RequiredDataValidator @@ -41,3 +38,7 @@ required data. # ...setting directory/file paths and loading dataset RequiredDataValidator.from_file(req_data_yaml).apply(df) + + +.. autoclass:: RequiredDataValidator + :members: from_file, apply diff --git a/docs/user_guide/validation.rst b/docs/user_guide/validation.rst deleted file mode 100644 index f118a86e..00000000 --- a/docs/user_guide/validation.rst +++ /dev/null @@ -1,17 +0,0 @@ -.. _validation: - -.. currentmodule:: nomenclature - -Validation -========== - -The **nomenclature** package allows users to validate IAMC data in several ways. - -For this, validation requirements and criteria can be specified in YAML configuration -files. - -.. toctree:: - :maxdepth: 1 - - validation/data-validation - validation/required-data-validation From 0f5806d190978ac3e42ff5156089cf65b21221e0 Mon Sep 17 00:00:00 2001 From: David Almeida Date: Tue, 14 Apr 2026 15:08:28 +0200 Subject: [PATCH 2/5] Fix docstring --- nomenclature/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nomenclature/cli.py b/nomenclature/cli.py index 2e041c6d..c916eb39 100644 --- a/nomenclature/cli.py +++ b/nomenclature/cli.py @@ -230,8 +230,8 @@ def run_workflow( input_file : Path Input data file, must be IAMC format, .xlsx or .csv workflow_file : Path - Path to the workflow file, - default: current working directory / "workflow.py" + Path to the workflow file, + default: current working directory / "workflow.py" workflow_function : str Name of the workflow function inside the workflow file, default: main output_file : Path | None From 618f9fde17a5cbbd3879dc7f4eb67f304295154e Mon Sep 17 00:00:00 2001 From: David Almeida Date: Tue, 14 Apr 2026 15:20:19 +0200 Subject: [PATCH 3/5] Add typing to cli --- nomenclature/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nomenclature/cli.py b/nomenclature/cli.py index c916eb39..e97a18a7 100644 --- a/nomenclature/cli.py +++ b/nomenclature/cli.py @@ -252,7 +252,7 @@ def run_workflow( if not hasattr(workflow, workflow_function): raise ValueError(f"{workflow} does not have a function `{workflow_function}`") - df = getattr(workflow, workflow_function)(IamDataFrame(input_file)) + df: IamDataFrame = getattr(workflow, workflow_function)(IamDataFrame(input_file)) if output_file is not None: df.to_excel(output_file) From c8f3e2d58357ad8bc3d7e247c4ab7b7240a16e60 Mon Sep 17 00:00:00 2001 From: David Almeida Date: Tue, 14 Apr 2026 15:46:57 +0200 Subject: [PATCH 4/5] Fix docs (#520) --- docs/api/regionprocessor.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/regionprocessor.rst b/docs/api/regionprocessor.rst index d6ed5337..dbde9bf5 100644 --- a/docs/api/regionprocessor.rst +++ b/docs/api/regionprocessor.rst @@ -4,4 +4,4 @@ =================== .. autoclass:: RegionProcessor - :members: from_directory, validate_with_definition, apply, check_region_aggregation + :members: from_directory, apply, check_region_aggregation, revert From 6578184c0e8ed15b5d3e282dfb9a3c689e142921 Mon Sep 17 00:00:00 2001 From: David Almeida Date: Tue, 14 Apr 2026 15:57:11 +0200 Subject: [PATCH 5/5] Update `RequiredDataValidator` documentation (#516) --- docs/api/requireddatavalidator.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/requireddatavalidator.rst b/docs/api/requireddatavalidator.rst index 38d9a844..fc5286fa 100644 --- a/docs/api/requireddatavalidator.rst +++ b/docs/api/requireddatavalidator.rst @@ -41,4 +41,4 @@ Standard usage .. autoclass:: RequiredDataValidator - :members: from_file, apply + :members: from_file, apply, check_required_data_per_model, validate_with_definition