gddPy
Description
This Python library is intended for agriculture professionals interested in calculating growing degree days (GDD). GDD is also known as heat units or thermal units.
Installation and Initial Usage
To begin using the library, install it using one of the following commands based on your system and package management strategy:
pip install gddPy
pip3 install gddPy
poetry add gddPy
Next, here's a quick example of using the library:
from gddPy import GDD
gdd = GDD()
gdd.min_temp = 34
gdd.max_temp = 60
gdd.threshold_low = 40
heat_units = gdd.calcDailyAverage() # should calculate to 7
Detailed Description
The library supports the following properties:
| Property | Description |
|---|---|
| min_temp | low temperature for the day |
| max_temp | high temperature for the day |
| threshold_low | base threshold to begin accruing |
| min_temp_cutoff | optional limit for min_temp |
| max_temp_cutoff | optional limit for max_temp |
Each property may be set when creating a new GDD() instance as a dictionary property
params = {
"min_temp": 34,
"max_temp": 60,
"threshold_low": 40
}
gdd = GDD(params)
The following calculation methods are supported, each with a description of the formula
DailyAverage
The Daily Average method is the simplest approach to calculate GDD. The formula takes the average temperature for the day and subtracts the lower threshold from it1.
$\text{GDD} = \frac{T_{\text{max}} + T_{\text{min}}}{2} - TH_{\text{low}}$
Baskerville-Emin
The Baskerville-Emin method is a more complex approach to calculate GDD that is preferable in regions with larger temperature fluctuations2.
$\text{GDD} = \frac{w \cdot \sqrt{1 - \left(\theta\right)^2} - (TH_{\text{low}} - T_{\text{avg}}) \cdot \arccos\left(\theta\right)}{\pi}$
where...
- $w =$ Half of the Daily Temperature Range
- $T_{\text{avg}} =$ Average Temperature
- $TH_{\text{low}} =$ Lower Threshold
- $\theta = \frac{TH_{\text{low}} - T_{\text{avg}}}{w}$
Hourly Utilization
The Hourly Utilization method is a more precise approach to calculate GDD that requires hourly temperature readings to determine the thermal accumulation for each hour individually.
$\text{GDD} = \frac{\sum_{h=1}^{24} \max\left( T_{h} - TH_{\text{low}}, 0 \right)}{24}$
Although the formula above assumes a whole day (24 hours) this library is able to calculate partial days by providing less than 24 temperature values to hourly_temps
gdd = GDD()
gdd.threshold_low = 34
gdd.hourly_temps = [32,36,51,60,74,75,70,66,63,61]
heat_units = gdd.calcHourlyUtilization()
Using min_temp_cutoff and max_temp_cutoff
To use min_temp_cutoff and/or max_temp_cutoff, pass a dictionary to any calculation method setting flags to True.
temperature_data = {
"min_temp": 34,
"max_temp": 60,
"min_temp_cutoff": 35,
"max_temp_cutoff": 55,
"threshold_low": 40
}
gdd = GDD(temp_data)
params = {
"cutoff_min_temp": True,
"cutoff_max_temp": True
}
heat_units = gdd.calcDailyAverage(params) # equals 5
Changelog
- v1.0.3 | January 30, 2024: Added
calcHourlyUtilization()method, which requiresthreshold_lowandhourly_tempsto be set. Added two propertiesmin_temp_cutoffandmax_temp_cutoffthat can be used with any of the calculation methods by passinguse_min_cutoff = Trueoruse_max_cutoff = True
Metadata
Release files for gddPy 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| gddpy-1.0.3.tar.gz | 4.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gddpy-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / gddpy-1.0.3.tar.gz
| Download URL | gddpy-1.0.3.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
704eaed03e53c0f234f962cdcb4c349ba6fe732fb20fb53599cc5255ef45b6d5
|
|
BLAKE2b-256 checksum How to use checksums |
072926cccb4cc55e25850511b8f9865af9ba7160e8e23033d9db05e27ee33d16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.1 Darwin/23.2.0
|
Release files / gddpy-1.0.3-py3-none-any.whl
| Download URL | gddpy-1.0.3-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47ffcec152d367c4341414e48df63902c6f2636ad241e9cc9d0e986d93ee52f9
|
|
BLAKE2b-256 checksum How to use checksums |
e044b8c926bd8b11afcfddb89af3eaf7bb30bbdc64a3d9fd1cbecf7af08d78a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.1 Darwin/23.2.0
|
Security for gddPy 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.