Welcome to PyCrop2ML Documentation¶
Contents .. _pycropml:
CropML documentation¶
Module description¶
What is PyCrop2ML?¶
What is Crop2ML ?¶
Objectives¶
Our main objectives are:
- define a declarative language to describe either an atomic model or a composition of models
- add semantic dimension to CropML language by annotation of the models to allow the composition of components of different platforms by using the standards of the semantic web
- develop a library to allow the transformation and the exchange of CropML model between different Crop modelling and simulation platform
- provide a web repository enabling registration, search and discovery of CropML Models
- facilitate Agricultural Model Exchange Initiative
Context¶
Motivation¶
- Our motivation is to:
- Strengthen the synergy between crop modelers, users and scientific researchers
- Facilitate model intercomparison (at the process level) and model improvement through the exchange of model components (algorithms) and code reuse between platforms/models.
- Bridge the gap between ecophysiologists who develop models at the process level with crop modelers and model users and facilitate the integration in crop models of new knowledge in plant science (i.e. we are seeking the exchange of knowledge rather than black box models).
- Increase capabilities and responsiveness to stakeholder’ needs.
- Propose a solution to the AgMIP community for NexGen crop modeling tools.
Vision¶
- Facilitate the development of complex models
- Use modular modelling to share knowledge and rapidly develop operational tools.
- Reuse model parts to leverage the expertise of third parties;
- Renovate legacy code.
- Realize the benefit of sharing and complementing different expertise.
- Promote model sharing and reuse
CropML Description¶
Formal definition of a Model Unit in CropML¶
Element | Description |
---|---|
ModelUnit |
|
Description |
|
Inputs |
|
Outputs |
|
Algorithm |
|
Parametersets |
|
Testsets |
|
ModelUnit element¶
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE ModelUnit PUBLIC "-//SIMPLACE/DTD SOL 1.0//EN" "https://raw.githubusercontent.com/AgriculturalModelExchangeInitiative/xml_representation/master/ModelUnit.dtd">
<ModelUnit modelid=" " timestep=" " name=" " version="">
....
</ModelUnit>
Description element¶
This element gives the general information on the model and is composed by a set of character elements. It MUST contain Title, Authors, Institution and abstract elements and MAY optionally contain URI and Reference elements.
<ModelUnit modelid=" " timestep=" " name=" " version =" ">
<Description>
<Title>title</Title>
<Authors>authors</Authors>
<Institution>institution</Institution>
<URI>uri</URI>
<Abstract><![CDATA[abstract]]></Abstract>
</Description>
...
</ModelUnit>
Inputs elements¶
The inputs of Model are listed inside an XML element called Inputs within a dictionary structure composed by their attributes which declarations are optional(default, max, min, parametercategory, variablecategory and uri) or required(name, datatype, description, inputtype, unit ) and their corresponding value. Inputs element MUST contain one or more Input elements.
<ModelUnit modelid=" " timestep=" " name=" " version =" ">
...
<Inputs>
<Input name=" " description=" " parametercategory=" " datatype=" " min=" " max=" " default=" " unit=" " uri="" inputtype=" "/>
<Input name=" " description=" " parametercategory=" " datatype=" " min=" " max=" " default=" " unit=" " uri=" " inputtype=" "/>
...
</Inputs>
...
</ModelUnit>
- The required datatype attribute is the type of input value specified in default (the default value in the input), min (the minimum value in the input) and max (the maximum value in the input). It MAY be one type of the set of types used in the existing crop modeling platform.
- The inputtype attribute makes it possible to distinguish the variables and the parameters of the model. So it MUST take one of two possible values: parameter and variable.
- The parametercategory attribute defines the category of parameter which is specified by one of the following values: constant, species, soil and genotypic.
- The variablecategory defines the category of variable depending on whether it is a state, a rate or an “auxiliary” variable. State variable characterize the behavior of the model and rate variable characterizes the changes in state variables.
Outputs element¶
The outputs of Model are listed inside an XML element called Outputs within a dictionary structure composed by their attributes which declarations are:
- optional(variabletype and URI)
- required(name, datatype, description, unit, max and min )
- and their corresponding value
Outputs MUST contain zero or more output elements.
<ModelUnit modelid=" " timestep=" " name=" " version =" ">
...
<Outputs>
<Output name=" " description=" " datatype=" " min=" " max=" " unit=" " uri=" "/>
<Output name=" " description=" " datatype=" " min=" " max=" " unit=" " uri=" "/>
...
</Outputs>
...
</ModelUnit>
Algorithm element¶
<ModelUnit modelid=" " timestep=" " name=" " version =" ">
...
<Algorithm language =""><![CDATA[
...
]]>
</Algorithm>
...
</ModelUnit>
Parametersets element¶
<ModelUnit modelid=" " timestep=" " name=" " version =" ">
...
<Parametersets>
<Parameterset name="" description="" uri = ""/>
<Parameterset name="" description="" >
<Param name="">value</Param>
<Param name="">value</Param>
...
</Parameterset>
...
...
</ModelUnit>
Testsets element¶
<ModelUnit modelid=" " timestep=" " name=" " version =" ">
...
<Testsets>
<Testset name="" parameterset = "" description="" uri = ""/>
<Testset name="" parameterset = "" description="" >
<Test name="">
<InputValue name="">value</InputValue>
...
<OutputValue name="" precision ="">value</OutputValue>
...
</Test>
...
</Testset>
...
</Testsets>
...
</ModelUnit>
Formal definition of a Composite Model in CropML¶
Vertices are the different models that form the composition.Ports are the inputs and outputs of each model.Edges are directed and connect one output port to an input port of another model.
Inputs element¶
It MUST contain one or more input element which provide a set of independent models entries. If two or more input variables of independent models are the same (same unit, interval, description) a link should be made to one input variable of the composite model.
Outputs element¶
It MUST contain one or more output element which provide a set of independent models outputs or a result of a combination of models .
Composition element¶
It’s a list of models elements which contains a list of links elements. Link provides the mechanism for mapping inputs declared within one modelUnit to output in another modelUnit, allowing information to be exchanged between the various atomic models in the composite model.
Algorithm element¶
The implementation differs from the platform:
- Discrete Events Models and Formalisms (RECORD)
- Actor model framework (OpenAlea)
- A sequence of algorithmic instructions witch implement the control flow (BIOMA)
PyCropML User Guide¶
Version: | 0.1.1 |
---|---|
Release: | 0.1.1 |
Date: | Dec 11, 2019 |
This reference manual details functions, modules, and objects included in OpenAlea.Core, describing what they are and what they do. For a complete reference guide, see core_reference.
Warning
This “Reference Guide” is still very much in progress. Many aspects of OpenAlea.Core are not covered.
src¶
pycropml package¶
Subpackages¶
- <vle_project version=”1.1.x” date=”2012-Oct-03 13:01:13” author=”Eric Casellas”>
- <structures>
- <model width=”2184” height=”1280” name=”2CV_parcelle” type=”coupled”>
- <submodels>
- <model observables=”vueDecision” conditions=”condDecFSA” dynamics=”dynDecFSA” debug=”false” width=”100” height=”75” x=”132” y=”26” name=”Decision” type=”atomic”></model> <model width=”100” height=”165” x=”316” y=”127” name=”2CV” type=”coupled”></model>
</submodels> <connections> </connections>
</model>
</structures> <dynamics> </dynamics> <experiment name=”2CV_parcelle”> </experiment>
</vle_project>
-
exception
pycropml.transpiler.errors.
PseudoCythonNotTranslatableError
(message, suggestions=None, right=None, wrong=None)[source]¶
-
exception
pycropml.transpiler.errors.
PseudoCythonTypeCheckError
(message, suggestions=None, right=None, wrong=None)[source]¶
-
exception
pycropml.transpiler.errors.
PseudoError
(message, suggestions=None, right=None, wrong=None)[source]¶ Bases:
exceptions.Exception
-
pycropml.transpiler.errors.
tab_aware
(location, code)[source]¶ if tabs in beginning of code, add tabs for them, otherwise spaces
Maintain version for this package. Do not edit this file, use ‘version’ section of config.
-
pycropml.transpiler.version.
MAJOR
= 0¶ (int) Version major component.
-
pycropml.transpiler.version.
MINOR
= 0¶ (int) Version minor component.
-
pycropml.transpiler.version.
POST
= 2¶ (int) Version post or bugfix component.
Submodules¶
-
class
pycropml.checking.
Test
(name)[source]¶ Bases:
pycropml.checking.Testset
-
class
pycropml.inout.
Input
(kwds)[source]¶ Bases:
pycropml.inout.InputOutput
-
class
pycropml.inout.
Output
(kwds)[source]¶ Bases:
pycropml.inout.InputOutput
Model Description and Model Unit.
-
class
pycropml.modelunit.
ModelUnit
(kwds)[source]¶ Bases:
pycropml.modelunit.ModelDefinition
Formal description of a Model Unit.
Maintain version for this package. Do not edit this file, use ‘version’ section of config.
-
pycropml.version.
MAJOR
= 0¶ (int) Version major component.
-
pycropml.version.
MINOR
= 1¶ (int) Version minor component.
-
pycropml.version.
POST
= 1¶ (int) Version post or bugfix component.
Module contents¶
Usecases¶
Licence¶
PyCropML is released under a MIT License.
Usecases¶
Glossary¶
Terminology
- Model
- Simplified representation of the crop system within specific objectives.
Overview
Indices and tables¶
License¶
PyCropML is released under a MIT License.
Welcome to CropML’s documentation!¶
Contents:
Contributing Guide¶
This is a wiki for anything related to the contributing on [[Crop2ML|https://github.com/AgriculturalModelExchangeInitiative|Crop2ML]] which is a project of the Agricultural Model Exchange Initiative. For more information about this project, please visit CropML documentation [[Crop2ML|https://cropmlformat.readthedocs.io/en/latest/?badge=latest|documentation]]:
Quick Links¶
- [[Project Git Repository|https://github.com/cython/cython|Git Repository]] (and [[Change Log|https://github.com/cython/cython/blob/master/CHANGES.rst|Change Log]])
- [[ Differences between Cython and Pyrex|https://cython.readthedocs.io/en/latest/src/userguide/pyrex_differences.html| Differences between Cython and Pyrex]]
- [[Unsupported Python features|https://cython.readthedocs.io/en/latest/src/userguide/limitations.html|Unsupported Python features]] (aka TODO list)
- [[ Hacker-Guide: How to work on the Cython compiler itself|HackerGuide| Hacker-Guide: How to work on the Cython compiler itself]]
- [[ Enhancement proposals|enhancements| Enhancement proposals]] (CEPs)
- [[ Projects using Cython|projects| Projects using Cython]]
- [[ Comparison with SWIG|SWIG| Comparison with SWIG]]
- [[Automatic .pxd/.pyx generation|AutoPxd|Automatic .pxd/.pyx generation]] from C or C++ header files.
Cython Installers¶
- [[PyPi|http://pypi.python.org/pypi/Cython/|PyPi]] via
easy_install
or pip- [[Gentoo Ebuild|http://packages.gentoo.org/package/dev-python/cython|Gentoo Ebuild]]
- [[Debian package|http://packages.debian.org/sid/cython|Debian package]] (not always up to date)
- [[ Installing Cython on Windows|InstallingOnWindows| Installing Cython on Windows]]
Tips and Tricks¶
[[Getting started|http://docs.cython.org/src/quickstart/index.html|Getting started]]
[[ Using early binding techniques to improve speed|http://docs.cython.org/en/latest/src/userguide/early_binding_for_speed.html| Using early binding techniques to improve speed]]
[[ Writing Cython programs in pure Python|http://docs.cython.org/src/tutorial/pure.html| Writing Cython programs in pure Python]]
[[ Helpful notes for wrapping C++ APIs|http://docs.cython.org/en/latest/src/userguide/wrapping_CPlusPlus.html| Helpful notes for wrapping C++ APIs]]
[[ Discussion of all the options how to wrap C/C++ code to Python|WrappingCorCpp| Discussion of all the options how to wrap C/C++ code to Python]]
[[WritingFastPyrexCode|http://www.sagemath.org:9001/WritingFastPyrexCode|WritingFastPyrexCode]]
[[ Successful creation of a hierarchy of modules in a package|PackageHierarchy| Successful creation of a hierarchy of modules in a package]]
[[ One method for source-level debugging|http://docs.cython.org/en/latest/src/userguide/debugging.html| One method for source-level debugging]]
[[ Dynamic Memory Allocation (malloc, realloc, free)|http://docs.cython.org/en/latest/src/tutorial/memory_allocation.html| Dynamic Memory Allocation (malloc, realloc, free)]]
[[Profiling]]
[[ Building a Windows Installer|BuildingWindowsInstaller| Building a Windows Installer]]
[[Embedding Python|EmbeddingCython|Embedding Python]] to create standalone Cython programs.
[[List Subclass Example|ListExample|List Subclass Example]] Adding mathematical operations to subclassed built-in list.
Working with Numpy
- [[Tutorial for NumPy users|http://docs.cython.org/en/latest/src/userguide/numpy_tutorial.html|Tutorial for NumPy users]]
- [[Accessing a Numpy pointer for passing to C|http://docs.cython.org/en/latest/src/userguide/memoryviews.html#pass-data-from-a-c-function-via-pointer]]
People¶
[[Stefan Behnel|http://scoder.behnel.de/|Stefan Behnel]], [[Robert Bradshaw|http://www.math.washington.edu/~robertwb/|Robert Bradshaw]], [[Dag Seljebotn|http://heim.ifi.uio.no/dagss/|Dag Seljebotn]], Lisandro Dalcin.
Mailing Lists¶
Our development mailing list is [[cython-dev|http://mail.python.org/mailman/listinfo/cython-devel|cython-dev]] and user mailing list at http://groups.google.com/group/cython-users.
In the past we also used a [[Google group|http://groups.google.com/group/cython|Google group]] and a list at [[BerliOS Developer|https://lists.berlios.de/mailman/listinfo/cython-dev|BerliOS Developer]]. You can still read [[the archives at Gmane|http://blog.gmane.org/gmane.comp.python.cython.devel|the archives at Gmane]].
Project Goals¶
- Fully supported easy-to-use test suite, including the normal CPython test suite.
- Easy installation and usage.
- Rich, accessible documentation. Make sure the examples are plenty and can be automatically tested.
- Make Cython part of the standard distribution of Python (like ctypes).
- Compile all Python code except for possibly some obvious exclusions, which will be worked out by developers.
- Very fast when the user explicitly declares types (but we’re not going to make promises with type inference). Precise benchmarks.
- Mitigate or eliminate the need for users to invoke the Python/C API directly without sacrificing performance.
Documentation¶
- See http://docs.cython.org/.
- Official Pyrex [[Language Overview|http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/version/Doc/LanguageOverview.html|Language Overview]] (note the [[changes|http://hg.cython.org/cython|changes]] though).
- [[Extension Types|http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/version/Doc/Manual/extension_types.html|Extension Types]]
- [[Sharing Declarations Between Pyrex Modules|http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/version/Doc/Manual/sharing.html|Sharing Declarations Between Pyrex Modules]]
- [[FAQ|http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/version/Doc/FAQ.html|FAQ]]
- [[Quick Guide to Pyrex|http://ldots.org/pyrex-guide/|Quick Guide to Pyrex]] from Michael JasonSmith.
- CategoryCythonDoc lists pages that are related to Cython documentation.
- [[ Pure Python mode|pure| Pure Python mode]]
- SAGE Days 4 talk highlighting some of the [[differences between Pyrex and SageX|http://cython.org/talks/SageX.pdf|differences between Pyrex and SageX]] (the predecessor of Cython).
CategoryHomepage