Skip to content

Commit

Permalink
Create subpages and ToC
Browse files Browse the repository at this point in the history
  • Loading branch information
David Almeida committed Feb 3, 2025
1 parent fcc2d55 commit f247022
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 39 deletions.
2 changes: 1 addition & 1 deletion docs/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ the RegionProcessor and validated using DataStructureDefinition.
user_guide/model-registration
user_guide/config
user_guide/local-usage
user_guide/data-validation
user_guide/validation
17 changes: 17 additions & 0 deletions docs/user_guide/validation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. _validation:

.. currentmodule:: nomenclature

Data 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,6 @@
Data 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.

Required data validation
------------------------

**Required data validation** checks if certain models, variables, regions and/or
periods of time are covered in the datapoints.

For this, a configuration file specifies the model(s) and dimension(s) expected
in the dataset. These are ``variable``, ``region`` and/or ``year``.
Alternatively, instead of using ``variable``, it is possible to declare measurands,
which jointly specify variables and units.

.. code:: yaml
description: Required variables for running MAGICC
model: model_a
required_data:
- measurand:
Emissions|CO2:
unit: Mt CO2/yr
region: World
year: [2020, 2030, 2040, 2050]
In the example above, for *model_a*, the dataset must include datapoints of the
variable *Emissions|CO2* (measured in *Mt CO2/yr*), in the region *World*, for the
years 2020, 2030, 2040 and 2050.

Data validation
---------------

**Data validation** checks if data values are within specified ranges.

Consider the example below:
Expand Down Expand Up @@ -87,15 +53,12 @@ a separate criteria item) and slower to process.
Standard usage
--------------

Run the following in a Python script to check that an IAMC dataset has valid
(required) data.
Run the following in a Python script to check that an IAMC dataset has valid data.

.. code-block:: python
from nomenclature import RequiredDataValidator
from nomenclature.processor import DataValidator
# ...setting directory/file paths and loading dataset
RequiredDataValidator.from_file(req_data_yaml).apply(df)
DataValidator.from_file(data_val_yaml).apply(df)
43 changes: 43 additions & 0 deletions docs/user_guide/validation/required-data-validation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.. _required-data-validation:

.. currentmodule:: nomenclature

Required data validation
========================

**Required data validation** checks if certain models, variables, regions and/or
periods of time are covered in the datapoints.

For this, a configuration file specifies the model(s) and dimension(s) expected
in the dataset. These are ``variable``, ``region`` and/or ``year``.
Alternatively, instead of using ``variable``, it is possible to declare measurands,
which jointly specify variables and units.

.. code:: yaml
description: Required variables for running MAGICC
model: model_a
required_data:
- measurand:
Emissions|CO2:
unit: Mt CO2/yr
region: World
year: [2020, 2030, 2040, 2050]
In the example above, for *model_a*, the dataset must include datapoints of the
variable *Emissions|CO2* (measured in *Mt CO2/yr*), in the region *World*, for the
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
# ...setting directory/file paths and loading dataset
RequiredDataValidator.from_file(req_data_yaml).apply(df)

0 comments on commit f247022

Please sign in to comment.