27  Calculating ARID

Let us build the next module, ARID, on top of what we just implemented in the load-weather-data module.

27.1 Module variables and parameters

In addition to the weather variables in our dataset, ARID requires several other variables related to soil properties and cover. We will make an exception to our code legibility rule and use the notation from the original implementation (Wallach et al. 2019).

We also introduce a way to handle multiple approaches to parameter setting. We create a chooser named experiment-type in the interface and use it to activate one of two approaches: “user-defined”, which takes the values of sliders in the interface, and “random”, which samples these values randomly within a predetermined range. We also introduce two useful procedures, parameters-check and parameters-to-default, to help us define and return to a specific “default” parameter configuration used as a point of reference.

27.2 Setting module parameters

We use a randomised configuration of most of these patch variables, using hyperparameters to define the envelope of variation. Indus Village eventually escapes this initial solution by calculating these variables from various datasets and submodels. However, for simplicity, we will use it as-is. As Wallach et al. (2019), we will use two global variables as constants (MUF and WP) and create some extra procedures that will help us register and apply a default configuration of the hyperparameters (parameters-check and parameters-to-default).

27.3 Calculating Reference Evapotranspiration (ETr)

In our previous implementation of set-day-weather-from-input-data, we must now add a new final step, where netSolarRadiation and ETr (reference evapotranspiration) are set for each patch. We also need to implement a procedure to estimate ETr based on an FAO standard (Allen et al. 1998).

Allen, Richard G., Luis S. Pereira, Dirk Raes, and Martin Smith. 1998. Crop Evapotranspiration - FAO Irrigation and Drainage Paper No. 56. Rome: FAO. http://www.fao.org/3/X0490E/x0490e00.htm.

27.4 Implementing the main algorithm

Next, we add update-WAT, which contains the calculations that finally outputs ARID.

27.5 Merging with spatial data module

So far, we still lack spatial data. Let us implement the necessary code to import the processed data we output from the flows module.

27.6 Visualisation

Before advancing, we can implement a display procedure, expanding it also to be able to paint patches according to the new patch variables, using the “chooser” parameter display-mode:

27.7 Combining with flow accumulation algorithm

Finally, we finalise this module by implementing a solution that uses flow_accumulation to modulate variation in ARID as a proxy for the effect of regional hydrology on the local soil water balance. The solution uses the patch variable ARID_modifier, set during setup according to the parameter ARID-decrease-per-flow-accumulation and the local relative flow accumulation (flow_accumulation / maxFlowAccumulation). It then modifies ARID each day as a simple scalar.

27.8 Checking the milestone File (module 4)

Our solution to link flow_accumulation and ARID is undoubtedly arbitrary. Such solutions should always be temporary and prompt further research and coding excursions. For the tutorial, however, we can move forward.

Screenshot of the ‘ARID’ module (tick 100)
Screenshot of the ‘ARID’ module (tick 100)

Screenshot of the ‘ARID’ module (tick 150)
Screenshot of the ‘ARID’ module (tick 150)

Screenshot of the ‘ARID’ module (tick 200)
Screenshot of the ‘ARID’ module (tick 200)

See the fully implemented version of this module: BlockC_module3_ARID.nlogo.