PCSE 6.0.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PCSE-6.0.9.dist-info/LICENSE +19 -0
- PCSE-6.0.9.dist-info/METADATA +187 -0
- PCSE-6.0.9.dist-info/RECORD +187 -0
- PCSE-6.0.9.dist-info/WHEEL +5 -0
- PCSE-6.0.9.dist-info/top_level.txt +3 -0
- exp/__init__.py +0 -0
- exp/__main__.py +22 -0
- exp/process_experiment_collections.py +210 -0
- exp/reduce_yaml.py +43 -0
- pcse/__init__.py +104 -0
- pcse/agromanager.py +961 -0
- pcse/base/__init__.py +16 -0
- pcse/base/config_loader.py +117 -0
- pcse/base/dispatcher.py +33 -0
- pcse/base/engine.py +105 -0
- pcse/base/parameter_providers.py +283 -0
- pcse/base/simulationobject.py +280 -0
- pcse/base/states_rates.py +421 -0
- pcse/base/variablekiosk.py +243 -0
- pcse/base/weather.py +397 -0
- pcse/conf/Alcepas10_PP.conf +38 -0
- pcse/conf/FAO_WRSI.conf +42 -0
- pcse/conf/Lingra_NWLP_FD.conf +38 -0
- pcse/conf/Lingra_PP.conf +36 -0
- pcse/conf/Lingra_WLP_FD.conf +39 -0
- pcse/conf/Lintul3.conf +40 -0
- pcse/conf/Wofost72_PP.conf +44 -0
- pcse/conf/Wofost72_Pheno.conf +38 -0
- pcse/conf/Wofost72_WLP_CWB.conf +46 -0
- pcse/conf/Wofost73_PP.conf +44 -0
- pcse/conf/Wofost73_WLP_CWB.conf +42 -0
- pcse/conf/Wofost73_WLP_MLWB.conf +42 -0
- pcse/conf/Wofost81_NWLP_CWB_CNB.conf +46 -0
- pcse/conf/Wofost81_NWLP_MLWB_CNB.conf +46 -0
- pcse/conf/Wofost81_NWLP_MLWB_SNOMIN.conf +46 -0
- pcse/conf/Wofost81_PP.conf +44 -0
- pcse/conf/Wofost81_WLP_CWB.conf +46 -0
- pcse/conf/Wofost81_WLP_MLWB.conf +47 -0
- pcse/conf/Wofost_winterkill.conf +52 -0
- pcse/conf/__init__.py +0 -0
- pcse/crop/__init__.py +18 -0
- pcse/crop/abioticdamage.py +640 -0
- pcse/crop/alcepas.py +617 -0
- pcse/crop/assimilation.py +618 -0
- pcse/crop/evapotranspiration.py +728 -0
- pcse/crop/greenlayercrop.py +123 -0
- pcse/crop/leaf_dynamics.py +767 -0
- pcse/crop/lingra.py +668 -0
- pcse/crop/lingraN.py +691 -0
- pcse/crop/lingra_ndynamics.py +454 -0
- pcse/crop/lintul3.py +893 -0
- pcse/crop/n_dynamics.py +212 -0
- pcse/crop/npk_dynamics.py +410 -0
- pcse/crop/nutrients/__init__.py +2 -0
- pcse/crop/nutrients/n_demand_uptake.py +251 -0
- pcse/crop/nutrients/n_stress.py +131 -0
- pcse/crop/nutrients/npk_demand_uptake.py +372 -0
- pcse/crop/nutrients/npk_stress.py +247 -0
- pcse/crop/nutrients/npk_translocation.py +233 -0
- pcse/crop/partitioning.py +310 -0
- pcse/crop/phenology.py +495 -0
- pcse/crop/respiration.py +107 -0
- pcse/crop/root_dynamics.py +313 -0
- pcse/crop/stem_dynamics.py +165 -0
- pcse/crop/storage_organ_dynamics.py +154 -0
- pcse/crop/wofost72.py +298 -0
- pcse/crop/wofost73.py +333 -0
- pcse/crop/wofost81.py +365 -0
- pcse/crop/wofost_winterkill.py +313 -0
- pcse/db/__init__.py +11 -0
- pcse/db/cgms12/__init__.py +13 -0
- pcse/db/cgms12/data_providers.py +809 -0
- pcse/db/cgms14/__init__.py +14 -0
- pcse/db/cgms14/data_providers.py +790 -0
- pcse/db/cgms18/__init__.py +12 -0
- pcse/db/cgms18/data_providers.py +34 -0
- pcse/db/cgms8/__init__.py +21 -0
- pcse/db/cgms8/data_providers.py +319 -0
- pcse/db/hdf5/__init__.py +2 -0
- pcse/db/hdf5/cgms2hdfstore.py +285 -0
- pcse/db/hdf5/hdf5_readers.py +609 -0
- pcse/db/pcse/__init__.py +15 -0
- pcse/db/pcse/database_definition.py +315 -0
- pcse/db/pcse/db_input.py +818 -0
- pcse/db/pcse/pcse_dump.sql +47816 -0
- pcse/db/wofost_parameters.py +18 -0
- pcse/decorators.py +99 -0
- pcse/empty_model.py +39 -0
- pcse/engine.py +558 -0
- pcse/exceptions.py +44 -0
- pcse/fileinput.py +3 -0
- pcse/input/__init__.py +34 -0
- pcse/input/cabo_reader.py +247 -0
- pcse/input/cabo_weather.py +427 -0
- pcse/input/csvweatherdataprovider.py +268 -0
- pcse/input/excelweatherdataprovider.py +259 -0
- pcse/input/nasapower.py +350 -0
- pcse/input/pcsefilereader.py +125 -0
- pcse/input/sitedataproviders.py +223 -0
- pcse/input/soildataproviders.py +28 -0
- pcse/input/yaml_agro_loader.py +29 -0
- pcse/input/yaml_cropdataprovider.py +306 -0
- pcse/models.py +260 -0
- pcse/pydispatch/__init__.py +6 -0
- pcse/pydispatch/dispatcher.py +492 -0
- pcse/pydispatch/errors.py +10 -0
- pcse/pydispatch/robust.py +57 -0
- pcse/pydispatch/robustapply.py +57 -0
- pcse/pydispatch/saferef.py +172 -0
- pcse/rerunner.py +83 -0
- pcse/settings/__init__.py +60 -0
- pcse/settings/default_settings.py +88 -0
- pcse/signals.py +205 -0
- pcse/soil/__init__.py +11 -0
- pcse/soil/classic_waterbalance.py +715 -0
- pcse/soil/lintul3soil.py +271 -0
- pcse/soil/multilayer_waterbalance.py +910 -0
- pcse/soil/n_soil_dynamics.py +178 -0
- pcse/soil/snomin.py +1107 -0
- pcse/soil/snowmaus.py +163 -0
- pcse/soil/soil_profile.py +418 -0
- pcse/soil/soil_wrappers.py +96 -0
- pcse/soil/soiln_profile.py +203 -0
- pcse/start_wofost.py +74 -0
- pcse/taskmanager.py +159 -0
- pcse/tests/__init__.py +41 -0
- pcse/tests/run_wofost.py +116 -0
- pcse/tests/test_abioticdamage.py +76 -0
- pcse/tests/test_agromanager.py +287 -0
- pcse/tests/test_assimilation.py +68 -0
- pcse/tests/test_data/10870_munchen_flughafen.csv +528 -0
- pcse/tests/test_data/2297_sweden.csv +528 -0
- pcse/tests/test_data/8011_asturias.csv +528 -0
- pcse/tests/test_data/8443_ronda.csv +403 -0
- pcse/tests/test_data/LINTUL3_reference_results.csv +226 -0
- pcse/tests/test_data/NL1.976 +390 -0
- pcse/tests/test_data/NL1.977 +389 -0
- pcse/tests/test_data/NL1.978 +391 -0
- pcse/tests/test_data/NL1.979 +389 -0
- pcse/tests/test_data/NL1.980 +390 -0
- pcse/tests/test_data/NL1.981 +389 -0
- pcse/tests/test_data/NL1.982 +389 -0
- pcse/tests/test_data/NL1.983 +389 -0
- pcse/tests/test_data/NL1.984 +390 -0
- pcse/tests/test_data/NL1.985 +389 -0
- pcse/tests/test_data/NL1.986 +391 -0
- pcse/tests/test_data/NL1.987 +416 -0
- pcse/tests/test_data/NL1.988 +413 -0
- pcse/tests/test_data/NL1.989 +430 -0
- pcse/tests/test_data/NL1.990 +397 -0
- pcse/tests/test_data/NL1.991 +272 -0
- pcse/tests/test_data/NL1.992 +397 -0
- pcse/tests/test_data/NL1.993 +394 -0
- pcse/tests/test_data/NL1.994 +394 -0
- pcse/tests/test_data/NL1.995 +394 -0
- pcse/tests/test_data/NL1.996 +397 -0
- pcse/tests/test_data/NL1.997 +394 -0
- pcse/tests/test_data/NL1.998 +394 -0
- pcse/tests/test_data/NL1.999 +394 -0
- pcse/tests/test_data/__init__.py +6 -0
- pcse/tests/test_data/evapotranspiration_testdata.py +124 -0
- pcse/tests/test_data/frostol_testdata.py +268 -0
- pcse/tests/test_data/lintul3.csv +184 -0
- pcse/tests/test_data/lintul3_springwheat.agro +19 -0
- pcse/tests/test_data/lintul3_springwheat.crop +142 -0
- pcse/tests/test_data/lintul3_springwheat.site +11 -0
- pcse/tests/test_data/lintul3_springwheat.soil +8 -0
- pcse/tests/test_data/respiration_testdata.py +35 -0
- pcse/tests/test_data/wofost_npk.agro +19 -0
- pcse/tests/test_data/wofost_npk.crop +235 -0
- pcse/tests/test_data/wofost_npk.site +36 -0
- pcse/tests/test_data/wofost_npk.soil +52 -0
- pcse/tests/test_data/wofost_npk_potential.csv +217 -0
- pcse/tests/test_data/wofost_npk_waterlimited.csv +217 -0
- pcse/tests/test_evapotranspiration.py +129 -0
- pcse/tests/test_lintul3.py +88 -0
- pcse/tests/test_partitioning.py +58 -0
- pcse/tests/test_penmanmonteith.py +90 -0
- pcse/tests/test_respiration.py +50 -0
- pcse/tests/test_wofost72.py +291 -0
- pcse/timer.py +159 -0
- pcse/traitlets.py +68 -0
- pcse/util.py +901 -0
- tests/__init__.py +0 -0
- tests/__main__.py +34 -0
- tests/run_tests.py +115 -0
- tests/test_code.py +232 -0
exp/reduce_yaml.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def process_yaml_file(fname):
|
|
5
|
+
|
|
6
|
+
out_fname = fname.with_suffix(".yaml.new")
|
|
7
|
+
lines_out = []
|
|
8
|
+
|
|
9
|
+
weather_section = False
|
|
10
|
+
weather_valid_period = False
|
|
11
|
+
with open(fname) as fp_read:
|
|
12
|
+
for line in fp_read:
|
|
13
|
+
if not weather_section:
|
|
14
|
+
lines_out.append(line)
|
|
15
|
+
else:
|
|
16
|
+
if weather_valid_period:
|
|
17
|
+
lines_out.append(line)
|
|
18
|
+
|
|
19
|
+
if line.startswith("WeatherVariables:"):
|
|
20
|
+
weather_section = True
|
|
21
|
+
|
|
22
|
+
if line.startswith("- DAY: 1982-01-01"):
|
|
23
|
+
weather_valid_period = True
|
|
24
|
+
lines_out.append(line)
|
|
25
|
+
|
|
26
|
+
if line.startswith("- DAY: 1987-01-02"):
|
|
27
|
+
weather_valid_period = False
|
|
28
|
+
lines_out.pop(-1)
|
|
29
|
+
|
|
30
|
+
with open(fname, "w") as fp_out:
|
|
31
|
+
fp_out.writelines(lines_out)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def main():
|
|
35
|
+
this_dir = Path.cwd()
|
|
36
|
+
for fname in this_dir.glob("*.yaml"):
|
|
37
|
+
print(f"processing {fname.name}")
|
|
38
|
+
process_yaml_file(fname)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
if __name__ == "__main__":
|
|
42
|
+
main()
|
|
43
|
+
|
pcse/__init__.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (c) 2004-2024 Wageningen Environmental Research, Wageningen-UR
|
|
3
|
+
# Allard de Wit (allard.dewit@wur.nl) and Herman Berghuijs, June 2024
|
|
4
|
+
"""
|
|
5
|
+
The Python Crop Simulation Environment (PCSE) has been developed
|
|
6
|
+
to facilitate implementing crop simulation models that were
|
|
7
|
+
developed in Wageningen. PCSE provides a set of building blocks
|
|
8
|
+
that on the one hand facilitates implementing the crop simulation
|
|
9
|
+
models themselves and other hand allows to interface these models with
|
|
10
|
+
external inputs and outputs (files, databases, webservers)
|
|
11
|
+
|
|
12
|
+
PCSE builds on existing ideas implemented in the FORTRAN
|
|
13
|
+
Translator (FST) and its user interface FSE. It inherits ideas
|
|
14
|
+
regarding the rigid distinction between rate calculation
|
|
15
|
+
and state integration and the initialization of parameters
|
|
16
|
+
in a PCSE model. Moreover PCSE provides support for reusing
|
|
17
|
+
input files and weather files that are used by FST models.
|
|
18
|
+
|
|
19
|
+
PCSE currently provides an implementation of the WOFOST and LINTUL crop
|
|
20
|
+
simulation models and the LINGRA grassland simulation model.
|
|
21
|
+
|
|
22
|
+
See Also
|
|
23
|
+
--------
|
|
24
|
+
* http://www.wageningenur.nl/wofost
|
|
25
|
+
* http://github.com/ajwdewit/pcse
|
|
26
|
+
* http://pcse.readthedocs.org
|
|
27
|
+
"""
|
|
28
|
+
from __future__ import print_function
|
|
29
|
+
__author__ = "Allard de Wit <allard.dewit@wur.nl>"
|
|
30
|
+
__license__ = "European Union Public License"
|
|
31
|
+
__stable__ = True
|
|
32
|
+
__version__ = "6.0.9"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
import sys, os
|
|
36
|
+
from . import util
|
|
37
|
+
|
|
38
|
+
# First define and run setup before importing the rest of the stuff
|
|
39
|
+
def setup():
|
|
40
|
+
"""
|
|
41
|
+
Set up the .pcse folder and user settings file, add ~/.pcse to the
|
|
42
|
+
sys.path.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
user_home = util.get_user_home()
|
|
46
|
+
pcse_user_home = os.path.join(user_home, ".pcse")
|
|
47
|
+
if not os.path.exists(pcse_user_home):
|
|
48
|
+
os.mkdir(pcse_user_home)
|
|
49
|
+
|
|
50
|
+
# Add PCSE home to python PATH
|
|
51
|
+
sys.path.append(pcse_user_home)
|
|
52
|
+
|
|
53
|
+
# Check existence of user settings file. If not exists, create it.
|
|
54
|
+
user_settings_file = os.path.join(pcse_user_home, "user_settings.py")
|
|
55
|
+
if not os.path.exists(user_settings_file):
|
|
56
|
+
pcse_dir = os.path.dirname(__file__)
|
|
57
|
+
default_settings_file = os.path.join(pcse_dir, "settings", "default_settings.py")
|
|
58
|
+
lines = open(default_settings_file).readlines()
|
|
59
|
+
with open(user_settings_file, "w") as fp:
|
|
60
|
+
for line in lines:
|
|
61
|
+
if line.startswith(("#", '"', "'", "import")):
|
|
62
|
+
cline = line
|
|
63
|
+
elif len(line.strip()) == 0: # empty line
|
|
64
|
+
cline = line
|
|
65
|
+
else:
|
|
66
|
+
cline = "# " + line
|
|
67
|
+
fp.write(cline)
|
|
68
|
+
|
|
69
|
+
setup()
|
|
70
|
+
|
|
71
|
+
import logging.config
|
|
72
|
+
from .settings import settings
|
|
73
|
+
logging.config.dictConfig(settings.LOG_CONFIG)
|
|
74
|
+
|
|
75
|
+
from . import db
|
|
76
|
+
from . import input
|
|
77
|
+
from . import tests
|
|
78
|
+
from . import agromanager
|
|
79
|
+
from . import soil
|
|
80
|
+
from . import crop
|
|
81
|
+
from .start_wofost import start_wofost
|
|
82
|
+
|
|
83
|
+
# If no PCSE demo database, build it!
|
|
84
|
+
pcse_db_file = os.path.join(settings.PCSE_USER_HOME, "pcse.db")
|
|
85
|
+
if not os.path.exists(pcse_db_file):
|
|
86
|
+
print("Building PCSE demo database at: %s ..." % pcse_db_file, end=" ")
|
|
87
|
+
pcse_home = os.path.dirname(__file__)
|
|
88
|
+
pcse_db_dump_file = os.path.join(pcse_home, "db", "pcse", "pcse_dump.sql")
|
|
89
|
+
try:
|
|
90
|
+
util.load_SQLite_dump_file(pcse_db_dump_file, pcse_db_file)
|
|
91
|
+
print("OK")
|
|
92
|
+
except Exception as e:
|
|
93
|
+
logger = logging.getLogger()
|
|
94
|
+
msg1 = "Failed to create the PCSE demo database: %s" % e
|
|
95
|
+
msg2 = "PCSE will likely be functional, but some tests and demos may fail."
|
|
96
|
+
logger.warning(msg1)
|
|
97
|
+
logger.warning(msg2)
|
|
98
|
+
|
|
99
|
+
if not __stable__:
|
|
100
|
+
print("Warning: You are running a PCSE development version: %s" % __version__)
|
|
101
|
+
|
|
102
|
+
def test(dsn=None):
|
|
103
|
+
"""Run all available tests for PCSE."""
|
|
104
|
+
tests.test_all(dsn)
|