PyCrop2ML

A free, open-source library for defining and sharing CropML models used to represent the various biological processes involved in crop models.
https://github.com/agriculturalmodelexchangeinitiative/pycrop2ml

Category: Consumption
Sub Category: Agriculture and Nutrition

Keywords

crop-model program-transformation source-to-source transpiler

Keywords from Contributors

crop soil

Last synced: about 7 hours ago
JSON representation

Repository metadata

CropML Python library

README.rst

          =========
Pycrop2ml
=========
..  image:: https://readthedocs.org/projects/pycrop2ml/badge/?version=latest
    :target: http://pycrop2ml.readthedocs.io/en/latest/
    :alt: Documentation Status
 
..  image:: https://github.com/AgriculturalModelExchangeInitiative/PyCrop2ML/actions/workflows/codeql-analysis.yml/badge.svg
    :alt: CodeQL Status
    :target: https://github.com/AgriculturalModelExchangeInitiative/PyCrop2ML/actions/workflows/codeql-analysis.yml

.. image:: https://anaconda.org/amei/pycropml/badges/platforms.svg   
    :target: https://anaconda.org/amei/pycropml

.. image:: https://anaconda.org/amei/pycropml/badges/version.svg
    :target: https://anaconda.org/amei/pycropml

.. {# pkglts, doc

.. #}

A Python library to generate components from Crop2ML declarative language.

For more information, refer to `the documentation`__.

.. __: http://pycrop2ml.readthedocs.io/en/latest/



Installation
============

PyCropML relies on two Python packages to build the diagrams of a Crop2ML
composition: ``pydot``, a pure-Python library that describes the graph, and
``graphviz``, which only talks to the separate `Graphviz
`_ ``dot`` **executable** that actually
renders it as an image. Both Python packages install automatically with
PyCropML below, but the ``dot`` executable itself is a system-level
dependency that pip cannot install for you. Without it, ``cyml -p ...``
fails as soon as a package links more than one ModelUnit, with::

    graphviz.backend.execute.ExecutableNotFound: failed to execute PosixPath('dot')

Using conda
~~~~~~~~~~~

The ``conda-forge`` channel ships the Graphviz executables alongside the
Python packages, so this route needs nothing extra::

    conda install -c amei -c openalea3 -c conda-forge pycropml

Using pip
~~~~~~~~~

PyCropML is not yet published on PyPI, so install it from a source
checkout. Install the Graphviz executables first, since pip cannot::

    conda install -c conda-forge graphviz    # inside any conda environment
    # or, on Debian/Ubuntu:
    sudo apt install graphviz

Then install PyCropML itself::

    git clone https://github.com/AgriculturalModelExchangeInitiative/PyCrop2ML.git
    cd PyCrop2ML
    pip install .

Developer installation
~~~~~~~~~~~~~~~~~~~~~~~

To work on PyCropML itself — running its test suite, building its
documentation, or modifying its generators — install it in **editable**
mode from the same source checkout, after installing Graphviz as above::

    git clone https://github.com/AgriculturalModelExchangeInitiative/PyCrop2ML.git
    cd PyCrop2ML
    pip install -e ".[test,doc]"

``-e`` (editable) makes changes under ``src/pycropml`` take effect
immediately, with no reinstall step in between — the workflow used
throughout PyCropML's own test suite. ``[test,doc]`` pulls in ``pytest``
and the Sphinx toolchain declared as optional dependencies in
``pyproject.toml``; drop the extras (``pip install -e .``) for a plain
editable install.

Usage
=====

From Platforms to Crop2ML
~~~~~~~~~~~~~~~~~~~~~~~~~

    cyml -c name_of_the_component_repository absolute_path_of_the_output source_language_or_platform

From Crop2ML to Platforms
~~~~~~~~~~~~~~~~~~~~~~~~~

    cyml -p name_of_the_Crop2ML_package target_language_or_platform

Testing
=======

Run the test suite using pytest or unittest:

Using pytest
~~~~~~~~~~~~
::

    # Run all tests
    python -m pytest test/cyml/test_cyml_operations.py -v
    
    # Run a specific test class
    python -m pytest test/cyml/test_cyml_operations.py::TestCyMLOperations -v
    
    # Run a single test
    python -m pytest test/cyml/test_cyml_operations.py::TestCyMLOperations::test_modulo_operation -v

Using unittest
~~~~~~~~~~~~~~
::

    cd test/cyml
    python -m unittest test_cyml_operations

        

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: >-
  PyCrop2ML : Python library to exchange and reuse crop
  model compponents between languages and platforms 
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Cyrille Ahmed
    family-names: Midingoyi
    affiliation: CIRAD
    email: cyrille_ahmed.midingoyi@cirad.fr
  - given-names: Christophe
    family-names: Pradal
    email: christophe.pradal@cirad.fr
    affiliation: CIRAD
    orcid: 'https://orcid.org/0000-0002-2555-761X'
  - given-names: 'Andreas '
    family-names: Enders
    affiliation: >-
      Institute of Crop Science and Resource Conservation
      (INRES), University of Bonn, Bonn, Germany,
  - given-names: Davide
    family-names: Fumagalli
    affiliation: Institute for Environment and Sustainability
  - given-names: Patrice
    family-names: Lecharpentier
    affiliation: INRAE
  - given-names: 'Hélène '
    family-names: Raynal
    affiliation: INRAE
  - given-names: 'Marcello '
    family-names: Donatelli
    affiliation: CREAA
  - given-names: Ioannis N.
    family-names: Athanasiadis
    affiliation: 'Wageningen University, Wageningen, The Netherlands'
  - given-names: 'Cheryl '
    family-names: Porter
    affiliation: >-
      Agricultural & Biological Engineering, University of
      Florida, Gainesville, USA
  - given-names: 'Gerrit '
    family-names: Hoogenboom
    affiliation: >-
      Agricultural & Biological Engineering, University of
      Florida, Gainesville, USA
  - given-names: 'Fabio '
    family-names: Oliveira
    affiliation: >-
      Agricultural & Biological Engineering, University of
      Florida, Gainesville, USA
  - given-names: 'Dean '
    family-names: Holzworth
    affiliation: 'CSIRO Agriculture and Food, Toowoomba, Australia'
  - given-names: Pierre
    family-names: Martre
    affiliation: INRAE
    email: pierre.martre@inrae.fr
repository-code: >-
  https://github.com/AgriculturalModelExchangeInitiative/PyCrop2ML
url: 'https://crop2ml.org'
abstract: >-
  The increasing impact of climate change and variability on
  food security and agriculture, and the need for
  agroecological transition require improving the
  performance of crop simulation models and to model new
  biophysical processes to tackle new challenges. Recently,
  the Agricultural Models Exchange Initiative (AMEI)
  proposed Crop2ML, an open-source modeling framework for
  exchanging and reusing crop model components between
  modeling platforms. This framework provides a unified
  description of model components at a high level of
  abstraction based on shared concepts, lifting constraints
  of modeling platforms through an automatic system that
  transforms high-level models into platform-compliant
  components. This paper presents an approach based on
  reverse engineering to automatically extract and transform
  meta-information and algorithms of existing crop model
  processes into a platform-independent model component. A
  search algorithm using Crop2ML concepts, and a many-to-one
  transformation system was adopted as the main reverse
  engineering techniques to produce high-level models. The
  system consists in parsing the codebase of model
  components from different high-level languages (Python, R,
  Java, C++, C#, and Fortran) using the ANother Tool for
  Language Recognition (ANTLR) parser generator and
  processing the generated syntax trees to produce the
  various model implementations. It is implemented and
  evaluated on three crop model components: an energy
  balance model provided by BioMA platform and two soil
  temperature models provided by SIMPLACE and DSSAT
  platforms. We demonstrated the extensibility of our
  approach with the STICS, OpenAlea, and SiriusQuality
  modeling platforms. CyMLTx is a significant contribution
  towards the interoperability of crop modeling platforms
  and the reuse of crop model components beyond programming
  languages. It will thus contribute to foster model
  intercomparison and improvement activities. 
keywords:
  - Crop2ML
  - AMEI
  - Crop Model
  - DSSAT
  - SimPlace
  - STICS
  - APSIM
  - OpenAlea
  - BioMA
  - RECORD
license: CECILL-C

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 1 day ago

Total Commits: 696
Total Committers: 12
Avg Commits per committer: 58.0
Development Distribution Score (DDS): 0.312

Commits in past year: 89
Committers in past year: 4
Avg Commits per committer in past year: 22.25
Development Distribution Score (DDS) in past year: 0.416

Name Email Commits
cyrillemidingoyi a****i@y****r 479
pradal c****l@i****r 180
Michael Berg-Mohnicke m****g@z****e 15
Cyrille Ahmed MIDINGOYI m****y@S****N 8
lorenefifame l****e@g****m 3
Nicolas Brichet n****t@i****r 3
Teiki RAIHAUTI r****i@s****n 2
Cyril c****l@l****n 2
Teiki RAIHAUTI r****i@S****N 1
Nicolas Brichet n****t@i****r 1
MIDINGOYI M****I@l****n 1
Cyrille Ahmed MIDINGOYI m****y@s****n 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 45
Total pull requests: 157
Average time to close issues: over 1 year
Average time to close pull requests: 18 days
Total issue authors: 8
Total pull request authors: 5
Average comments per issue: 1.13
Average comments per pull request: 0.15
Merged pull request: 145
Bot issues: 0
Bot pull requests: 1

Past year issues: 8
Past year pull requests: 17
Past year average time to close issues: about 2 months
Past year average time to close pull requests: 17 days
Past year issue authors: 3
Past year pull request authors: 3
Past year average comments per issue: 2.63
Past year average comments per pull request: 0.41
Past year merged pull request: 14
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/agriculturalmodelexchangeinitiative/pycrop2ml

Top Issue Authors

  • pradal (22)
  • orianebro (9)
  • cyrillemidingoyi (5)
  • TeikiRaihauti (4)
  • plecharpent (2)
  • hol353 (1)
  • hugdlp (1)
  • PierrickRoyer (1)

Top Pull Request Authors

  • cyrillemidingoyi (119)
  • pradal (27)
  • bergm (7)
  • TeikiRaihauti (3)
  • dependabot[bot] (1)

Top Issue Labels

  • enhancement (3)

Top Pull Request Labels

  • dependencies (1)

Package metadata

proxy.golang.org: github.com/agriculturalmodelexchangeinitiative/pycrop2ml

proxy.golang.org: github.com/AgriculturalModelExchangeInitiative/PyCrop2ML


Dependencies

requirements.txt pypi
  • Cython *
  • IPython *
  • antlr4-python3-runtime *
  • graphviz *
  • nbformat *
  • nbsphinx *
  • networkx *
  • numpy *
  • path.py *
  • pydot *
  • pytest *
  • pytest-mock *
  • pyyaml *
  • six *
  • sphinx *
  • unyt *
.github/workflows/codeql-analysis.yml actions
  • actions/checkout v3 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/autobuild v2 composite
  • github/codeql-action/init v2 composite
.github/workflows/conda-package-build.yml actions
  • actions/checkout v3 composite
  • haya14busa/action-cond v1 composite
  • openalea/action-build-publish-anaconda v0.1.4 composite
Dockerfile docker
  • continuumio/conda-ci-linux-64-python3.7 latest build
doc/environment.yml conda
  • pycropml
  • python
  • sphinx_rtd_theme
src/pycropml/transpiler/antlr_py/tests/examples/SimplaceComponent/Simplace_SoilTemperature/src/py/setup.py pypi
  • opencv-python *
src/pycropml/transpiler/antlr_py/tests/examples/SiriusComponent/phenology/original/src/py/setup.py pypi
  • opencv-python *
.github/workflows/tests.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
doc/requirements-rtd.txt pypi
  • nbsphinx *
  • sphinx *
  • sphinx-rtd-theme *
pyproject.toml pypi
  • antlr4-python3-runtime ==4.8
  • cython >=0.29.37,<3
  • graphviz *
  • ipython *
  • nbformat *
  • networkx *
  • numpy *
  • pandas *
  • pydot *
  • pyyaml *
  • unyt *
  • xmlformatter *
example/Monica_SoilTemp/src/py/setup.py pypi
  • opencv-python *

Score: -Infinity