Download Operation - PCRaster

Transcript
PCRaster Website: Arrays
Home Introduction Demo Downloads Documentation Support Courses Case studies Publications
Projects People Links
Department of Physical Geography Faculty of Geosciences
Utrecht University The Netherlands
Arrayed variables in PCRcalc
Document version 4.0 By Willem van Deursen and Cees Wesseling, PCRaster Environmental Software
VOF
DISCLAIMER: The new features documented here are considered to be in alpha status. Things may
change a bit in later releases. This release is intended to get feedback from users who want to apply these
features. As always, we do welcome ideas and suggestions but for alpha software we can not garantuee
the same level of support as for our regular software.
Introduction
PCRcalc allows for the construction of arrayed variables. The concept reduces the need for copying parts
of the script several times to create similar behavior for a number of species or related components.
The clearest need for this type of concept comes from simulating ecosystem dynamics, where the main
goal is to model the interaction between species. Although ecosystem dynamics deals with a number of
species, these species demonstrate similar (not identical) behavior. Until the introduction of arrayed
variables, this type of models was constructed in PCRaster by copying the section that described the first
species and substitute the parameter values for the second species. This approach yields a script that can
become very long and is becoming more and more difficult to maintain. Changes made to the process
descriptions have to be implemented in several similar sections, and parameter values are scattered
throughout the script. The use of arrayed variables improves this situation because it allows for a
structured way of describing the similar processes in the different species, and it allows for the species to
be initialized from external files.
Identification and access to arrayed variables
The introduction of the arrayed variables is straightforward. In the binding section of the script we need
to identify the arrayed variable, while in the initial and dynamic section we need to use the foreach
construct to iterate over the array. Furthermore, we developed index... functions to create an interface to
external parameter files. The identification of the arrayed variables is in the binding section.
binding
PlantSpecies = [
Species1,
Species2,
http://pcraster.geog.uu.nl/documentation/manual_updates/ArraysInCalc.html (1 van 7) [3/2/2005 5:04:25 PM]