Skip to content

Commit

Permalink
Expand doc/whatsnew with improvements from #60
Browse files Browse the repository at this point in the history
  • Loading branch information
khaeru committed Apr 20, 2022
1 parent a50c23d commit 3f9b31d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
10 changes: 9 additions & 1 deletion doc/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ The :func:`.handles` decorator can be used to mark a custom function that handle
Specific sections
=================

.. _config-aggregate:

``aggregate:``
--------------

Expand All @@ -149,6 +151,8 @@ Each entry contains:
New tag to append to the keys for the aggregated quantities.
``_dim:`` (:class:`str`)
Dimensions on which to aggregate.
``_fail:`` (:class:`str` or :class:`int`)
Action or log level when aggregation fails; corresponds to the `fail` argument to :meth:`.Computer.aggregate`.

Note the leading underscores.
This is to distinguish these from all other keys, which are treated as group names.
Expand Down Expand Up @@ -285,6 +289,8 @@ If the ``path:`` key is a relative path, it is resolved relative to the director
dims: {i: i, j_dim: j}
.. _config-general:

``general:``
------------

Expand All @@ -301,8 +307,10 @@ Each item contains:
E.g. if "product", then :meth:`.Computer.add_product` is called, which also automatically infers the correct dimensions for each input.
``key:``
The key for the computed quantity.

If the key has the single dimension "\*" (e.g. ``key: "X:*:tag"``), then dimensions of the resulting key are inferred to be the union of the dimensions of each of the ``inputs:``, below.
``inputs:``
A list of keys to which the computation is applied.
A list of (1 or more) keys to which the computation is applied.
``args:`` (:class:`dict`, optional)
Keyword arguments to the computation.
``add args:`` (:class:`dict`, optional)
Expand Down
6 changes: 5 additions & 1 deletion doc/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ Care should be taken to avoid adding 2+ keys with the same name, tag, **and** nu
c.add("foo:l-m-n", ...)
c.add("foo:x-y-z", ...)
This situation is ambiguous and the behaviour of :meth:`.full_key` is undefined.
This situation is ambiguous and the behaviour of :meth:`Computer.full_key` is undefined.
Instead, add a :attr:`~.Key.tag` to disambiguate.

All changes
-----------

- :meth:`.Key.product` accepts :class:`str` arguments (:pull:`60`).
- New class method :meth:`.Key.bare_name` (:pull:`60`).
- Infer dimensions for e.g. ``X:*:tag`` in :ref:`config-general` configuration items (:pull:`60`).
- Handle the `fail` argument to :meth:`.Computer.aggregate` through :ref:`config-aggregate` configuration items (:pull:`60`).
- New computations :func:`.relabel` and :func:`.rename_dims` (:pull:`60`).
- Improve perfomance for adding large number of computations to :class:`.Computer` (:pull:`60`).

Expand Down
2 changes: 2 additions & 0 deletions genno/core/computer.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,8 @@ def aggregate(
Passed to :meth:`computations.aggregate <genno.computations.aggregate>`.
sums : bool, optional
Passed to :meth:`add`.
fail : str or int, optional
Passed to :meth:`add_queue` via :meth:`add`.
Returns
-------
Expand Down

0 comments on commit 3f9b31d

Please sign in to comment.