Open Sustainable Technology

A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

Browse accepted projects | Review proposed projects | Propose new project | Open Issues

PCSE

A framework developed for implementing crop simulation models developed in Wageningen.
https://github.com/ajwdewit/pcse

Last synced: about 21 hours ago
JSON representation

Repository metadata

Repository for the Python Crop Simulation Environment

README

        

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


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 2 days ago

Total Commits: 379
Total Committers: 15
Avg Commits per committer: 25.267
Development Distribution Score (DDS): 0.243

Commits in past year: 11
Committers in past year: 2
Avg Commits per committer in past year: 5.5
Development Distribution Score (DDS) in past year: 0.091

Name Email Commits
Allard de Wit a****t@x****l 287
hoek008 s****k@w****l 38
unknown w****5@D****l 10
Ivan Orzan i****n@g****m 10
Zacharias Steinmetz s****z@p****e 7
ajwdewit w****5@L****l 6
Marek Petrik m****k@p****s 6
fanquake f****e@g****m 3
Wit w****5@D****l 2
Julien Malard j****d@m****a 2
solid 1****3@q****m 2
Christian Clauss c****s@m****m 2
Abraham Gomez a****6@a****u 2
Michiel Kallenberg 1
Hiske Overweg h****g@w****l 1

Committer domains:


Issue and Pull Request metadata

Last synced: 2 days ago

Total issues: 55
Total pull requests: 31
Average time to close issues: about 1 month
Average time to close pull requests: about 1 month
Total issue authors: 43
Total pull request authors: 16
Average comments per issue: 2.65
Average comments per pull request: 1.23
Merged pull request: 17
Bot issues: 0
Bot pull requests: 0

Past year issues: 7
Past year pull requests: 4
Past year average time to close issues: 21 days
Past year average time to close pull requests: 15 days
Past year issue authors: 6
Past year pull request authors: 3
Past year average comments per issue: 1.0
Past year average comments per pull request: 1.75
Past year merged pull request: 2
Past year bot issues: 0
Past year bot pull requests: 0

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

Top Issue Authors

  • brsilvarec (3)
  • lwq-star (2)
  • krsnapaudel (2)
  • ncaspari (2)
  • iMarang (2)
  • NickAlexander18 (2)
  • gausie (2)
  • shuaijieshen (2)
  • sqwev (2)
  • AlChen94 (2)
  • agnaru (2)
  • sulekahraman (1)
  • S-lac (1)
  • sjbphd (1)
  • Tessavankleef (1)

Top Pull Request Authors

  • julienmalard (4)
  • zsteinmetz (3)
  • fanquake (3)
  • sbhoek (3)
  • marekpetrik (3)
  • michielkallenberg (3)
  • burggraaff (2)
  • HiskeOverweg (2)
  • cclauss (1)
  • ajwdewit (1)
  • Amarounek (1)
  • Jiang2019Code (1)
  • abegomez (1)
  • LeaTresch (1)
  • sbe123 (1)

Top Issue Labels

Top Pull Request Labels


Package metadata

pypi.org: pcse

Framework for developing crop simulation models, includes an implementation of the WOFOST and LINTUL crop simulation models and the LINGRA grassland simulation model.

  • Homepage: http://github.com/ajwdewit/pcse/
  • Documentation: https://pcse.readthedocs.io/
  • Licenses: EUPL
  • Latest release: 5.5.6 (published 3 months ago)
  • Last Synced: 2024-05-10T09:05:30.083Z (2 days ago)
  • Versions: 20
  • Dependent Packages: 1
  • Dependent Repositories: 10
  • Downloads: 503 Last month
  • Rankings:
    • Forks count: 4.356%
    • Dependent repos count: 4.669%
    • Stargazers count: 5.724%
    • Average: 6.638%
    • Dependent packages count: 7.303%
    • Downloads: 11.136%
  • Maintainers (1)

Dependencies

requirements.txt pypi
  • PyYAML >=3.11
  • SQLAlchemy >=0.8.0
  • numpy >=1.6.0
  • openpyxl >=3.0
  • pandas >=0.20
  • requests >=2.0.0
  • traitlets-pcse ==5.0.0.dev
setup.py pypi
  • PyYAML >=5.1
  • SQLAlchemy >=1.3.0
  • openpyxl >=3.0.0
  • pandas >=0.25
  • requests >=2.0.0
  • traitlets-pcse ==5.0.0.dev

Score: 14.122701096804098