PCRaster and Enthought Canopy

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:

Installation

  1. Download the Canopy version. Windows users must install the 32bit version.
  2. Install Canopy by following the steps given in the online documentation.
  3. 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

  1. Chose the Code Editor
  2. 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.
  3. In the Python Panel, type
    from pcraster import *
  4. To visualise a single PCRaster map, for example, dem.map, type
    aguila("dem.map")

Running PCRaster Python scripts

To run a PCRaster Python script, start Canopy and

  1. Load your Python script
  2. Change the current working directory by using the ‘Change to Editor Directory’ entry from ‘Show working directory menu’
  3. 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:

  1. Open the Windows start menu and type cmd in ‘Search programs and files’
  2. Change to the directory where your Python script resides by typing, for example
    cd C:\data\model
  3. Run aguila with the desired program options