Skip to content

Commit 00cae8e

Browse files
committed
wip documentation
1 parent 8410ad2 commit 00cae8e

File tree

4 files changed

+92
-37
lines changed

4 files changed

+92
-37
lines changed

doc/about.rst

+37-36
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,60 @@
33
About xarray-simlab
44
===================
55

6-
xarray-simlab provides a framework for easily building custom models from a set
7-
of re-usable components (i.e., Python classes), called processes.
6+
xarray-simlab provides a framework for easily building custom computational
7+
models from a set of re-usable components (i.e., Python classes), called
8+
processes.
89

9-
The framework handles issues that scientists who develop models should not care
10-
too much about, like a model interface and its data structure as well as its
11-
overall workflow management. Both are automatically determined from the
12-
succint, declarative-like interfaces of the model processes.
10+
The framework handles issues that scientists who are developing models should
11+
not care too much about, like the model interface - including the data structure
12+
used - and the overall workflow management. Both are automatically determined
13+
from the succint, declarative-like interfaces of the model processes.
1314

14-
Next versions of xarray-simlab will hopefully also handle other technical issues
15-
like logging, command line integration and running (many) simulations in
16-
parallel.
15+
Next versions of xarray-simlab will hopefully handle other technical issues
16+
like logging simulation progress, command line integration and running (many)
17+
simulations in parallel.
1718

1819
Motivation
1920
----------
21+
2022
xarray-simlab is being developped with the idea of reducing the gap between the
21-
environment used for building and running a computational model and the one(s)
23+
environments used for building and running computational models and the ones
2224
used for processing and analysing simulation results. It also encourages
2325
building new models from re-usable components and avoid reinventing the wheel.
2426

25-
Ultimately, it should reduce the time lag between the ideas that scientists have
26-
on how to model a particular phenomenon and the insights they get from exploring
27-
the behavior of the model, which often itself lead to new modeling ideas.
27+
The design of this tool is mainly focused on fast development and simulation
28+
setting(s), which would ultimately optimize the iterative, back-and-forth
29+
process between ideas on how to model a particular phenomenon and insights
30+
from the exploration of model behavior.
2831

2932
Sources of inspiration
3033
----------------------
3134

32-
- xarray_: data structure
33-
- dask_: build and run task graphs (DAGs)
34-
- luigi_: use Python classes as re-usable units that help building complex
35-
workflows.
36-
- django_: especially The Django's ORM part (i.e., django.db.models) for the
37-
design of Process and Variable classes
38-
- param_: another source of inspiration for Process interface and Variable objects.
39-
- climlab_: another python package for process-oriented modeling, applied to
40-
climate.
35+
xarray-simlab leverages the great number of packages that are part of the
36+
Python scientific ecosystem. More specifically, the packages below have been
37+
great sources of inspiration for this project.
38+
39+
- xarray_: xarray-simlab actually provides an xarray extension for setting and
40+
running models.
41+
- luigi_: the concept of Luigi is to use Python classes as re-usable units that
42+
help building complex workflows. xarray-simlab's concept is similar, but
43+
here it is specific to computational (numerical) modeling.
44+
- django_ (not really a scientific package): the way that model processes are
45+
designed in xarray-simlab is heavily inspired from Django's ORM (i.e., the
46+
``django.db.models`` part).
47+
- param_: another source of inspiration for the interface of processes
48+
(more specifically the variables that it defines).
49+
- climlab_: another python package for process-oriented modeling, which uses
50+
the same approach although having a slightly different design/API, and which
51+
is applied to climate modeling.
52+
- dask_: represents fine-grained processing tasks as Directed Acyclic Graphs
53+
(DAGs). xarray-simlab models are DAGs too, where the nodes are interdepent
54+
processes. In this project we actually borrow some code from dask
55+
for resolving process dependencies and for model visualization.
4156

4257
.. _xarray: https://github.com/pydata/xarray
4358
.. _dask: https://github.com/dask/dask
4459
.. _luigi: https://github.com/spotify/luigi
4560
.. _django: https://github.com/django/django
4661
.. _param: https://github.com/ioam/param
4762
.. _climlab: https://github.com/brian-rose/climlab
48-
49-
**Draft: put this in create models section**
50-
51-
The framework consists of a few base classes, e.g., :py:class:`xrsimlab.Variable`,
52-
:py:class:`xrsimlab.Process` and :py:class:`xrsimlab.Model`. The latter class
53-
represents a model with which we interact using the xarray's
54-
:py:class:`xarray.Dataset` structure.
55-
56-
Variable.state (or value, rate, change) should not be used (get/set) outside
57-
of Process subclasses.
58-
59-
ForeignVariable.state return the same object (usually a numpy array) than
60-
Variable.state (replace class names by variable names in processes).
61-
ForeignVariable.state is actually a shortcut to ForeignVariable.ref_var.state.

doc/create_model.rst

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.. _create_model:
2+
3+
Creating models
4+
===============
5+
6+
(WIP)
7+
8+
The framework provides a few Python base classes, e.g.,
9+
:class:`~xrsimlab.Variable`, :class:`~xrsimlab.Process` and
10+
:class:`~xrsimlab.Model` that can used togheter to create fully operational
11+
models.
12+
13+
A ``Model`` is a collection of processes that each define an interface with the
14+
all the "public" variables it needs, update or provide for its proper
15+
computation.
16+
17+
Process
18+
-------
19+
20+
21+
22+
Variable
23+
--------
24+
25+
Generally, the ``state``, ``value``, ``rate`` and ``change`` properties should
26+
not be used (either get or set the value) outside of Process subclasses,
27+
or maybe only for debugging.
28+
29+
Foreign Variable
30+
~~~~~~~~~~~~~~~~
31+
32+
ForeignVariable.state return the same object (usually a numpy array) than
33+
Variable.state (replace class names by variable names in processes).
34+
ForeignVariable.state is actually a shortcut to ForeignVariable.ref_var.state.
35+
36+
Variable List and Group
37+
~~~~~~~~~~~~~~~~~~~~~~~
38+
39+
40+
Model
41+
-----
42+
43+
The latter class represents a model with which we interact using the xarray's
44+
:class:`~xarray.Dataset` structure.

doc/index.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extension for setting and running simulations using the
88

99
.. _xarray: http://xarray.pydata.org
1010

11-
Documentation Index
11+
Documentation index
1212
-------------------
1313

1414
**Getting Started**
@@ -17,6 +17,8 @@ Documentation Index
1717
* :doc:`faq`
1818
* :doc:`installing`
1919
* :doc:`examples`
20+
* :doc:`create_model`
21+
* :doc:`run_model`
2022

2123
.. toctree::
2224
:maxdepth: 1
@@ -27,6 +29,8 @@ Documentation Index
2729
faq
2830
installing
2931
examples
32+
create_model
33+
run_model
3034

3135
**Help & reference**
3236

doc/run_model.rst

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. _run_model:
2+
3+
Running models
4+
==============
5+
6+
(TODO)

0 commit comments

Comments
 (0)