PCSE


NamePCSE JSON
Version 6.0.9 PyPI version JSON
download
home_pagehttp://github.com/ajwdewit/pcse/
SummaryFramework for developing crop simulation models, includes an implementation of the WOFOST and LINTUL crop simulation models and the LINGRA grassland simulation model.
upload_time2025-01-22 14:34:23
maintainerNone
docs_urlNone
authorAllard de Wit
requires_pythonNone
licenseEUPL
keywords
VCS
bugtrack_url
requirements SQLAlchemy PyYAML openpyxl requests pandas traitlets-pcse dotmap
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Python Crop Simulation Environment - PCSE
=========================================

PCSE is a framework developed for implementing crop simulation models developed in
Wageningen. Many of the Wageningen crop simulation models were originally developed
in FORTRAN77 or using the FORTRAN Simulation Translator (`FST`_). Although this
approach has yielded high quality models with high numerical performance, the
inherent limitations of models written in FORTRAN is also becoming increasingly evident:

* The structure of the models is often rather monolithic and the different parts are
  very tightly coupled. Replacing parts of the model with another simulation approach
  is not easy.
* The models rely on file-based I/O which is difficult to change. For example,
  interfacing with databases is complicated in FORTRAN.
* In general, with low-level languages like FORTRAN, simple things already take many
  lines of code and mistakes are easily made, particularly by agronomists and crop
  scientist that have limited experience in developing or adapting software.

To overcome many of the limitations above, the Python Crop Simulation Environment
(PCSE) was developed which provides an environment for developing simulation models
as well as a number of implementations of crop simulation models. PCSE is written
in pure python code which makes it more flexible, easier to modify and extensible
allowing easy interfacing with databases, graphical user interfaces, visualization
tools and numerical/statistical packages. PCSE has several interesting features:

* Implementation in pure python with dependencies only on popular packages available from
  the Python Package Index (PyPI) (`SQLAlchemy`, `PyYAML`, `pandas`, `Openpyxl`, `xlrd`,
  `requests` and `numpy`)

* Modular design allowing you to add or change components relatively quickly with
  a simple but powerful approach to communicate variables between modules.

* Similar to `FST`_, it enforces good model design by explicitly separating parameters,
  rate variables and state variables. Moreover PCSE takes care of the module
  initialization, calculation of rates of changes, updating of state variables
  and actions needed to finalize the simulation.

* Input/Output is completely separated from the simulation model itself. Therefore
  PCSE models can easily read from and write to text files, databases and scientific
  formats such as HDF or NetCDF.

* Tools are available for reading parameter and weather files from existing models to
  have as much backward compatibility as possible.

* An `AgroManager` module which allows to define the agromanagement actions that
  happen on a farmers field. Such actions can be specified as events based on
  time or model state.

* Built-in testing of program modules ensuring integrity of the system.

To contribute to PCSE, you can fork your own copy at https://github.com/ajwdewit/pcse

Full documentation is available on http://pcse.readthedocs.io


Testing PCSE
------------

The PCSE package has some built-in tests that can used to test if any PCSE installation is
producing the correct outputs::

    >>> pcse.test()
    runTest (pcse.tests.test_abioticdamage.Test_FROSTOL) ... ok
    runTest (pcse.tests.test_partitioning.Test_DVS_Partitioning) ... ok
    runTest (pcse.tests.test_evapotranspiration.Test_PotentialEvapotranspiration) ... ok
    runTest (pcse.tests.test_wofost.TestWaterlimitedWinterWheat) ... ok

    ...

    runTest (pcse.tests.test_wofost.TestWaterlimitedGrainMaize) ... ok
    runTest (pcse.tests.test_wofost.TestPotentialPotato) ... ok
    runTest (pcse.tests.test_wofost80.TestWOFOST80_Potential_WinterWheat) ... ok
    runTest (pcse.tests.test_wofost80.TestWOFOST80_WaterLimited_WinterWheat) ... ok

    ----------------------------------------------------------------------
    Ran 32 tests in 39.809s

    OK

If the model output matches the expected output the test will report 'OK',
otherwise an error will be produced with a detailed traceback on where the
problem occurred. Note that the results may deviate from the output above
when tests were added or removed.

On top of the built-in tests, a larger suite of tests is available in the
git repository of PCSE. The latter also includes tests of the LINGRA model
which are not included in the internal tests. The tests can be execute through
the `tests` package::

    (py3_pcse) $ python -m tests
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_potentialproduction_wofost72_01.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_potentialproduction_wofost72_11.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_potentialproduction_wofost72_21.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_potentialproduction_wofost72_31.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_potentialproduction_wofost72_41.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_waterlimitedproduction_wofost72_01.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_waterlimitedproduction_wofost72_11.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_waterlimitedproduction_wofost72_21.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_waterlimitedproduction_wofost72_31.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_waterlimitedproduction_wofost72_41.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_LINGRA_Belgium-Michamps-1986_PP.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_LINGRA_Netherlands-Zegveld-1986_PP.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_LINGRA_Belgium-Michamps-1986_WLP.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_LINGRA_Netherlands-Zegveld-1986_WLP.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_LINGRA_Belgium-Michamps-1986_NWLP.yaml) ... ok
    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_LINGRA_Netherlands-Zegveld-1986_NWLP.yaml) ... ok

    ----------------------------------------------------------------------
    Ran 16 tests in 101.956s

    OK

By default this runs a limited selection of tests. The full test suite can be run with::

    (py3_pcse) $ python -m tests --full

But this will take at least 30 minutes to complete.


Comparing PCSE models against experiments
-----------------------------------------

Starting with PCSE 5.5, there is an additional folder `exp` inside the repository which contains experimental
data which can be used to compare the results from a PCSE model against. Experiments are collected in an
'experimental collection' which contains references to experiments that belong together. For example, all
experiments for potato for a given variety. Currently, the available experiments are limited to grassland for the
LINGRA model and consist of two collections. One for grassland under irrigated conditions and one for rain-fed
conditions. Tt is expected that more experimental data will be collected and stored here in order to have a
reference set to compare model results.

Running the experiments is similar to running the unit tests::

    (py3_pcse) $ python -m exp
    Writing expriment results to: /tmp/exp_results
    Processing collection for Rye grass: Potential
      - Processing experiment: LINGRA_FAO/LINGRA_FAO_experiment_000_UK2_1982.yaml
      - Processing experiment: LINGRA_FAO/LINGRA_FAO_experiment_004_SW1_1983.yaml
      - Processing experiment: LINGRA_FAO/LINGRA_FAO_experiment_006_SW1_1984.yaml

    ...

This will generate figures of simulated vs observed data in order to assess how the model
performs against experimental data. In the future, this will be extended to include a
report with error values.




.. _FST: http://models.pps.wur.nl/sites/models.pps.wur.nl/files/FST%203.pdf

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/ajwdewit/pcse/",
    "name": "PCSE",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Allard de Wit",
    "author_email": "allard.dewit@wur.nl",
    "download_url": "https://files.pythonhosted.org/packages/13/91/511c458f7702de28265828711ed10e16dc3e3b7a3756ac1f0328dc2b8f59/pcse-6.0.9.tar.gz",
    "platform": "any",
    "description": "Python Crop Simulation Environment - PCSE\n=========================================\n\nPCSE is a framework developed for implementing crop simulation models developed in\nWageningen. Many of the Wageningen crop simulation models were originally developed\nin FORTRAN77 or using the FORTRAN Simulation Translator (`FST`_). Although this\napproach has yielded high quality models with high numerical performance, the\ninherent limitations of models written in FORTRAN is also becoming increasingly evident:\n\n* The structure of the models is often rather monolithic and the different parts are\n  very tightly coupled. Replacing parts of the model with another simulation approach\n  is not easy.\n* The models rely on file-based I/O which is difficult to change. For example,\n  interfacing with databases is complicated in FORTRAN.\n* In general, with low-level languages like FORTRAN, simple things already take many\n  lines of code and mistakes are easily made, particularly by agronomists and crop\n  scientist that have limited experience in developing or adapting software.\n\nTo overcome many of the limitations above, the Python Crop Simulation Environment\n(PCSE) was developed which provides an environment for developing simulation models\nas well as a number of implementations of crop simulation models. PCSE is written\nin pure python code which makes it more flexible, easier to modify and extensible\nallowing easy interfacing with databases, graphical user interfaces, visualization\ntools and numerical/statistical packages. PCSE has several interesting features:\n\n* Implementation in pure python with dependencies only on popular packages available from\n  the Python Package Index (PyPI) (`SQLAlchemy`, `PyYAML`, `pandas`, `Openpyxl`, `xlrd`,\n  `requests` and `numpy`)\n\n* Modular design allowing you to add or change components relatively quickly with\n  a simple but powerful approach to communicate variables between modules.\n\n* Similar to `FST`_, it enforces good model design by explicitly separating parameters,\n  rate variables and state variables. Moreover PCSE takes care of the module\n  initialization, calculation of rates of changes, updating of state variables\n  and actions needed to finalize the simulation.\n\n* Input/Output is completely separated from the simulation model itself. Therefore\n  PCSE models can easily read from and write to text files, databases and scientific\n  formats such as HDF or NetCDF.\n\n* Tools are available for reading parameter and weather files from existing models to\n  have as much backward compatibility as possible.\n\n* An `AgroManager` module which allows to define the agromanagement actions that\n  happen on a farmers field. Such actions can be specified as events based on\n  time or model state.\n\n* Built-in testing of program modules ensuring integrity of the system.\n\nTo contribute to PCSE, you can fork your own copy at https://github.com/ajwdewit/pcse\n\nFull documentation is available on http://pcse.readthedocs.io\n\n\nTesting PCSE\n------------\n\nThe PCSE package has some built-in tests that can used to test if any PCSE installation is\nproducing the correct outputs::\n\n    >>> pcse.test()\n    runTest (pcse.tests.test_abioticdamage.Test_FROSTOL) ... ok\n    runTest (pcse.tests.test_partitioning.Test_DVS_Partitioning) ... ok\n    runTest (pcse.tests.test_evapotranspiration.Test_PotentialEvapotranspiration) ... ok\n    runTest (pcse.tests.test_wofost.TestWaterlimitedWinterWheat) ... ok\n\n    ...\n\n    runTest (pcse.tests.test_wofost.TestWaterlimitedGrainMaize) ... ok\n    runTest (pcse.tests.test_wofost.TestPotentialPotato) ... ok\n    runTest (pcse.tests.test_wofost80.TestWOFOST80_Potential_WinterWheat) ... ok\n    runTest (pcse.tests.test_wofost80.TestWOFOST80_WaterLimited_WinterWheat) ... ok\n\n    ----------------------------------------------------------------------\n    Ran 32 tests in 39.809s\n\n    OK\n\nIf the model output matches the expected output the test will report 'OK',\notherwise an error will be produced with a detailed traceback on where the\nproblem occurred. Note that the results may deviate from the output above\nwhen tests were added or removed.\n\nOn top of the built-in tests, a larger suite of tests is available in the\ngit repository of PCSE. The latter also includes tests of the LINGRA model\nwhich are not included in the internal tests. The tests can be execute through\nthe `tests` package::\n\n    (py3_pcse) $ python -m tests\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_potentialproduction_wofost72_01.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_potentialproduction_wofost72_11.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_potentialproduction_wofost72_21.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_potentialproduction_wofost72_31.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_potentialproduction_wofost72_41.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_waterlimitedproduction_wofost72_01.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_waterlimitedproduction_wofost72_11.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_waterlimitedproduction_wofost72_21.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_waterlimitedproduction_wofost72_31.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_waterlimitedproduction_wofost72_41.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_LINGRA_Belgium-Michamps-1986_PP.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_LINGRA_Netherlands-Zegveld-1986_PP.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_LINGRA_Belgium-Michamps-1986_WLP.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_LINGRA_Netherlands-Zegveld-1986_WLP.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_LINGRA_Belgium-Michamps-1986_NWLP.yaml) ... ok\n    runTest (tests.run_tests./home/wit015/Sources/python/pcse/tests/test_data/test_LINGRA_Netherlands-Zegveld-1986_NWLP.yaml) ... ok\n\n    ----------------------------------------------------------------------\n    Ran 16 tests in 101.956s\n\n    OK\n\nBy default this runs a limited selection of tests. The full test suite can be run with::\n\n    (py3_pcse) $ python -m tests --full\n\nBut this will take at least 30 minutes to complete.\n\n\nComparing PCSE models against experiments\n-----------------------------------------\n\nStarting with PCSE 5.5, there is an additional folder `exp` inside the repository which contains experimental\ndata which can be used to compare the results from a PCSE model against. Experiments are collected in an\n'experimental collection' which contains references to experiments that belong together. For example, all\nexperiments for potato for a given variety. Currently, the available experiments are limited to grassland for the\nLINGRA model and consist of two collections. One for grassland under irrigated conditions and one for rain-fed\nconditions. Tt is expected that more experimental data will be collected and stored here in order to have a\nreference set to compare model results.\n\nRunning the experiments is similar to running the unit tests::\n\n    (py3_pcse) $ python -m exp\n    Writing expriment results to: /tmp/exp_results\n    Processing collection for Rye grass: Potential\n      - Processing experiment: LINGRA_FAO/LINGRA_FAO_experiment_000_UK2_1982.yaml\n      - Processing experiment: LINGRA_FAO/LINGRA_FAO_experiment_004_SW1_1983.yaml\n      - Processing experiment: LINGRA_FAO/LINGRA_FAO_experiment_006_SW1_1984.yaml\n\n    ...\n\nThis will generate figures of simulated vs observed data in order to assess how the model\nperforms against experimental data. In the future, this will be extended to include a\nreport with error values.\n\n\n\n\n.. _FST: http://models.pps.wur.nl/sites/models.pps.wur.nl/files/FST%203.pdf\n",
    "bugtrack_url": null,
    "license": "EUPL",
    "summary": "Framework for developing crop simulation models, includes an implementation of the WOFOST and LINTUL crop simulation models and the LINGRA grassland simulation model.",
    "version": "6.0.9",
    "project_urls": {
        "Download": "http://github.com/ajwdewit/pcse/tarball/6.0.9",
        "Homepage": "http://github.com/ajwdewit/pcse/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9553be34b62e55a766ffb002f3e8bed3d6abf574590ed2f76b65243fbc2523cb",
                "md5": "2e4ee5b898d829a6bfed173fb762359f",
                "sha256": "0d515db59afb864d7ea8dadce83f76cc093aa8c99dc79c4cc01d5a71b2ce9bd7"
            },
            "downloads": -1,
            "filename": "PCSE-6.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2e4ee5b898d829a6bfed173fb762359f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 985721,
            "upload_time": "2025-01-22T14:34:18",
            "upload_time_iso_8601": "2025-01-22T14:34:18.887703Z",
            "url": "https://files.pythonhosted.org/packages/95/53/be34b62e55a766ffb002f3e8bed3d6abf574590ed2f76b65243fbc2523cb/PCSE-6.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1391511c458f7702de28265828711ed10e16dc3e3b7a3756ac1f0328dc2b8f59",
                "md5": "fb73d575063a1a28b449d1edb8dd190c",
                "sha256": "166c6a4db5c23b6d11b4ac301e2ad07acca438defaa431924b87acfaf6ae4fc3"
            },
            "downloads": -1,
            "filename": "pcse-6.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "fb73d575063a1a28b449d1edb8dd190c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 855788,
            "upload_time": "2025-01-22T14:34:23",
            "upload_time_iso_8601": "2025-01-22T14:34:23.055257Z",
            "url": "https://files.pythonhosted.org/packages/13/91/511c458f7702de28265828711ed10e16dc3e3b7a3756ac1f0328dc2b8f59/pcse-6.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-22 14:34:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ajwdewit",
    "github_project": "pcse",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "SQLAlchemy",
            "specs": [
                [
                    "<",
                    "2.0"
                ],
                [
                    ">=",
                    "1.3"
                ]
            ]
        },
        {
            "name": "PyYAML",
            "specs": [
                [
                    ">=",
                    "5.1"
                ]
            ]
        },
        {
            "name": "openpyxl",
            "specs": [
                [
                    ">=",
                    "3.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "0.25"
                ]
            ]
        },
        {
            "name": "traitlets-pcse",
            "specs": [
                [
                    "==",
                    "5.0.0.dev"
                ]
            ]
        },
        {
            "name": "dotmap",
            "specs": [
                [
                    ">=",
                    "1.3"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "pcse"
}
        
Elapsed time: 1.23523s