pywheat


Namepywheat JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/egiron/pywheat
SummaryPython library for simulation of wheat phenological development, crop growth and yield at large scales
upload_time2024-06-05 01:40:37
maintainerNone
docs_urlNone
authorErnesto Giron Echeverry
requires_python>=3.9
licenseGPLv3+
keywords wheat crop modeling
VCS
bugtrack_url
requirements numpy numba pandas scikit-learn scipy tqdm seaborn Shapely ipython duckdb pyarrow
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <a href="https://egiron.github.io/pywheat/">
    <img src="https://raw.githubusercontent.com/egiron/pywheat/master/docs/assets/logo_iwin2.png"  alt="IWIN tools library">
  </a>
</p>

<p align="center"><h1 align="center">Welcome to PyWheat</h1></p>

<p align="center">
  <!-- <a href="https://orderseed.cimmyt.org/iwin-results.php"><img
    src="https://img.shields.io/badge/CIMMYT-IWIN-blue"
    alt="CIMMYT IWIN"
  /></a> -->
  <a href="https://github.com/egiron/pywheat/actions"><img
    src="https://github.com/egiron/pywheat/actions/workflows/ci.yaml/badge.svg"
    alt="Build"
  /></a>
  <a href="https://pypistats.org/packages/pywheat"><img
    src="https://img.shields.io/pypi/dm/pywheat.svg" 
    alt="Downloads"
  /></a>
  <a href="https://pypi.org/project/pywheat"><img 
    src="https://img.shields.io/pypi/v/pywheat.svg" 
    alt="Python Package Index"
  /></a>
  <a href="https://opensource.org/licenses/"><img 
    src="https://img.shields.io/badge/License-GPL%20v3-yellow.svg" 
    alt="GPLv3 License"
  /></a>
  
</p>

Python library for simulation of wheat phenological development, crop growth and yield at large scales.

# Intro

The PyWheat simulates the wheat growth and development in a daily time-step at field, local, regional and global scales. Most of the algorithms are based on the original Fortran routines of the CERES-Wheat 2.0[^1]. 

To accurately simulate wheat growth, development, and yield, the model takes into account the following processes:

* Phenological development, especially as it is affected by genetics and weather.
* Extension growth of leaves, stems, and roots.
* Biomass accumulation and partitioning, especially reproductive organs.
* Soil water balance and water use by the crop.


## Quick start

The package for estimating wheat grain yield using pywheat can be installed with `pip`:

``` sh
pip install pywheat
```

For detailed installation instructions visit [installation]

This will add a command-line interface (CLI) that you can then use like so:
``` sh
pywheat
```
This simple command shows the following message:
``` sh
Usage: pywheat [OPTIONS] COMMAND [ARGS]...

Options:
  -h, --help  Show this message and exit.

Commands:
  pheno
  phenology

```

You can see two functions or commands you will be able to run. Use the help option (-h) to see how to proceed.

``` sh
pywheat phenology -h
```

```
Usage: pywheat phenology [OPTIONS]

Options:
  -lat, --latitude FLOAT       Latitude of the site  [required]
  -lon, --longitude FLOAT      Longitude of the site
  -sd, --sowing_date TEXT      Sowing date of the crop. eg. 1972-03-13
                               [required]
  -tbase, --tbase FLOAT        Base temperature for estimate Thermal time.
                               Default 0.0
  -tt_topt, --tt_topt FLOAT    Thermal time optimum temperature. Default 26
  -tt_tmax, --tt_tmax FLOAT    Thermal time maximum temperature. Default 34
  -sa, --sunangle FLOAT        Sun angle with the horizon. eg. p = 6.0 : civil
                               twilight. Default 0.0
  -sn, --snow FLOAT            Snow fall. Default 0.0
  -sdepth, --sdepth FLOAT      Sowing depth in cm. Default 3.0 cm
  -gdde, --gdde FLOAT          Growing degree days per cm seed depth required
                               for emergence, Default 6.2 GDD/cm.
  -dsgft, --dsgft FLOAT        GDD from End Ear Growth to Start Grain Filling
                               period. Default 200 degree-days
  -vreq, --vreq FLOAT          Vernalization required for max.development rate
                               (VDays). Default 505 degree-days
  -phint, --phint FLOAT        Phyllochron. A good estimate for PHINT is 95
                               degree days. This value for PHINT is
                               appropriate except for spring sown wheat in
                               latitudes greater than 30 degrees north and 30
                               degrees south, in which cases a value for PHINT
                               of 75 degree days is suggested. Default 95.0
                               degree-days
  -p1v, --p1v FLOAT            Development genetic coefficients,
                               vernalization. 1 for spring type, 5 for winter
                               type. Default 4.85
  -p1d, --p1d FLOAT            Development genetic coefficients, Photoperiod
                               (1 - 6, low- high sensitive to day length).
                               Default 3.675
  -p5, --p5 FLOAT              Grain filling degree days. Old value was
                               divided by 10. Default 500 degree-days.
  -p6, --p6 FLOAT              Approximate the thermal time from physiological
                               maturity to harvest. Default 250.
  -glim, --glim FLOAT          Threshold for days to germination. Default 40
  -elim, --elim FLOAT          Threshold for thermal time to emergence.
                               Default 300
  -tdu, --tdu FLOAT            Threshold for thermal development units (TDU).
                               Default 400
  -fmt, --inputformat TEXT     File format of the input weather file. Options
                               CSV, DSSAT .WTH or Parquet
  -ofmt, --outputformat TEXT   File format of the output phenology file.
                               Options txt or csv
  -best, --bestmodel BOOLEAN   Use the calibration parameters to estimate
                               phenology
  -w, --weather FILE           Path to input weather file in CSV or Parquet
                               format  [required]
  -o, --output FILE            Path to output phenology file.
  -verbose, --verbose BOOLEAN  Display comments
  -h, --help                   Show this message and exit.
```

### Usage in CLI
``` sh
pywheat phenology -lat 37.18 -lon -99.75 -sd '1981-10-16' \
 -w ./pywheat/data/example/KSAS.WTH -fmt wth -o ./outputs.txt -verbose False
```

The above instruction use 3 variables (_latitude, longitude and sowing date of the site_) to run the phenology model. It also requires the path of the weather data file in this case in DSSAT format. This will take a minute or so at the first time to compile the main functions and save them to the cache. Next time will be much faster.

```
RSTG   GROWTH STAGE      DAP  DOY   CROP AGE   SUMDTT   DATE 
7      Sowing              0  289      0            0   1981-10-16
8      Germinate           1  290      1           28   1981-10-17
9      Emergence           5  294      5           66   1981-10-21
1      Term Spklt         36  325     31         1683   1981-11-21
2      End Veg           147   71    111          290   1982-03-12
3      End Ear Gr        169   93     22          202   1982-04-03
4      Beg Gr Fil        184  108     15          158   1982-04-18
5      End Gr Fil        214  138     30          459   1982-05-18
6      Harvest           228  152     14          267   1982-06-01
```

For detailed instructions of how-to get started, configuration options, and a demo, visit [Getting Started]

  [installation]: installation.md
  [Getting Started]: getting_started.md



## Feedback

If you have any feedback, please reach out to us at [Feedback](mailto://e.giron.e@gmail.com)


## FAQ

Please read out [frequently asked questions](faq.md) before you send an email.

## Authors

- [@egiron](https://www.github.com/egiron)


## License

**MIT License**

Copyright (c) 2023 

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.


**Additional License** please check out [License](license.md)

<p align="center"><strong>Sponsors</strong></p>
<p align="center">
  <a href="https://www.cimmyt.org/" target=_blank><img
    src="./docs/assets/logoCIMMYT_letters.png" height="auto" width="200"
  /></a>
</p>
<p>&nbsp;</p>


  [^1]: CERES-Wheat version 2.0 by Dr. Joe T. Ritchie and Dr. Doug Godwin. https://nowlin.css.msu.edu/wheat_book/

  [^2]: DSSAT. https://dssat.net/

  [^3]: The Agricultural Production Systems sIMulator (APSIM). https://www.apsim.info/

  [^4]: Ritchie, J.T.1991. Wheat phasic development. p. 31-54. In Hanks and Ritchie (ed.) Modeling plant and soil systems. Agron. Monogr. 31, ASA, CSSSA, SSSA, Madison, WI. 
  
  [^5]: Ritchie, J.T. and D.S. NeSmith. 1991. Temperature and Crop Development. p. 5-29. In Hanks and Ritchie (ed.) Modeling plant and soil systems. Agron. Monogr. 31, ASA, CSSSA, SSSA, Madison, WI. 
 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/egiron/pywheat",
    "name": "pywheat",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "wheat, crop modeling",
    "author": "Ernesto Giron Echeverry",
    "author_email": "e.giron.e@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e6/3b/7e3ed6bf53fdc4518c47531102220a118c925a37936ddbb82d08e0504005/pywheat-0.1.1.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n  <a href=\"https://egiron.github.io/pywheat/\">\n    <img src=\"https://raw.githubusercontent.com/egiron/pywheat/master/docs/assets/logo_iwin2.png\"  alt=\"IWIN tools library\">\n  </a>\n</p>\n\n<p align=\"center\"><h1 align=\"center\">Welcome to PyWheat</h1></p>\n\n<p align=\"center\">\n  <!-- <a href=\"https://orderseed.cimmyt.org/iwin-results.php\"><img\n    src=\"https://img.shields.io/badge/CIMMYT-IWIN-blue\"\n    alt=\"CIMMYT IWIN\"\n  /></a> -->\n  <a href=\"https://github.com/egiron/pywheat/actions\"><img\n    src=\"https://github.com/egiron/pywheat/actions/workflows/ci.yaml/badge.svg\"\n    alt=\"Build\"\n  /></a>\n  <a href=\"https://pypistats.org/packages/pywheat\"><img\n    src=\"https://img.shields.io/pypi/dm/pywheat.svg\" \n    alt=\"Downloads\"\n  /></a>\n  <a href=\"https://pypi.org/project/pywheat\"><img \n    src=\"https://img.shields.io/pypi/v/pywheat.svg\" \n    alt=\"Python Package Index\"\n  /></a>\n  <a href=\"https://opensource.org/licenses/\"><img \n    src=\"https://img.shields.io/badge/License-GPL%20v3-yellow.svg\" \n    alt=\"GPLv3 License\"\n  /></a>\n  \n</p>\n\nPython library for simulation of wheat phenological development, crop growth and yield at large scales.\n\n# Intro\n\nThe PyWheat simulates the wheat growth and development in a daily time-step at field, local, regional and global scales. Most of the algorithms are based on the original Fortran routines of the CERES-Wheat 2.0[^1]. \n\nTo accurately simulate wheat growth, development, and yield, the model takes into account the following processes:\n\n* Phenological development, especially as it is affected by genetics and weather.\n* Extension growth of leaves, stems, and roots.\n* Biomass accumulation and partitioning, especially reproductive organs.\n* Soil water balance and water use by the crop.\n\n\n## Quick start\n\nThe package for estimating wheat grain yield using pywheat can be installed with `pip`:\n\n``` sh\npip install pywheat\n```\n\nFor detailed installation instructions visit [installation]\n\nThis will add a command-line interface (CLI) that you can then use like so:\n``` sh\npywheat\n```\nThis simple command shows the following message:\n``` sh\nUsage: pywheat [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  -h, --help  Show this message and exit.\n\nCommands:\n  pheno\n  phenology\n\n```\n\nYou can see two functions or commands you will be able to run. Use the help option (-h) to see how to proceed.\n\n``` sh\npywheat phenology -h\n```\n\n```\nUsage: pywheat phenology [OPTIONS]\n\nOptions:\n  -lat, --latitude FLOAT       Latitude of the site  [required]\n  -lon, --longitude FLOAT      Longitude of the site\n  -sd, --sowing_date TEXT      Sowing date of the crop. eg. 1972-03-13\n                               [required]\n  -tbase, --tbase FLOAT        Base temperature for estimate Thermal time.\n                               Default 0.0\n  -tt_topt, --tt_topt FLOAT    Thermal time optimum temperature. Default 26\n  -tt_tmax, --tt_tmax FLOAT    Thermal time maximum temperature. Default 34\n  -sa, --sunangle FLOAT        Sun angle with the horizon. eg. p = 6.0 : civil\n                               twilight. Default 0.0\n  -sn, --snow FLOAT            Snow fall. Default 0.0\n  -sdepth, --sdepth FLOAT      Sowing depth in cm. Default 3.0 cm\n  -gdde, --gdde FLOAT          Growing degree days per cm seed depth required\n                               for emergence, Default 6.2 GDD/cm.\n  -dsgft, --dsgft FLOAT        GDD from End Ear Growth to Start Grain Filling\n                               period. Default 200 degree-days\n  -vreq, --vreq FLOAT          Vernalization required for max.development rate\n                               (VDays). Default 505 degree-days\n  -phint, --phint FLOAT        Phyllochron. A good estimate for PHINT is 95\n                               degree days. This value for PHINT is\n                               appropriate except for spring sown wheat in\n                               latitudes greater than 30 degrees north and 30\n                               degrees south, in which cases a value for PHINT\n                               of 75 degree days is suggested. Default 95.0\n                               degree-days\n  -p1v, --p1v FLOAT            Development genetic coefficients,\n                               vernalization. 1 for spring type, 5 for winter\n                               type. Default 4.85\n  -p1d, --p1d FLOAT            Development genetic coefficients, Photoperiod\n                               (1 - 6, low- high sensitive to day length).\n                               Default 3.675\n  -p5, --p5 FLOAT              Grain filling degree days. Old value was\n                               divided by 10. Default 500 degree-days.\n  -p6, --p6 FLOAT              Approximate the thermal time from physiological\n                               maturity to harvest. Default 250.\n  -glim, --glim FLOAT          Threshold for days to germination. Default 40\n  -elim, --elim FLOAT          Threshold for thermal time to emergence.\n                               Default 300\n  -tdu, --tdu FLOAT            Threshold for thermal development units (TDU).\n                               Default 400\n  -fmt, --inputformat TEXT     File format of the input weather file. Options\n                               CSV, DSSAT .WTH or Parquet\n  -ofmt, --outputformat TEXT   File format of the output phenology file.\n                               Options txt or csv\n  -best, --bestmodel BOOLEAN   Use the calibration parameters to estimate\n                               phenology\n  -w, --weather FILE           Path to input weather file in CSV or Parquet\n                               format  [required]\n  -o, --output FILE            Path to output phenology file.\n  -verbose, --verbose BOOLEAN  Display comments\n  -h, --help                   Show this message and exit.\n```\n\n### Usage in CLI\n``` sh\npywheat phenology -lat 37.18 -lon -99.75 -sd '1981-10-16' \\\n -w ./pywheat/data/example/KSAS.WTH -fmt wth -o ./outputs.txt -verbose False\n```\n\nThe above instruction use 3 variables (_latitude, longitude and sowing date of the site_) to run the phenology model. It also requires the path of the weather data file in this case in DSSAT format. This will take a minute or so at the first time to compile the main functions and save them to the cache. Next time will be much faster.\n\n```\nRSTG   GROWTH STAGE      DAP  DOY   CROP AGE   SUMDTT   DATE \n7      Sowing              0  289      0            0   1981-10-16\n8      Germinate           1  290      1           28   1981-10-17\n9      Emergence           5  294      5           66   1981-10-21\n1      Term Spklt         36  325     31         1683   1981-11-21\n2      End Veg           147   71    111          290   1982-03-12\n3      End Ear Gr        169   93     22          202   1982-04-03\n4      Beg Gr Fil        184  108     15          158   1982-04-18\n5      End Gr Fil        214  138     30          459   1982-05-18\n6      Harvest           228  152     14          267   1982-06-01\n```\n\nFor detailed instructions of how-to get started, configuration options, and a demo, visit [Getting Started]\n\n  [installation]: installation.md\n  [Getting Started]: getting_started.md\n\n\n\n## Feedback\n\nIf you have any feedback, please reach out to us at [Feedback](mailto://e.giron.e@gmail.com)\n\n\n##\u00a0FAQ\n\nPlease read out [frequently asked questions](faq.md) before you send an email.\n\n## Authors\n\n- [@egiron](https://www.github.com/egiron)\n\n\n## License\n\n**MIT License**\n\nCopyright (c) 2023 \n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\n\n**Additional License** please check out [License](license.md)\n\n<p align=\"center\"><strong>Sponsors</strong></p>\n<p align=\"center\">\n  <a href=\"https://www.cimmyt.org/\" target=_blank><img\n    src=\"./docs/assets/logoCIMMYT_letters.png\" height=\"auto\" width=\"200\"\n  /></a>\n</p>\n<p>&nbsp;</p>\n\n\n  [^1]: CERES-Wheat version 2.0 by Dr. Joe T. Ritchie and Dr. Doug Godwin. https://nowlin.css.msu.edu/wheat_book/\n\n  [^2]: DSSAT. https://dssat.net/\n\n  [^3]: The Agricultural Production Systems sIMulator (APSIM). https://www.apsim.info/\n\n  [^4]: Ritchie, J.T.1991. Wheat phasic development. p. 31-54. In Hanks and Ritchie (ed.) Modeling plant and soil systems. Agron. Monogr. 31, ASA, CSSSA, SSSA, Madison, WI. \n  \n  [^5]: Ritchie, J.T. and D.S. NeSmith. 1991. Temperature and Crop Development. p. 5-29. In Hanks and Ritchie (ed.) Modeling plant and soil systems. Agron. Monogr. 31, ASA, CSSSA, SSSA, Madison, WI. \n \n",
    "bugtrack_url": null,
    "license": "GPLv3+",
    "summary": "Python library for simulation of wheat phenological development, crop growth and yield at large scales",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/egiron/pywheat",
        "Issue Tracking": "https://github.com/egiron/pywheat/issues"
    },
    "split_keywords": [
        "wheat",
        " crop modeling"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "44ec682c9a90871a2c8658667f80ebe5ca059f45e7048fb5502bfa8b44a5c2af",
                "md5": "5ad2860f26a1e460c9ff8f481914ffca",
                "sha256": "dbcee82e49e5150fbf461ab38f9260787bdfcffb265f30a14fc556285170454d"
            },
            "downloads": -1,
            "filename": "pywheat-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5ad2860f26a1e460c9ff8f481914ffca",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 6291954,
            "upload_time": "2024-06-05T01:40:32",
            "upload_time_iso_8601": "2024-06-05T01:40:32.965638Z",
            "url": "https://files.pythonhosted.org/packages/44/ec/682c9a90871a2c8658667f80ebe5ca059f45e7048fb5502bfa8b44a5c2af/pywheat-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e63b7e3ed6bf53fdc4518c47531102220a118c925a37936ddbb82d08e0504005",
                "md5": "8792705649edc96a5bd77d55f06975cb",
                "sha256": "e4b53862fc8d203ea5fac94bbb0d45ea1833f9372652f397af0d585b9ab92b25"
            },
            "downloads": -1,
            "filename": "pywheat-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8792705649edc96a5bd77d55f06975cb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 6193253,
            "upload_time": "2024-06-05T01:40:37",
            "upload_time_iso_8601": "2024-06-05T01:40:37.003468Z",
            "url": "https://files.pythonhosted.org/packages/e6/3b/7e3ed6bf53fdc4518c47531102220a118c925a37936ddbb82d08e0504005/pywheat-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-05 01:40:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "egiron",
    "github_project": "pywheat",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.22.4"
                ]
            ]
        },
        {
            "name": "numba",
            "specs": [
                [
                    ">=",
                    "0.51.2"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "1.5.3"
                ]
            ]
        },
        {
            "name": "scikit-learn",
            "specs": [
                [
                    ">=",
                    "1.2.2"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    ">=",
                    "1.10.1"
                ]
            ]
        },
        {
            "name": "tqdm",
            "specs": [
                [
                    ">=",
                    "4.64.0"
                ]
            ]
        },
        {
            "name": "seaborn",
            "specs": [
                [
                    ">=",
                    "0.11.0"
                ]
            ]
        },
        {
            "name": "Shapely",
            "specs": [
                [
                    ">=",
                    "1.7.1"
                ]
            ]
        },
        {
            "name": "ipython",
            "specs": [
                [
                    ">=",
                    "7.21.0"
                ]
            ]
        },
        {
            "name": "duckdb",
            "specs": [
                [
                    ">=",
                    "0.8.1"
                ]
            ]
        },
        {
            "name": "pyarrow",
            "specs": []
        }
    ],
    "lcname": "pywheat"
}
        
Elapsed time: 0.69087s