Using different parameters for Patcher and Expander based on the current sub-region OR year

It is possible to use a Select Transition Function Parameter Matrix to manage the transition parameters. Inside that container, you must place one Number Transition Function Parameter Matrix to store the transition parameters for each sub-region OR year. The index represents the corresponding region OR year.

Select Transition Function Parameter Matrix, Select Transition Matrix etc, or anny other member of Stack group from now on will be referred as SelectXXXX in the text below.

All SelectXXXX have a fall back mechanism. So, if the corresponding index is not defined, a SelectXXXX searches for the previous index in the list. For example, if you have a parameter defined for year/region 10, 21, 40 and 45, the SelectXXXX will return the parameter for region/year 40 every time you search for index 40, 32, 23, 22 etc.

See model ??? for an example.

However, there are several problems will the use of SelectXXXX:

  • You have to predefine your parameters in your model: So if you want to add parameters for more regions OR years, you have to make changes to your model.
  • You can not defined a different parameter for each year AND sub-region: You can not nest different SelectXXXX.

Using different parameters for Patcher and Expander based on the current sub-region AND year

It is possible to overcome all the limitations of SelectXXXX using tables. All parameters (except maps and categorical maps) can be converted to tables and from tables. And since tables can be stored as CSV files, this gives us a very effective way of reading from and saving parameters to disk.

Tables and Lookup Tables are two different types in Dinamica EGO.

Transition Parameters can be represented by tables using the following format:

From* To* Mean_Patch_Size Patch_Size_Variance Patch_Isometry
1 3 50 10 1
2 1 10 5 1.5
2 6 20 0 2

The columns names suffixed by * represent keys. The other columns are data columns. See info about the Table Type for a brief introduction about table terminology.

The CVS file representing the table above can be seen below:

From*, To*, Mean_Patch_Size, Patch_Size_Variance, Patch_Isometry,
1, 3, 50, 10, 1,
2, 1, 10, 5, 1.5,
2, 6, 20, 0, 2, 

To confirm that a table can be converted to a Transition Function Parameter Matrix, create a CSV file using the text above (you can also use Excel), load the table using a Load Table and connect the Load Table to the Allocate Transitions submodel.

However, just reading parameters from CSV files are not very useful. So let's try convert the example model to use tables to replace the SelectXXXX containers.

The first step is adding a new column to our table. This column will represent the current year.

Year* From* To* Mean_Patch_Size Patch_Size_Variance Patch_Isometry
1 1 3 50 10 1
1 2 1 10 5 1.5
1 2 6 20 0 2

Now we can just add transition parameters corresponding to the following years.

Year* From* To* Mean_Patch_Size Patch_Size_Variance Patch_Isometry
1 1 3 50 10 1
1 2 1 10 5 1.5
1 2 6 20 0 2
2 1 3 50 10 1
2 2 1 10 5 1.5
2 2 6 20 0 2
3 1 3 10 11 1
3 2 1 20 3 1.5
3 2 6 10 3 2

Here is the CSV file:

Year*, From*, To*, Mean_Patch_Size, Patch_Size_Variance, Patch_Isometry, 
1, 1, 3, 50, 10, 1, 
1, 2, 1, 10, 5, 1.5, 
1, 2, 6, 20, 0, 2, 
2, 1, 3, 50, 10, 1, 
2, 2, 1, 10, 5, 1.5, 
2, 2, 6, 20, 0, 2, 
3, 1, 3, 10, 11, 1, 
3, 2, 1, 20, 3, 1.5, 
3, 2, 6, 10, 3, 2, 

To retrieve the table corresponding to the current year, let's use a submodel call Select Sub Table. Now we have to connect the Load Table and the current Step to the Select Sub Table. This submodel uses the same fall back mechanism used by the SelectXXXX containers. So, you can just omit sub tables corresponding to transition parameter matrices if they are the same as the ones used by the previous year.

Year* From* To* Mean_Patch_Size Patch_Size_Variance Patch_Isometry
1 1 3 50 10 1
1 2 1 10 5 1.5
1 2 6 20 0 2
3 1 3 10 11 1
3 2 1 20 3 1.5
3 2 6 10 3 2

Here is the corresponding CSV file:

Year*, From*, To*, Mean_Patch_Size, Patch_Size_Variance, Patch_Isometry, 
1, 1, 3, 50, 10, 1, 
1, 2, 1, 10, 5, 1.5, 
1, 2, 6, 20, 0, 2, 
3, 1, 3, 10, 11, 1, 
3, 2, 1, 20, 3, 1.5, 
3, 2, 6, 10, 3, 2, 

The model ??? contains the changes to use tables instead of SelectXXXX.

Unlike, SelectXXXX we can emulate nested parameters using table. For example, if we decided to use a different parameter for each sub-region, all we have to do is add another column of keys corresponding to the current sub-region and use two Select Sub Table's. The first Select Sub Table will retrieve the table containing all parameters for the current year and the second one will retrieve the parameters for the current sub-region.

Year* Region* From* To* Mean_Patch_Size Patch_Size_Variance Patch_Isometry
1 1 1 3 50 10 1
1 1 2 1 10 5 1.5
1 1 2 6 20 0 2
1 2 1 3 50 1 1
1 2 2 1 10 5 1.5
1 2 2 6 20 3 2
3 1 1 3 10 11 1
3 1 2 1 20 3 1.5
3 1 2 6 10 3 2
3 2 1 3 10 11 1
3 2 2 1 20 3 1.5
3 2 2 6 10 3 2
Year*, Region*, From*, To*, Mean_Patch_Size, Patch_Size_Variance, Patch_Isometry,
1, 1, 1, 3, 50, 10, 1,
1, 1, 2, 1, 10, 5, 1.5,
1, 1, 2, 6, 20, 0, 2,
1, 2, 1, 3, 50, 1, 1,
1, 2, 2, 1, 10, 5, 1.5,
1, 2, 2, 6, 20, 3, 2,
3, 1, 1, 3, 10, 11, 1,
3, 1, 2, 1, 20, 3, 1.5,
3, 1, 2, 6, 10, 3, 2,
3, 2, 1, 3, 10, 11, 1,
3, 2, 2, 1, 20, 3, 1.5,
3, 2, 2, 6, 10, 3, 2,