Skip to content

Latest commit

 

History

History
433 lines (291 loc) · 11.5 KB

code.rst

File metadata and controls

433 lines (291 loc) · 11.5 KB

Code documentation

How to read

The API documentation provides a description of the interface and internals of all SimulationObjects, AncillaryObjects and utility routines available in the PCSE source distribution. All SimulationObjects and AncillaryObjects are described using the same structure:

  1. A short description of the object
  2. The positional parameters and keywords specified in the interface.
  3. A table specifying the simulation parameters needed for the simulation
  4. A table specifying the state variables of the SimulationObject
  5. A table specifying the rate variables of the SimulationObject
  6. Signals sent or received by the SimulationObject
  7. External dependencies on state/rate variables of other SimulationObjects.
  8. The exceptions that are raised under which conditions.

One or more of these sections may be excluded when they are not appropriate for the SimulationObject that is described.

The table specifying the simulation parameters has the following columns:

  1. The name of the parameter.
  2. A description of the parameter.
  3. The type of the parameter. This is provided as a three-character code with the following interpretation. The first character indicates of the parameter is a scalar (S) or table (T) parameter. The second and third character indicate whether this parameter should be present in the timerdata 'Ti', cropdata 'Cr', soildata 'So' or sitedata 'Si' dictionary.
  4. The physical unit of the parameter.

The tables specifying state/rate variables have the following columns:

  1. The name of the variable.
  2. A description of the variable.
  3. Whether the variable is published in the kiosk or not: Y|N
  4. The physical unit of the variable.

Finally, all public methods of all objects are described as well.

Engine and models

pcse.engine

pcse.models

Agromanagement modules

The routines below implement the agromanagement system in PCSE including crop calendars, rotations, state and timed events. For reading agromanagement data from a file or a database structure see the sections on the reading file input <FileInput> and the database tools <DBtools>.

pcse.agromanager.AgroManager

pcse.agromanager.CropCalendar

pcse.agromanager.TimedEventsDispatcher

pcse.agromanager.StateEventsDispatcher

The Timer

pcse.timer.Timer

The waterbalance

The PCSE distribution provides several waterbalance modules:
  1. WaterbalancePP which is used for simulation under non-water-limited production
  2. WaterbalanceFD which is used for simulation of water-limited production under conditions of freely draining soils
  3. The SnowMAUS for simulation the build-up and melting of the snow cover.
  4. A multi-layer waterbalance implementing simulations for potential conditions, water-limited free drainage conditions and water-limited groundwater conditions (in case of shallow ground water tables). This waterbalance is in a prototype stage and not yet usable, although the source code is available in PCSE.

pcse.soil.WaterbalancePP

pcse.soil.WaterbalanceFD

pcse.soil.SnowMAUS

Crop simulation processes for WOFOST

Phenology

pcse.crop.phenology.DVS_Phenology

pcse.crop.phenology.Vernalisation

Partitioning

pcse.crop.partitioning.DVS_Partitioning

Assimilation

pcse.crop.assimilation.WOFOST_Assimilation

Maintenance respiration

pcse.crop.respiration.WOFOST_Maintenance_Respiration

Evapotranspiration

pcse.crop.evapotranspiration.Evapotranspiration

pcse.crop.evapotranspiration.SWEAF

Leaf dynamics

pcse.crop.leaf_dynamics.WOFOST_Leaf_Dynamics

Root dynamics

pcse.crop.root_dynamics.WOFOST_Root_Dynamics

Stem dynamics

pcse.crop.stem_dynamics.WOFOST_Stem_Dynamics

Storage organ dynamics

pcse.crop.storage_organ_dynamics.WOFOST_Storage_Organ_Dynamics

N/P/K dynamics

pcse.crop.npk_dynamics.NPK_Crop_Dynamics

pcse.crop.nutrients.NPK_Demand_Uptake

pcse.crop.nutrients.NPK_Stress

pcse.crop.nutrients.NPK_Translocation

Abiotic damage

pcse.crop.abioticdamage.FROSTOL

pcse.crop.abioticdamage.CrownTemperature

Crop simulation processes for LINGRA & LINGRA-N

pcse.crop.lingra

Overall grassland model

pcse.crop.lingra.LINGRA

Source/Sink limited growth

pcse.crop.lingra.SourceLimitedGrowth

pcse.crop.lingra.SinkLimitedGrowth

Nitrogen dynamics

pcse.crop.lingra_ndynamics.N_Demand_Uptake

pcse.crop.lingra_ndynamics.N_Stress

pcse.crop.lingra_ndynamics.N_Crop_Dynamics

Base classes

The base classes define much of the functionality which is used "under the hood" in PCSE. Except for the VariableKiosk and the WeatherDataContainer all classes are not to be called directly but should be subclassed instead.

VariableKiosk

pcse.base.VariableKiosk

Base classes for parameters, rates and states

pcse.base.StatesTemplate

pcse.base.RatesTemplate

pcse.base.ParamTemplate

Base and utility classes for weather data

pcse.base.WeatherDataProvider

pcse.base.WeatherDataContainer

Signals defined

pcse.signals

Utilities

The utilities section deals with tools for reading weather data and parameter values from files or databases.

Tools for reading input files

The file_input tools contain several classes for reading weather files, parameter files and agromanagement files.

Simple or dummy data providers

This class of data providers can be used to provide parameter values in cases where separate files or a database is not needed or not practical. An example is the set of soil parameters for simulation of potential production conditions where the value of the parameters does not matter but nevertheless some values must be provided to the model.

The database tools

The database tools contain functions and classes for retrieving agromanagement, parameter values and weather variables from database structures implemented for different versions of the European Crop Growth Monitoring System.

Note that the data providers only provide functionality for reading data, there are no tools here writing simulation results to a CGMS database. This was done on purpose as writing data can be a complex matter and it is our experience that this can be done more easily with dedicated database loader tools such as SQLLoader for ORACLE or the load data infile syntax of MySQL

The CGMS8 database

The CGMS8 tools are for reading data from a database structure that is used by CGMS executable version 9 and 10.

pcse.db.cgms8.GridWeatherDataProvider

pcse.db.cgms8.SoilDataIterator

pcse.db.cgms8.CropDataProvider

pcse.db.cgms8.STU_Suitability

pcse.db.cgms8.SiteDataProvider

The CGMS12 database

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

pcse.db.cgms12

WeatherObsGridDataProvider

AgroManagementDataProvider

SoilDataIterator

CropDataProvider

STU_Suitability

SiteDataProvider

The CGMS14 database

The CGMS14 database is the database structure that is compatible with the 2015 BioMA implementation of WOFOST. Note that the CGMS14 database structure is considerably different from CGMS8 and CGMS12.

The NASA POWER database

pcse.db.NASAPowerWeatherDataProvider

Convenience routines

These routines are there for conveniently starting a WOFOST simulation for the demonstration and tutorials. They can serve as an example to build your own script but have no further relevance.

pcse.start_wofost.start_wofost

Miscelaneous utilities

Many miscelaneous for a variety of purposes such as the Arbitrary Function Generator (AfGen) for linear interpolation and functions for calculating Penman Penman/Monteith reference evapotranspiration, the Angstrom equation and astronomical calculations such as day length.

pcse.util.reference_ET

pcse.util.penman_monteith

pcse.util.penman

pcse.util.check_angstromAB

pcse.util.wind10to2

pcse.util.angstrom

pcse.util.doy

pcse.util.limit

pcse.util.daylength

pcse.util.astro

pcse.util.merge_dict

pcse.util.Afgen

pcse.util.ConfigurationLoader

pcse.util.is_a_month

pcse.util.is_a_dekad

pcse.util.is_a_week

pcse.util.load_SQLite_dump_file