NetLogo User Community Models
by Desi Suyamto (Submitted: 11/06/2006)
WHAT IS IT?
Variations in river flow tend to decrease with increasing area of consideration, partly due to a decrease in temporal correlation of rainfall events across space. Patchiness of rainfall can contribute to an increase of yield stability over space. Existing rainfall simulators tend to focus on station-level time series, not on space/time autocorrelation. The SpatRain simulator described here is constructed to generate time series of rainfall that are fully compatible with existing station-level records of daily rainfall, but yet can represent substantially different degrees of spatial autocorrelation. Calculations start from the assumed spatial characteristics of a single rainstorm pathway, with a trajectory for the core area of the highest intensity and a decrease of rainfall intensity with increasing distance from this core. The simulator can derive daily amounts of rainfall for a grid of observation points by considering the possibility of multiple storm events per day, but not exceeding the long-term maximum of observed station-level rainfall.
Most studies of rainfall pattern focus either on the time series (degree of autocorrelation) for rainfall at a single point of observation, or on the spatial patterns of average rainfall over a monthly or yearly period. Small-range spatial variability of daily rainfall has been studied extensively in the context of design of rain-gauge networks. While the recommended density of such networks is often much higher than what exists or is feasible, the small-range variability around the existing data tends to be ignored. Yet, if one is interested in the variability of stream and river flow at different scales, the gradual loss of synchrony in runoff-causing rainfall events is probably an important contributor to the increased ‘evenness’ of river flow with increased area of consideration. Hydrological literature reviewed by Rodriguez–Iturbe and Rinaldo (1997) indicates that maximum daily river flow scales with area to the power 0.75, while mean annual discharge scales with area to the power 1. The difference in scaling factor can be explained by a combination of temporary water storage in river valleys and ‘the fact that rains of high intensity rarely cover the entire basin, but are instead widely and irregularly spaced’. While the temporary storage component is under the influence of land use and ‘watershed management’, the second explanation is not. It is thus important to separate the two types of explanation. An explicit representation of space-time patterns of rainfall will allow such analysis.
In situations where details of the rainfall pattern are important for crop growth and yield formation, the gradual decrease in synchrony of rain may confer advantages to households that operate fields across the village domain rather than in a single block. A quantitative approach to spatial autocorrelation of rainfall is needed to address these issues and a procedure to generate partially correlated time series for neighbouring locations is desirable for simulation studies.
Substantial emphasis has been given to temporal autocorrelation, but if the results are subsequently assumed to hold invariantly across space, or are supposed to be derived from independent multiple domains, the scaling relations of the processes that are related to rainfall may be wrongly assessed. We thus identified a need for a tool that considers variation across both space and time at daily or event scale and developed a spatial rainfall simulator that can be used to overcome these challenges.
HOW IT WORKS
Design features of SpatRain include:
 the program must specify degrees of spatial correlation of the simulated rainfall based on storm-level properties; and
Station-level daily records are often the only information available on the distribution of rainfall. Such data can be represented as a series of monthly ‘exceedance’ graphs, derived from the long-term station records. Between months of the year and locations we may expect differences in the intercept with the X-axis or ‘frequency of wet days’ (days with a measurable amount of precipitation), the intercept with the Y-axis or maximum amount of rainfall in a single day recorded in that particular month of the year, and in the curvature of the (monotonously rising) line between these two points.
Conceptually one can imagine a procedure that reshuffles measured daily sequences of rainfall while maintaining the monthly total. It is like rearranging a ‘jackpot’, where the variability of values exposed on the window should follow our expectation. The total set of permutations of 30 sets of ‘jackpot’ with 30 values is already enormous, and among these we can expect to find a substantial variation in degrees of spatial autocorrelation. By generating a sample of these reshuffling results, calculating autocorrelation and then selecting specific configurations, we would meet the key design criteria specified above. The program will, however, be rather cumbersome and time consuming if large areas are to be considered, and the selection of results that meet a specific change in spatial autocorrelation with increasing distance may require a large subset of reshuffling results. More efficient algorithms are desirable, but the ‘jackpot’ analogue shows that the design rules are not mutually incompatible. A more direct approach can be taken if we assign specific spatial properties to single storm events and then adjust the frequency of storms and the intensity of rainfall in the core area of these storms to match the existing station records.
SpatRain starts from the spatial characteristics of a single rainstorm pathway (with a trajectory for the core area of the highest intensity and a decrease of rainfall intensity with increasing distance from this core) and can derive daily amounts of rainfall for a grid of observation points by considering the possibility of multiple storm events per day. Three parameters are used here for describing rainfall in the core area: the length and the width of the core trajectory and the rainfall depth in the core area (Imax). Two further parameters (spread and edge) describe the decrease of rainfall depth (Id) with increasing distance from the core (d). The combination of these can produce the full scale of ‘homogenous’ to ‘heterogeneous’ types of rain:
Above equation may produce a narrow-spread area of single storm events, on which its wet cells ratio relative to total area (wc) does not match the wet days fraction of that specific month (wd). Hence, we need to allow for multiple storm events, depending on the area fraction wetted by a single event and the time fraction of rainy days at the measurement station level. For spatially independent multiple events on a single day we can derive that probability of dry days on a given month, 1-wd, should meet the probability of dry cells during single event, 1-wc, to the power of events number (N):
1-wd = (1-wc)^N
Patchy rains have less wet fraction than homogeneous rains in space. In order to conserve each cell to having uniform chance of being hit by storms in time, patchy rains should have higher probability to occur than homogeneous rains. Consequently, the probability of storm with N number of events (E) is defined from wet days fraction (wd) by taking wet cells fraction of N storm events (WC) into account:
E = wd/WC
Storm events will ‘wet’ a number of cells, some at the core intensity and some at a lower intensity. Given a set of parameters for the storm trajectory, we can derive the frequency distribution of rain depth in wetted cells (p), in n classes. Once this is known, the frequency distribution of core intensities (F) can be derived from the observed station level rain intensities (f).
Frequency distributions of f, p and F should have the same class number and interval order. We use the following order to define the class boundary:
[Rmax..Rmax*q1],[Rmax*q1.. Rmax*q2],…,[Rmax*qn.. Rmin],
where Rmax is the maximum rainfall, Rmin is the minimum rainfall and n is class intervals number. The value of q is ranging from 0 to 1 and calculated as follows:
q = exp(ln(Rmin/Rmax)/n), 0 ? q ? 1
We first need to recognize the combinations of classes pj and Fk that are compatible with class fi:
fi ? ?(pjFk|j,k~i), Rmin ? fi ? Rmax, Rmin ? pj ? Rmax, Rmin ? Fk ? Rmax
For the highest rainfall class there is only one combination, involving the highest class of both p and F that will yield the desired result, but for the other classes there can be several combinations of p and F that yield the same result (the tail end of a big rainfall event, a medium fraction of a medium storm or the core area of a small storm). We can approach it from the top down, but a simpler derivation starts from the observation that for all distributions f, p and F the sum equals 1. By assuming that the resultant (f) comes from the multiplication between p and F, we then get this basic equation:
?f = ?p * ?F
From above equation, we can derive a criterion for the shape of the p distribution (that depends on assumed storm properties) that is compatible with the targeted f distribution. If at any point sum of f from frequency class 1 to i divided by sum of p from frequency class 1 to i is less than sum of F from frequency class 1 to i-1, F from frequency class i (Fi) would violate the assumption of non-negative subsequent F terms. So, a cross-over of p and f indicates incompatibility of the storm-level assumptions (that generate the p curve) with the station-level rainfall records (that generate the f curve).
HOW TO USE IT
 There are two data series required by the model that should be specified under procedures. The first data series contains long-term daily rainfall records from rainfall stations. It should be specified under procedure: "to read-rainfall-data", in form of list called "rainfall-data". The list is formatted so that every 365 items representing daily rainfall of specified station in given year, in sequential julian day order. The data provided here is daily rainfall time series from the meso-scale catchments area of Sumberjaya, Lampung, Sumatra, Indonesia, obtained from 3 rainfall stations located within the catchments. One station has 21-year time series, while other two have shorter time series but are probably not significantly different in means or variance measures (Manik and Sidle, 2003).
This second data series is xyz data containing information of location of sample points used for simulation and analysing the results. It should be specified under procedure: "to read-station-map", in form of list called "station-xyz-data". The first item in each sub-list of the list contains the values of x coordinate, the second item contains the values of y coordinate, and the third item contains the values of station id.
 In another version, those two data series are provided as external text files.
 Use sliders “storm-spread”, “storm-edge”, “storm-core-width” and “storm-core-length” to adjust storm properties.
 Use slider “class-number” to define interval class for f, p and F.
 Use slider “replicate” to define sampling replicate to define p, analyse semivariance and scaling rule of maximum rainfall.
 Use slider “sampling-distance” to define distance step from starting random point in semivariance analyses.
 Use slider “sampling-day” to define number of rainfall maps used for semivariance and scaling rule analyses.
 Use slider “simulation-duration” to define duration of simulation (year).
 Button “setup” will initialise the model and calculating compatibility of your assumed storm properties. When you got one incompatible monthly F you should readjust the storm properties using sliders “storm-spread”, “storm-edge”, “storm-core-width” and “storm-core-length”.
 Once you have compatible storm properties which are applicable in all months, you can run the simulations by executing button “go”. It will generate daily rainfall for specified year duration, defined in step .
 Six plots are provided to capture the main outputs: saily patch rainfall from sampling points, which locations are defined by step ; annual landscape rainfall; exceedance graphs of daily simulated rainfall, compared to observed records; semivariogram, relationship between Rmax/Rmean and area. You can report these outputs into text files, by right clicking the plots and select the menu “Export...”. All input settings will be recorded by the files.
 View is provided to visualise spatial patterns of simulated daily rainfall. The red triangles are sampling points, as defined in step . You can capture this view by right clicking it and select the menu “Export View…”.
THINGS TO NOTICE
Some caution is needed in applying the model. The current procedures are only applicable for catchments which rainfall variability is not much affected by elevation (micro- to meso-scale catchments).
THINGS TO TRY
Try to construct compatible storms with high edge, high spread and large core area. Compare the outputs. What is your conclusion?
EXTENDING THE MODEL
Extending the model for application in larger area should be carried out with regard to spatial trends in mean rainfall due to effects of elevation.
“List” related functions provided by NetLogo make random number generation procedures much easier and controllable. We use random lottery pot algorithm for generating random values. Using this approach, picked values won’t be repeated.
Rainfall simulators, crop growth models, river flow models.
CREDITS AND REFERENCES
The SpatRain simulator is implemented using NetLogo, a java-based programmable modelling environment for simulating natural and social phenomena (Uri Wilensky, 1999). SpatRain is freely available on NetLogo website (http://ccl.northwestern.edu/netlogo/) as part of community models or on our website (http://www.worldagroforestrycentre.org/ sea/).
The development of SpatRain is funded by Bank Netherlands Partnership Programme (BNPP) and Australian Centre for International Agricultural Research (ACIAR). Initial concept and preliminary results of SpatRain was presented at a workshop of the International Union of Forest Research Organizations (IUFRO) in Kota Kinabalu, Sabah, Malaysia, July 10-12, 2004. Submission of the manuscript about the model and its application to international journal is in progress.
To refer to this model in academic publications, please use: Suyamto, D.A., Van Noordwijk, M., Lusiana, B. 2006. SpatRain: a simulator of space/time patterns in rainfall for predicting scale dependence of variability of rainfall-related processes. World Agroforestry Centre, Southeast Asia Regional Office, Bogor, Indonesia.
Manik, T.K. and Sidle, R.C.. 2003. Rainfall spatial distribution in Sumber Jaya watershed, Lampung, Indonesia. In: Post, D.A. (Ed.): Proceedings of International Congress on Modelling and Simulation MODSIM 2003, July 14-17 2003, Townsville, Australia.
Rodriguez-Iturbe, I. and Rinaldo, A.. 1997. Fractal River Basins: Chance and Self-Organization. Cambridge University Press, New York.
Wilensky, U.. 1999. NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
(back to the NetLogo User Community Models)