The standard Python installation does not include additional packages useful for the development and analysis of environmental models such as the PCRaster Python module, NumPy, matplotlib and many others. Installing and maintaining all these packages manually can be tedious. A userfriendly Python development environment with an extensive built-in support for scientific packages and easy update facilities is the Enthought Canopy environment. You can find more information about Canopy and its different versions here.
The PCRaster Python module is known to work with Enthought Canopy, and the free Canopy Express can be used as a convenient development environment for spatio-temporal models. Follow these steps to use PCRaster within Canopy:
- Download the Canopy version. Windows users must install the 32bit version.
- Install Canopy by following the steps given in the online documentation.
- If not done already, follow these steps to setup PCRaster on your computer.
Interactive PCRaster Python sessions
To use the PCRaster Python module within an interactive session, start Canopy and
- Chose the Code Editor
- Your current working directory is displayed above the Python Panel. Use the ‘Change working directory’ entry from the ‘Show working directory menu’ to switch to a directory where your input data resides.
- In the Python Panel, type
from pcraster import *
- To visualise a single PCRaster map, for example, dem.map, type
Running PCRaster Python scripts
To run a PCRaster Python script, start Canopy and
- Load your Python script
- Change the current working directory by using the ‘Change to Editor Directory’ entry from ‘Show working directory menu’
- Execute the script by pressing the run button from the toolbar
For advanced visualisation features you need to run the aguila program from the command prompt:
- Open the Windows start menu and type
cmdin ‘Search programs and files’
- Change to the directory where your Python script resides by typing, for example
- Run aguila with the desired program options