You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/api/report/index.rst
+82-25Lines changed: 82 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,9 @@ On this page:
9
9
Elsewhere:
10
10
11
11
- ``global.yaml``, the :doc:`default-config`.
12
-
- Documentation for :mod:`genno` (:doc:`genno:index`), :mod:`ixmp.report`, and :mod:`message_ix.report`.
12
+
- Documentation for :mod:`genno` (:doc:`genno:index`),
13
+
:mod:`ixmp.report`, and
14
+
:mod:`message_ix.report`.
13
15
- Reporting for specific model variants:
14
16
15
17
- :mod:`.water.reporting`
@@ -31,41 +33,85 @@ Introduction
31
33
See :doc:`the discussion in the MESSAGEix docs <message-ix:reporting>` about the stack.
32
34
In short, for instance:
33
35
34
-
- :mod:`message_ix` **must not** contain reporting code that references :py:`technology="coal_ppl"`, because not every model built on the MESSAGE framework will have a technology with this name.
35
-
- Any model in the MESSAGEix-GLOBIOM family—built with :mod:`message_ix_models` and/or :mod:`message_data`—**should**, with few exceptions, have a :py:`technology="coal_ppl"`, since this appears in the common list of :ref:`technology-yaml`.
36
-
Reporting specific to this technology ID, *as it is represented* in this model family, should be in :mod:`message_ix_models` or user code.
36
+
- :mod:`message_ix` **must not** contain reporting code that references :py:`technology="coal_ppl"`,
37
+
because not every model built on the MESSAGE framework will have a technology with this name.
38
+
- Any model in the MESSAGEix-GLOBIOM family
39
+
—built with :mod:`message_ix_models` and/or :mod:`message_data`—
40
+
**should**, with few exceptions, have a :py:`technology="coal_ppl"`,
41
+
since this appears in the common list of :ref:`technology-yaml`.
42
+
Reporting specific to this technology ID,
43
+
*as it is represented* in this model family,
44
+
should be in :mod:`message_ix_models` or user code.
37
45
38
46
The basic **design pattern** of :mod:`message_ix_models.report` is:
39
47
40
-
- :func:`~.report.prepare_reporter` populates a new :class:`~.message_ix.Reporter` for a given :class:`.Scenario` with many keys to report all quantities of interest in a MESSAGEix-GLOBIOM–family model.
41
-
- This function relies on *callbacks* defined in multiple submodules to add keys and tasks for general or tailored reporting calculations and actions.
42
-
Additional modules **should** define callback functions and register them with :func:`~report.register` when they are to be used.
48
+
- :func:`~.report.prepare_reporter` populates a new :class:`~.message_ix.Reporter`
49
+
for a given :class:`.Scenario` with many tasks
50
+
to report all quantities of interest in a MESSAGEix-GLOBIOM–family model.
51
+
- This function relies on *callbacks* defined in multiple submodules
52
+
to add keys and tasks for general or tailored reporting calculations and actions.
and register them with :func:`~report.register` when they are to be used.
43
55
For example:
44
56
45
-
1. The module :mod:`message_ix_models.report.plot` defines :func:`.plot.callback` that adds standard plots to the Reporter.
46
-
2. The module :mod:`message_data.model.transport.report` defines :func:`~.message_data.model.transport.report.callback` that adds tasks specific to MESSAGEix-Transport.
47
-
3. The module :mod:`message_data.projects.navigate.report` defines :func:`~.message_data.projects.navigate.report.callback` that add tasks specific to the ‘NAVIGATE’ research project.
48
-
49
-
The callback (1) is always registered, because these plots are always applicable and can be expected to function correctly for all models in the family. In contrast, (2) and (3) **should** only be registered and run for the specific model variants for which they are developed/intended.
50
-
51
-
Modules with tailored reporting configuration **may** also be indicated on the :ref:`command line <report-cli>` by using the :program:`-m/--modules` option: :program:`mix-models report -m model.transport`.
52
-
53
-
- A file :file:`global.yaml` file (in `YAML <https://en.wikipedia.org/wiki/YAML#Example>`_ format) contains a description of some of the reporting computations needed for a MESSAGE-GLOBIOM model.
54
-
:func:`~.report.prepare_reporter` uses the :doc:`configuration handlers <genno:config>` built into :mod:`genno` (and some extensions specific to :mod:`message_ix_models`) to handle the different sections of the file.
57
+
1. The module :mod:`message_ix_models.report.plot` defines :func:`.plot.callback`
58
+
that adds standard plots to the Reporter.
59
+
2. The module :mod:`message_ix_models.model.transport.report` defines :func:`~.transport.report.callback`
60
+
that adds tasks specific to the MESSAGEix-Transport model variant.
61
+
3. The module :mod:`message_ix_models.project.navigate.report` defines :func:`~.navigate.report.callback`
62
+
that add tasks specific to the ‘NAVIGATE’ research project.
63
+
64
+
The callback (1) is always registered,
65
+
because these plots are always applicable and can be expected to function correctly
66
+
for all models in the family.
67
+
In contrast, (2) and (3) **should** only be registered and run
68
+
for the specific model variants for which they are developed/intended.
69
+
70
+
Modules with tailored reporting configuration **may** also be indicated
71
+
on the :ref:`command line <report-cli>`
72
+
by using the :program:`-m/--modules` option:
73
+
:program:`mix-models report -m model.transport`.
74
+
75
+
- A file :file:`global.yaml`
76
+
(in `YAML <https://en.wikipedia.org/wiki/YAML#Example>`_ format)
77
+
contains a description of some of the reporting computations
78
+
needed for a MESSAGE-GLOBIOM model.
79
+
:func:`~.report.prepare_reporter` uses the :doc:`configuration handlers <genno:config>`
80
+
built into :mod:`genno`
81
+
(and some extensions specific to :mod:`message_ix_models`)
82
+
to handle the different sections of the file.
55
83
56
84
Features
57
85
========
58
86
59
-
By combining these genno, ixmp, message_ix, and message_ix_models features, the following functionality is provided.
87
+
By combining these genno, ixmp, message_ix, and message_ix_models features,
88
+
the following functionality is provided.
60
89
61
90
.. note:: If any of this does not appear to work as advertised, file a bug!
62
91
92
+
Scope of :mod:`genno`-based vs. :mod:`.legacy` reporting
The following functions, defined elsewhere, are exposed through :mod:`.operator` and so can also be referenced by name:
182
+
The following functions, defined elsewhere,
183
+
are exposed through :mod:`.operator`
184
+
and so can also be referenced by name:
137
185
138
186
.. autosummary::
139
187
@@ -255,11 +303,20 @@ Testing
255
303
Continuous reporting
256
304
--------------------
257
305
258
-
As part of the :ref:`test-suite`, reporting is run on the same events (pushes and daily schedule) on publicly-available :doc:`model snapshots </api/model-snapshot>`.
259
-
One goal of these tests *inter alia* is to ensure that adjustments and improvements to the reporting code do not disturb manually-verified model outputs.
260
-
261
-
As part of the (private) :mod:`message_data` test suite, multiple workflows run on regular schedules; some of these include a combination of :mod:`message_ix_models`-based and :ref:`‘legacy’ reporting <report-legacy>`.
306
+
As part of the :ref:`test-suite`, reporting is run on the same events
307
+
(pushes and daily schedule)
308
+
on publicly-available :doc:`model snapshots </api/model-snapshot>`.
309
+
One goal of these tests *inter alia* is to ensure that adjustments
310
+
and improvements to the reporting code
311
+
do not disturb manually-verified model outputs.
312
+
313
+
As part of the (private) :mod:`message_data` test suite,
314
+
multiple workflows run on regular schedules;
315
+
some of these include a combination of :mod:`message_ix_models`-based
316
+
and :ref:`‘legacy’ reporting <report-legacy>`.
262
317
These workflows:
263
318
264
319
- Operate on specific scenarios within IIASA databases.
265
-
- Create files in CSV, Excel, and/or PDF formats that are that are preserved and made available as 'build artifacts' via the GitHub Actions web interface and API.
320
+
- Create files in CSV, Excel, and/or PDF formats
321
+
that are that are preserved and made available as 'build artifacts'
0 commit comments