Skip to content

Commit 92eabe6

Browse files
committed
final updates for PCSE 5.4
- Update to NASAPowerDP to properly take missing values into account - Update of documentation to take Py3 compatibility into account
1 parent 8ef8439 commit 92eabe6

12 files changed

+91
-186
lines changed

README.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ in pure python code which makes it more flexible, easier to modify and extensibl
2323
allowing easy interfacing with databases, graphical user interfaces, visualization
2424
tools and numerical/statistical packages. PCSE has several interesting features:
2525

26-
* Implementation in pure python and the core system has a small number of dependencies outside the python standard
27-
library. Most of these can be automatically installed from the Python Package Index (PyPI) (`SQLAlchemy`, `PyYAML`,
28-
`tabulate`, `xlwt`, `xlrd`) although some additional modules rely on `NumPy`.
26+
* Implementation in pure python with dependencies only on popular packages available from
27+
the Python Package Index (PyPI) (`SQLAlchemy`, `PyYAML`, `pandas`, `xlwt`, `xlrd`,
28+
`requests` and `numpy`)
2929

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

doc/conf.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@
103103

104104
# The theme to use for HTML and HTML Help pages. See the documentation for
105105
# a list of builtin themes.
106-
html_theme = 'sphinxdoc'
106+
#html_theme = 'sphinxdoc'
107+
html_theme = "sphinx_rtd_theme"
107108

108109
# Theme options are theme-specific and customize the look and feel of a theme
109110
# further. For a list of options available for each theme, see the

doc/downloads/py2_pcse.yml

+7-18
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
11
name: py2_pcse
22
dependencies:
3-
- alabaster
4-
- babel
5-
- colorama
6-
- docutils
7-
- imagesize
8-
- jinja2
9-
- markupsafe
10-
- mkl
3+
- sqlalchemy
4+
- pyyaml
115
- numpy
12-
- pip
13-
- pygments
6+
- pandas
147
- python=2.7
158
- pytz
169
- pyyaml
1710
- setuptools
18-
- six
19-
- snowballstemmer
2011
- sphinx
2112
- sphinx_rtd_theme
22-
- sqlalchemy
23-
- vs2008_runtime
24-
- wheel
2513
- xlrd
2614
- xlwt
15+
- requests
16+
- ipython
17+
- jupyter
2718
- pip:
28-
- sphinx-rtd-theme==0.1.9
29-
- tabulate==0.7.5
30-
19+
- traitlets-pcse

doc/downloads/py2_pcse_full.yml

-79
This file was deleted.

doc/downloads/py3_pcse.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: py3_pcse
2+
dependencies:
23
- sqlalchemy
34
- pyyaml
45
- numpy
56
- pandas
6-
- python=3
7+
- python=3.6
78
- pytz
89
- pyyaml
910
- setuptools
@@ -12,6 +13,8 @@ name: py3_pcse
1213
- xlrd
1314
- xlwt
1415
- requests
16+
- ipython
17+
- jupyter
1518
- pip:
1619
- traitlets-pcse
1720

doc/installing.rst

+50-77
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ Installing PCSE
55
Requirements and dependencies
66
=============================
77

8-
PCSE is being developed on Ubuntu Linux 14.04 and Windows 7 using Python 2.7.11 and is known to work with
9-
the 3.x series (using the 2to3 tool). As Python is a platform independent language, PCSE
10-
works equally well on Linux, Windows or Mac OSX.
8+
PCSE is being developed on Ubuntu Linux 14.04 and Windows 7 using Python 2.7.14 and python 3.6.5 .
9+
As Python is a platform independent language, PCSE works equally well on Linux, Windows or Mac OSX.
1110
Before installing PCSE, Python itself must be installed on your system. Most Linux systems provide
1211
Python through the native package manager. For Windows users the most straightforward approach for installing
1312
Python is through one of the prepackaged Python distributions such as `Enthought Canopy`_,
@@ -20,14 +19,20 @@ The dependencies of PCSE are the following:
2019
* Numpy >= 1.6
2120
* SQLalchemy >= 0.8
2221
* PyYAML >= 3.11
23-
* tabulate >= 0.7.5
2422
* xlrd >= 0.9.3
2523
* xlwt >= 1.0.0
24+
* pandas >= 0.20
25+
* requests >= 2.0.0
26+
* traitlets-pcse == 5.0.0.dev
27+
28+
The last package in the list is a modified version of the `traitlets`_ package which provides some
29+
additional functionality used by PCSE.
2630

2731
.. _Enthought Canopy: https://www.enthought.com/products/canopy/
2832
.. _Anaconda: https://store.continuum.io/cshop/anaconda/
2933
.. _PythonXY: https://python-xy.github.io/
3034
.. _HomeBrew: http://brew.sh
35+
.. _traitlets: https://traitlets.readthedocs.io/en/stable/
3136

3237
Setting up your python environment
3338
==================================
@@ -72,75 +77,46 @@ After installing MiniConda you should open a command box and check that conda is
7277
is foreign system : False
7378
7479
Now we will use a Conda environment file to recreate the python environment that we use to develop and run
75-
PCSE. First you should download the conda environment file which comes in two flavours, a bare minimum
76-
environment for running PCSE (:download:`downloads/py2_pcse.yml`) and a more complete environment which
77-
includes the Jupyter notebook, Pandas and IPython (:download:`downloads/py2_pcse_full.yml`). If you intend
78-
to run the 'Getting started' section, you should take the latter one. Save the environment file
80+
PCSE. First you should download the conda environment file which comes in two flavours, an
81+
environment for running PCSE on python 3 (:download:`downloads/py3_pcse.yml`) and one for python 2
82+
(:download:`downloads/py3_pcse.yml`). Both environments include the Jupyter notebook and IPython which are
83+
needed for running the `getting started` section and the example notebooks. Save the environment file
7984
on a temporary location such as ``d:\temp\make_env\``. We will now create a dedicated virtual environment
80-
using the command ``conda env create`` and tell conda to use the environment file with the option ``-f p2_pcse_full.yml``
85+
using the command ``conda env create`` and tell conda to use the environment file with the option ``-f p3_pcse.yml``
8186
as show below:
8287

8388
.. code-block:: doscon
8489
85-
D:\temp\make_env>conda env create -f py2_pcse_full.yml
86-
Fetching package metadata: ....
87-
.Solving package specifications: .........
88-
Linking packages ...
89-
[ COMPLETE ]|##################################################| 100%
90-
Requirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname==3.4.0.2 in c:\miniconda3\envs\py2_pcse_b\lib\site-packages
91-
Requirement already satisfied (use --upgrade to upgrade): line-profiler==1.0 in c:\miniconda3\envs\py2_pcse_b\lib\site-packages
92-
Requirement already satisfied (use --upgrade to upgrade): sphinx-rtd-theme==0.1.7 in c:\miniconda3\envs\py2_pcse_b\lib\site-packages
93-
Collecting tabulate==0.7.5
94-
Installing collected packages: tabulate
95-
Successfully installed tabulate-0.7.5
90+
(C:\Miniconda3) D:\temp\make_env>conda env create -f py3_pcse.yml
91+
Fetching package metadata .............
92+
Solving package specifications: .
93+
intel-openmp-2 100% |###############################| Time: 0:00:00 6.39 MB/s
94+
95+
... Lots of output here
96+
97+
Installing collected packages: traitlets-pcse
98+
Successfully installed traitlets-pcse-5.0.0.dev0
9699
#
97100
# To activate this environment, use:
98-
# > activate py2_pcse
101+
# > activate py3_pcse
102+
#
103+
# To deactivate an active environment, use:
104+
# > deactivate
105+
#
106+
# * for power-users using bash, you must source
99107
#
100108
101-
You can then activate your environment (note the addition of ``[py2_pcse]`` on your command prompt) and
109+
You can then activate your environment (note the addition of ``(py3_pcse)`` on your command prompt) and
102110
run an upgrade to upgrade all packages to the latest versions:
103111

104112
.. code-block:: doscon
105113
106-
D:\temp\make_env>activate py2_pcse
114+
D:\temp\make_env>activate py3_pcse
107115
Deactivating environment "C:\Miniconda3"...
108116
Activating environment "C:\Miniconda3\envs\py2_pcse"...
109117
110-
[py2_pcse] D:\temp\make_env>conda upgrade --all
111-
Fetching package metadata: ....
112-
Solving package specifications: .........
113-
114-
Package plan for installation in environment C:\Miniconda3\envs\py2_pcse:
115-
116-
The following packages will be downloaded:
117-
118-
package | build
119-
---------------------------|-----------------
120-
vs2008_runtime-9.00.30729.1| 1 1.1 MB
121-
zlib-1.2.8 | vc9_3 95 KB
122-
123-
... Lots of output here
124-
125-
Proceed ([y]/n)? y
126-
127-
Fetching packages ...
128-
vs2008_runtime 100% |###############################| Time: 0:00:02 518.43 kB/s
129-
130-
... Lots of output here
131-
132-
pyqt-4.11.4-py 100% |###############################| Time: 0:00:04 571.51 kB/s
133-
tornado-4.3-py 100% |###############################| Time: 0:00:01 387.81 kB/s
134-
Extracting packages ...
135-
[ COMPLETE ]|##################################################| 100%
136-
Unlinking packages ...
137-
[ COMPLETE ]|##################################################| 100%
138-
Linking packages ...
139-
1 file(s) copied.###################################### | 81%
140-
[ COMPLETE ]|##################################################| 100%
141-
142-
[py2_pcse] D:\temp\make_env>
143-
118+
D:\temp\make_env>activate py3_pcse
119+
(py3_pcse) D:\temp\make_env>
144120
145121
Installing and testing PCSE
146122
===========================
@@ -154,7 +130,7 @@ environment:
154130

155131
.. code-block:: doscon
156132
157-
[py2_pcse] D:\temp\make_env>pip install PCSE
133+
(py3_pcse) D:\temp\make_env>pip install pcse
158134
Collecting PCSE
159135
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6.0 in c:\miniconda3\envs\py2_pcse\lib\site-packages (from PCSE)
160136
Requirement already satisfied (use --upgrade to upgrade): xlrd>0.9.0 in c:\miniconda3\envs\py2_pcse\lib\site-packages (from PCSE)
@@ -189,20 +165,18 @@ For testing the PCSE package we need to start python and import pcse:
189165

190166
.. code-block:: doscon
191167
192-
[py2_pcse] D:\temp\make_env>python
193-
Python 2.7.11 |Continuum Analytics, Inc.| (default, Mar 4 2016, 15:18:41) [MSC v.1500 32 bit (Intel)] on win32
168+
(py3_pcse) D:\temp\make_env>python
169+
Python 3.7.0 (default, Aug 14 2018, 19:12:50) [MSC v.1900 32 bit (Intel)] :: Anaconda, Inc. on win32
194170
Type "help", "copyright", "credits" or "license" for more information.
195-
Anaconda is brought to you by Continuum Analytics.
196-
Please check out: http://continuum.io/thanks and https://anaconda.org
197171
>>> import pcse
198-
Building PCSE demo database at: C:\Users\wit015\.pcse\pcse.db
172+
Building PCSE demo database at: C:\Users\wit015\.pcse\pcse.db ... OK
199173
>>>
200174
201175
Next, the tests can be executed by calling the `test()` function at the top of the package::
202176

177+
203178
>>> pcse.test()
204179
runTest (pcse.tests.test_abioticdamage.Test_FROSTOL) ... ok
205-
runTest (pcse.tests.test_assimilation.Test_WOFOST_Assimilation) ... ok
206180
runTest (pcse.tests.test_partitioning.Test_DVS_Partitioning) ... ok
207181
runTest (pcse.tests.test_evapotranspiration.Test_PotentialEvapotranspiration) ... ok
208182
runTest (pcse.tests.test_evapotranspiration.Test_WaterLimitedEvapotranspiration1) ... ok
@@ -220,25 +194,26 @@ Next, the tests can be executed by calling the `test()` function at the top of t
220194
runTest (pcse.tests.test_agromanager.TestAgroManager6) ... ok
221195
runTest (pcse.tests.test_agromanager.TestAgroManager7) ... ok
222196
runTest (pcse.tests.test_agromanager.TestAgroManager8) ... ok
223-
runTest (pcse.tests.test_wofost.TestPotentialSunflower) ... ok
224197
runTest (pcse.tests.test_wofost.TestWaterlimitedWinterWheat) ... ok
198+
runTest (pcse.tests.test_wofost.TestWaterlimitedWinterRapeseed) ... ok
225199
runTest (pcse.tests.test_wofost.TestWaterlimitedSunflower) ... ok
200+
runTest (pcse.tests.test_wofost.TestPotentialWinterRapeseed) ... ok
201+
runTest (pcse.tests.test_wofost.TestPotentialSpringBarley) ... ok
202+
runTest (pcse.tests.test_wofost.TestPotentialSunflower) ... ok
226203
runTest (pcse.tests.test_wofost.TestPotentialPotato) ... ok
204+
runTest (pcse.tests.test_wofost.TestWaterlimitedGrainMaize) ... ok
227205
runTest (pcse.tests.test_wofost.TestPotentialWinterWheat) ... ok
206+
runTest (pcse.tests.test_wofost.TestPotentialGrainMaize) ... ok
228207
runTest (pcse.tests.test_wofost.TestWaterlimitedSpringBarley) ... ok
229-
runTest (pcse.tests.test_wofost.TestWaterlimitedGrainMaize) ... ok
230-
runTest (pcse.tests.test_wofost.TestWaterlimitedWinterRapeseed) ... ok
231-
runTest (pcse.tests.test_wofost.TestPotentialWinterRapeseed) ... ok
232208
runTest (pcse.tests.test_wofost.TestWaterlimitedPotato) ... ok
233-
runTest (pcse.tests.test_wofost.TestPotentialSpringBarley) ... ok
234-
runTest (pcse.tests.test_wofost.TestPotentialGrainMaize) ... ok
235209
runTest (pcse.tests.test_lintul3.TestLINTUL3_SpringWheat) ... ok
236210
runTest (pcse.tests.test_wofost_npk.TestWOFOSTNPK_WinterWheat) ... ok
237211

238212
----------------------------------------------------------------------
239-
Ran 33 tests in 57.472s
213+
Ran 32 tests in 54.306s
240214

241215
OK
216+
>>>
242217

243218
If the model output matches the expected output the test will report 'OK',
244219
otherwise an error will be produced with a detailed traceback on where the
@@ -248,10 +223,8 @@ due to problems with the test.
248223

249224
Moreover, SQLAlchemy may complain with a warning that can be safely ignored::
250225

251-
/usr/lib/python2.7/dist-packages/sqlalchemy/types.py:307: SAWarning:
252-
Dialect sqlite+pysqlite does *not* support Decimal objects natively, and
253-
SQLAlchemy must convert from floating point - rounding errors and other
254-
issues may occur. Please consider storing Decimal numbers as strings or
255-
integers on this platform for lossless storage.
256-
d[coltype] = rp = d['impl'].result_processor(dialect, coltype)
226+
C:\Miniconda3\envs\py3_pcse\lib\site-packages\sqlalchemy\sql\sqltypes.py:603: SAWarning:
227+
Dialect sqlite+pysqlite does *not* support Decimal objects natively, and SQLAlchemy must
228+
convert from floating point - rounding errors and other issues may occur. Please consider
229+
storing Decimal numbers as strings or integers on this platform for lossless storage.
257230

doc/whatsnew.rst

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
What's new in PCSE 5.4
2+
======================
3+
4+
PCSE 5.4 has the following new features:
5+
6+
- PCSE is now fully compatible with python3 (>3.4) while still remaining compatibility with python 2.7.14
7+
- The NASAPOWERWeatherDataProvider has been upgraded to take the new API into account
8+
9+
10+
111
What's new in PCSE 5.3
212
======================
313

0 commit comments

Comments
 (0)