Skip to content

Commit cf8bb40

Browse files
committed
small documentation update and other fixes
1 parent 7fa1515 commit cf8bb40

File tree

10 files changed

+60
-53
lines changed

10 files changed

+60
-53
lines changed

doc/code.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ The CGMS12 database
303303
...................
304304

305305
The CGMS12 tools are for reading data from a CGMS12 database structure that
306-
is used by CGMS executable version 11 and BioMA 2014.
306+
is used by CGMS executable version 11 and BioMA 2014.
307307

308308

309309
.. automodule:: pcse.db.cgms12
@@ -351,14 +351,12 @@ The NASA POWER database
351351
Convenience routines
352352
--------------------
353353

354-
These routines are there for conveniently starting a WOFOST simulation. They
355-
are mainly used in the tutorial and examples but can be used to further
356-
elaborating on when writing your own scripts.
354+
These routines are there for conveniently starting a WOFOST simulation
355+
for the demonstration and tutorials. They can serve as an example to
356+
build your own script but have no further relevance.
357357

358358
.. autofunction:: pcse.start_wofost.start_wofost
359359

360-
.. autofunction:: pcse.run_wofost.run_wofost
361-
362360

363361
Miscelaneous utilities
364362
----------------------

doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ nowadays (XML, databases, web, etc).
2727
Like so many other software packages, PCSE was developed to facilitate my own research work. I wanted something
2828
that was more easy to work with, more interactive and more flexible while still implementing
2929
the sound computational approach of FSE. For this reason PCSE was developed in Python
30-
which is quickly becoming an important language for scientific purposes.
30+
hsa become an important programming language for scientific purposes.
3131

3232
Traditionally, crop simulation models in Wageningen have been provided including the
3333
full source code. PCSE is no exception and its source code is open and licensed under the

doc/installing.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Python through the native package manager. For Windows users the most straightfo
1313
Python is through one of the prepackaged Python distributions such as `Enthought Canopy`_,
1414
`Anaconda`_ or `PythonXY`_. The advantage of the prepackaged distributions is that they provide a working
1515
version of Numpy out-of-the-box which can be difficult to install on Windows. Mac OSX users can most easily
16-
install Python and Numpy using `HomeBrew`_, i.e brew install Python Numpy
16+
install Python and Numpy using `HomeBrew`_, i.e ``brew install Python Numpy``.
1717

1818
The dependencies of PCSE are the following:
1919

@@ -72,14 +72,17 @@ After installing MiniConda you should open a command box and check that conda is
7272
is foreign system : False
7373
7474
Now we will use a Conda environment file to recreate the python environment that we use to develop and run
75-
PCSE. First you should download the conda environment file :download:`downloads/py2_pcse.yml` and save
76-
it on a temporary location such as ``d:\temp\make_env\``. We will now create a dedicated virtual environment
77-
using the command ``conda env create`` and tell conda to use the environment file with the option ``-f p2_pcse.yml``
75+
PCSE. First you should download the conda environment file which comes in two flavours, a bare minimum
76+
environment for running PCSE (:download:`downloads/py2_pcse.yml`) and a more complete environment which
77+
includes the Jupyter notebook, Pandas and IPython (:download:`downloads/py2_pcse_full.yml`). If you intend
78+
to run the 'Getting started' section, you should take the latter one. Save the environment file
79+
on a temporary location such as ``d:\temp\make_env\``. We will now create a dedicated virtual environment
80+
using the command ``conda env create`` and tell conda to use the environment file with the option ``-f p2_pcse_full.yml``
7881
as show below:
7982

8083
.. code-block:: doscon
8184
82-
D:\temp\make_env>conda env create -f py2_pcse.yml
85+
D:\temp\make_env>conda env create -f py2_pcse_full.yml
8386
Fetching package metadata: ....
8487
.Solving package specifications: .........
8588
Linking packages ...
@@ -186,7 +189,7 @@ For testing the PCSE package we need to start python and import pcse:
186189

187190
.. code-block:: doscon
188191
189-
[py2_pcse_b] D:\temp\make_env>python
192+
[py2_pcse] D:\temp\make_env>python
190193
Python 2.7.11 |Continuum Analytics, Inc.| (default, Mar 4 2016, 15:18:41) [MSC v.1500 32 bit (Intel)] on win32
191194
Type "help", "copyright", "credits" or "license" for more information.
192195
Anaconda is brought to you by Continuum Analytics.
@@ -195,7 +198,6 @@ For testing the PCSE package we need to start python and import pcse:
195198
Building PCSE demo database at: C:\Users\wit015\.pcse\pcse.db
196199
>>>
197200
198-
199201
Next, the tests can be executed by calling the `test()` function at the top of the package::
200202

201203
>>> pcse.test()

doc/pcse_intro.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ PCSE also has its limitations, in fact there are several:
8181
time-step. Although the internal time-step of modules can be made more fine-grained if needed.
8282

8383
* No graphical user interface. However the lack of a user interface is partly compensated by using PCSE with the
84-
`pandas <http://pandas.pydata.org/>`_ package and the `IPython notebook <https://ipython.org/notebook.html>`_.
85-
PCSE output can be easily converted to a pandas `DataFrame` which can be used to display charts in an IPython
84+
`pandas <http://pandas.pydata.org/>`_ package and the `Jupyter notebook <https://jupyter.org/>`_.
85+
PCSE output can be easily converted to a pandas `DataFrame` which can be used to display charts in an Jupyter
8686
notebook.
8787

8888
License

doc/quickstart.rst

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,15 @@ and have a look at these as well::
100100
Running PCSE/WOFOST with custom input data
101101
==========================================
102102

103-
For setting up PCSE/WOFOST with your
104-
own data sources you should understand that WOFOST uses 3 different types of
105-
inputs: 1) model parameters for the crop, soil and site; 2) Daily weather observations
106-
for running the simulation and 3) agromanagement data that define the agromanagement
107-
practices such as sowing, harvesting and irrigation. PCSE provides several tools for
108-
reading these inputs from files, databases or internet resources.
103+
For running PCSE/WOFOST (and PCSE models in general) with your own data sources you need three different types of
104+
inputs:
105+
106+
1. Model parameters that parameterize the different model components. These parameters usually
107+
consist of a set of crop parameters (or multiple sets in case of crop rotations), a set of soil parameters
108+
and a set of site parameters. The latter provide ancillary parameters that are specific for a location.
109+
2. Driving variables represented by weather data which can be derived from various sources.
110+
3. Agromanagement actions which specify the farm activities that will take place on the field that is simulated
111+
by PCSE.
109112

110113
For the second example we will run a simulation for sugar beet in
111114
Wageningen (Netherlands) and we will read the input data step by step from
@@ -138,7 +141,7 @@ Wageningen are often provided in the CABO format that could be read
138141
with the `TTUTIL <http://edepot.wur.nl/17847>`_ FORTRAN library. PCSE
139142
tries to be backward compatible as much as possible and provides the
140143
:ref:`CABOFileReader <CABOFileReader>` for reading parameter files in CABO format.
141-
the `CABOFileReader` returns a dictionary with the parameter name/value pairs::
144+
the CABOFileReader returns a dictionary with the parameter name/value pairs::
142145

143146
>>> from pcse.fileinput import CABOFileReader
144147
>>> cropfile = os.path.join(data_dir, 'sug0601.crop')
@@ -339,15 +342,8 @@ First we will import the necessary modules and define the data directory. We als
339342
.. _pandas: http://pandas.pydata.org
340343
.. _PyYAML: http://pyyaml.org/wiki/PyYAML
341344

342-
For running the PCSE/LINTUL3 (and PCSE models in general), you need three types of inputs:
343-
344-
1. Model parameters that parameterize the different model components. These parameters usually
345-
consist of a set of crop parameters (or multiple sets in case of crop rotations), a set of soil parameters
346-
and a set of site parameters. The latter provide ancillary parameters that are specific for a location.
347-
2. Driving variables represented by weather data which can be derived from various sources.
348-
3. Agromanagement actions which specify the farm activities that will take place on the field that is simulated
349-
by PCSE. For defining the agromanagement we will use the new `AgroManager` which replaces the `timerdata`
350-
definition that was used previously.
345+
Similar to the previous example, for running the PCSE/LINTUL3 model we need to define the tree types of inputs
346+
(parameters, weather data and agromanagement).
351347

352348
Reading model parameters
353349
------------------------

doc/reference_guide.rst

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ for potential crop production::
144144

145145
from pcse.soil.classic_waterbalance import WaterbalancePP
146146
from pcse.crop.wofost import Wofost
147-
from pcse.agromanagement import AgroManagementSingleCrop
147+
from pcse.agromanager import AgroManager
148148

149149
# Module to be used for water balance
150150
SOIL = WaterbalancePP
@@ -153,7 +153,7 @@ for potential crop production::
153153
CROP = Wofost
154154

155155
# Module to use for AgroManagement actions
156-
AGROMANAGEMENT = AgroManagementSingleCrop
156+
AGROMANAGEMENT = AgroManager
157157

158158
# variables to save at OUTPUT signals
159159
# Set to an empty list if you do not want any OUTPUT
@@ -192,9 +192,17 @@ The second part is for defining the
192192
variables (*OUTPUT_VARS*) that should be stored during the model run
193193
(during OUTPUT signals) and the details of the regular output interval.
194194
Next, summary output *SUMMARY_OUTPUT_VARS* can be defined that will be generated at the end
195-
of each crop cycle. Finall, output can be collected at the end of the
195+
of each crop cycle. Finally, output can be collected at the end of the
196196
entire simulation (*TERMINAL_OUTPUT_VARS*).
197197

198+
.. note::
199+
Model configuration files for models that are included in the PCSE package
200+
reside in the 'conf/' folder inside the package. When the Engine is started
201+
with the name of a configuration file, it searches this folder to locate the file.
202+
This implies that if you want the start the Engine with your own (modified)
203+
configuration file, you *must* specify it as an absolute or relative path
204+
otherwise the Engine will not find it.
205+
198206
The relationship between models and the engine
199207
----------------------------------------------
200208

@@ -366,9 +374,12 @@ Similarly, state variables can only be changed during the state update while the
366374
of change are locked. This mechanism ensures that rate/state updates are carried out
367375
in the correct order.
368376

369-
Finally, instances of rate variables have one additional method, called `zerofy()`.
377+
Finally, instances of RatesTemplate have one additional method, called `zerofy()` while
378+
instances of StatesTemplate have one additional method called `touch()`.
370379
Calling `zerofy()` is normally done by the Engine and explicitly sets all rates of change
371-
to zero.
380+
to zero. Calling `touch()` on a states object is only useful when the states variables
381+
do not need to be updated, but you do want to be sure that any published state variables
382+
will remain available in the VariableKiosk.
372383

373384

374385
The AgroManager
@@ -402,7 +413,7 @@ or twice in the growing cycle. So for a 200-day growing cycle there will be
402413
198 days where the parameters do not carry any information. Nevertheless, they
403414
would still be present in the function call, thereby decreasing the computational
404415
efficiency and the readability of the code. Therefore, PCSE uses a very different
405-
approach for agromanagement events which is based on signals (see XXX).
416+
approach for agromanagement events which is based on signals (see :ref:`Broadcasting signals`).
406417

407418
.. _refguide_agromanagement:
408419

@@ -703,6 +714,8 @@ initializing rate/state variables, while retrieving values from the VariableKios
703714
through the normal dictionary look up. For more details on the VariableKiosk see the
704715
description in the :ref:`BaseClasses` section.
705716

717+
.. _Broadcasting signals:
718+
706719
Broadcasting signals
707720
--------------------
708721

doc/whatsnew.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ PCSE version 5.2 brings the following new features:
1313
campaigns. The AgroManager uses a new format based on YAML to store agromanagement definitions.
1414
- The water-limited production simulation with WOFOST now supports irrigation using the new AgroManager.
1515
An example notebook has been added to explain the different irrigation options.
16-
- Support for reading input data from a CGMS14 database
16+
- Support for reading input data from a CGMS8 and CGMS14 database
1717

1818
What's new in PCSE 5.1
1919
======================
2020

2121
PCSE version 5.1 brings the following new features:
2222

23-
- Support for reading input data (weather, soil, crop parameters) from a
24-
CGMS12 database. CGMS is the acronym for
23+
- Support for reading input data (weather, soil, crop parameters) from a CGMS12 database. CGMS is the acronym for
2524
Crop Growth Monitoring System and was developed by Alterra in cooperation with the MARS unit of the Joint Research
2625
Centre for crop monitoring and yield forecasting in Europe. It uses a database structure for storing weather
2726
data and model simulation results which can be read by PCSE. See the MARSwiki_ for the database definition.

pcse/db/cgms12/data_providers.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,10 @@ class AgroManagementDataProvider(list):
230230
campaign. Note that by default the campaign_start_date is set equal to the
231231
crop_start_date which means that the simulation starts when the crop starts.
232232
This default behaviour can be changed using this keyword. It can have multiple meanings:
233-
- if a date object is passed, the campaign is assumed to start on this date.
234-
- if an int/float is passed, the campaign_start_date is calculated as the
235-
crop_start_date minus the number of days provided by campaign_start.
233+
234+
- if a date object is passed, the campaign is assumed to start on this date.
235+
- if an int/float is passed, the campaign_start_date is calculated as the
236+
crop_start_date minus the number of days provided by campaign_start.
236237
237238
For adjusting the campaign_start_Date, see also the `set_campaign_start_date(date)` method
238239
to update the campaign_start_date on an existing AgroManagementDataProvider.

pcse/soil/classic_waterbalance.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ class WaterbalanceFD(SimulationObject):
128128
WDRT Amount of water added to root zone by increase N cm
129129
of root growth
130130
TOTINF Total amount of infiltration N cm
131-
TOTIRR Total amount of irrigation (not implemented N cm
132-
yet)
131+
TOTIRR Total amount of effective irrigation N cm
133132
PERCT Total amount of water percolating from rooted N cm
134133
zone to subsoil
135134
LOSST Total amount of water lost to deeper soil N cm
@@ -153,8 +152,8 @@ class WaterbalanceFD(SimulationObject):
153152
the evapotranspiration module
154153
RAIN Rainfall rate for current day N |cmday-1|
155154
RIN Infiltration rate for current day N |cmday-1|
156-
RIRR Irrigation rate for current day. Is always set N |cmday-1|
157-
to zero as irrigation is not handled currently
155+
RIRR Effective irrigation rate for current day, N |cmday-1|
156+
computed as irrigation amount * efficiency.
158157
PERC Percolation rate to non-rooted zone N |cmday-1|
159158
LOSS Rate of water loss to deeper soil N |cmday-1|
160159
DW Change in amount of water in rooted zone as a N |cmday-1|
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Soil hydraulic properties
2-
WCAD = 0.10
3-
WCWP = 0.20
4-
WCFC = 0.40
5-
WCWET = 0.45
6-
WCST = 0.50
2+
WCAD = 0.10 # Water content at air dry
3+
WCWP = 0.20 # Water content at wilting point
4+
WCFC = 0.40 # Water content at field capacity
5+
WCST = 0.50 # Water content at saturation
76
DRATE = 30. # Maximum drainage rate of the soil (mm/day)

0 commit comments

Comments
 (0)