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

Add intersphinx mapping #77

Merged
merged 4 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"numpydoc",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx_click",
]

Expand Down Expand Up @@ -95,7 +96,12 @@
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

# prolog for all rst files
# Intersphinx configuration
intersphinx_mapping = {
"pyam": ("https://pyam-iamc.readthedocs.io/en/stable/", None),
}

# Prolog for all rst files
rst_prolog = """

.. |br| raw:: html
Expand Down
20 changes: 11 additions & 9 deletions doc/source/getting_started.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.. _getting-started:

.. currentmodule:: nomenclature

Getting started
===============

Expand All @@ -10,13 +12,13 @@ processing, which consists of renaming of model “native regions” and aggrega
“common regions” used in a project.

There are two main classes that the user interacts with when using the nomenclature
package, **DataStructureDefinition** and **RegionProcessor** (a full list of all classes can be found in :ref:`api`).
package, :class:`DataStructureDefinition` and :class:`RegionProcessor`.
danielhuppmann marked this conversation as resolved.
Show resolved Hide resolved

A **DataStructureDefinition** contains codelists which define allowed *variables*
A :class:`DataStructureDefinition` contains codelists which define allowed *variables*
(including units) and *regions* to be used in a model comparison or scenario exercise
following the IAMC data format.

A **RegionProcessor** is used to facilitate region processing for model comparison
A :class:`RegionProcessor` is used to facilitate region processing for model comparison
studies. It holds a list of model specific mappings which define renaming of native
regions and aggregation to common regions.

Expand Down Expand Up @@ -101,14 +103,14 @@ The following outlines how to use the nomenclature package:

**Notes**

* The pyam library is required as *process* takes a *pyam.IamDataFrame* as input.
* The function :func:`process` takes a :class:`pyam.IamDataFrame` as input.

* *DataStructureDefinition* and *RegionProcessor* are initialized from directories
containing yaml files. See :ref:`dir-structure` for details.
* :class:`DataStructureDefinition` and :class:`RegionProcessor` are initialized from
directories containing yaml files. See :ref:`dir-structure` for details.

* The processor argument of *process* is optional and may only to be used if there are
model mappings. See :ref:`toplevel-functions` for details.
* The processor argument of func:`process` is optional and may only to be used if there
are model mappings. See :ref:`toplevel-functions` for details.

* If not all dimensions of the **DataStructureDefinition** should be validated, a
* If not all dimensions of the :class:`DataStructureDefinition` should be validated, a
*dimensions* argument in form of a list of strings can be provided. Only the provided
dimensions will then be validated. See :ref:`toplevel-functions` for details.
16 changes: 8 additions & 8 deletions nomenclature/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ def process(

Parameters
----------
df : pyam.IamDataFrame
Input data to be validated and aggregated.
dsd : DataStructureDefinition
df : :class:`pyam.IamDataFrame`
Scenario data to be validated and aggregated.
dsd : :class:`DataStructureDefinition`
Codelists that are used for validation.
dimensions : list, optional
Dimensions to be used in the validation, defaults to all dimensions defined in
*dsd*
processor : RegionProcessor, optional
Region processor that will perform region renaming and aggregation if provided
`dsd`
processor : :class:`RegionProcessor`, optional
Region processor to perform region renaming and aggregation (if given)
danielhuppmann marked this conversation as resolved.
Show resolved Hide resolved

Returns
-------
pyam.IamDataFrame
Processed data frame
:class:`pyam.IamDataFrame`
Processed scenario data
"""
# The deep copy is needed so we don't alter dsd in dimensions.remove("region")
dimensions = copy.deepcopy(dimensions or dsd.dimensions)
Expand Down
5 changes: 2 additions & 3 deletions nomenclature/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ def validate(self, df: IamDataFrame, dimensions: list = None) -> None:

Parameters
----------
df : IamDataFrame
An IamDataFrame to be validated against the codelists of this
DataStructureDefinition.
df : :class:`pyam.IamDataFrame`
Scenario data to be validated against the codelists of this instance.
dimensions : list of str, optional
Dimensions to perform validation (defaults to all dimensions of self)

Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ docs =
sphinx-click
numpydoc

[flake8]
max-line-length = 88

[options.entry_points]
console_scripts =
nomenclature = nomenclature:cli

[flake8]
max-line-length = 88