Skip to content

Commit 0d6e80b

Browse files
committed
Start documenting new calibrate module
1 parent 2af6f09 commit 0d6e80b

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

climada/util/calibrate/impact_func.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,43 @@ def impf_step_generator(threshold: Number, paa: Number) -> ImpactFuncSet:
4343

4444
@dataclass
4545
class Input:
46-
"""Define the static input for a calibration task"""
46+
"""Define the static input for a calibration task
47+
48+
Parameters
49+
----------
50+
hazard : climada.Hazard
51+
Hazard object to compute impacts from
52+
exposure : climada.Exposures
53+
Exposures object to compute impacts from
54+
data : pandas.Dataframe
55+
The data to compare computed impacts to. Index: Event IDs matching the IDs of
56+
``hazard``. Columns: Arbitrary columns.
57+
cost_func : Callable
58+
Function that takes an ``Impact`` object and a ``pandas.Dataframe`` as argument
59+
and returns a single number. The optimization algorithm will try to minimize this
60+
number. See this module for a suggestion of cost functions.
61+
impact_func_gen : Callable
62+
Function that takes the parameters as keyword arguments and returns an impact
63+
function set. This will be called each time the optimization algorithm updates
64+
the parameters.
65+
bounds : Mapping (str, {Bounds, tuple(float, float)}), optional
66+
The bounds for the parameters. Keys: parameter names. Values:
67+
``scipy.minimize.Bounds`` instance or tuple of minimum and maximum value.
68+
Unbounded parameters need not be specified here. See the documentation for
69+
the selected optimization algorithm on which data types are supported.
70+
constraints : Constraint or list of Constraint, optional
71+
One or multiple instances of ``scipy.minimize.LinearConstraint``,
72+
``scipy.minimize.NonlinearConstraint``, or a mapping. See the documentation for
73+
the selected optimization algorithm on which data types are supported.
74+
impact_calc_kwds : Mapping (str, Any), optional
75+
Keyword arguments to :py:meth:`climada.engine.impact_calc.ImpactCalc.impact`.
76+
Defaults to ``{"assign_centroids": False}`` (by default, centroids are assigned
77+
here via the ``align`` parameter, to avoid assigning them each time the impact is
78+
calculated).
79+
align : bool, optional
80+
Match event IDs from ``hazard`` and ``data``, and assign the centroids from
81+
``hazard`` to ``exposure``. Defaults to ``True``.
82+
"""
4783

4884
hazard: Hazard
4985
exposure: Exposures

doc/climada/climada.util.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ climada\.util\.api\_client module
99
:undoc-members:
1010
:show-inheritance:
1111

12+
climada\.util\.calibrate module
13+
-------------------------------
14+
15+
.. automodule:: climada.util.calibrate.impact_func
16+
:members:
17+
:show-inheritance:
18+
1219
climada\.util\.checker module
1320
-----------------------------
1421

0 commit comments

Comments
 (0)