Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
using_different_parameters_for_patcher_and_expander_based_on_the_current_sub-region_year [2017/02/24 03:03] hermann created |
using_different_parameters_for_patcher_and_expander_based_on_the_current_sub-region_year [2017/02/24 03:15] hermann [Using different parameters for Patcher and Expander based on the current sub-region AND year] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | === Using different parameters for Patcher and Expander based on the current sub-region OR year == | + | ====== 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. | 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 Transiton Matrix]] etc, from now on referred as SelectXXXX in the text below. | + | <note important> |
+ | [[Select Transition Function Parameter Matrix]], [[Select Transition Matrix]] etc, or anny other member of [[functor_list#stack|Stack group]] from now on will be referred as SelectXXXX in the text below. | ||
+ | </note> | ||
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. | 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. | ||
Line 11: | Line 13: | ||
However, there are several problems will the use of SelectXXXX: | 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 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. | + | * 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 === | + | ====== 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 images] can be converted to tables and from tables. And since tables can be stored as CSV files, this gives us a very effective way to reading and storing parameters from disk. | + | It is possible to overcome all the limitations of SelectXXXX using tables. All parameters (except [[Map Type|maps]] and [[Categorical Map Type|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. |
<note tip> | <note tip> | ||
Line 41: | Line 43: | ||
</code> | </code> | ||
- | 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. | + | 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. | 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. | ||
Line 90: | Line 92: | ||
| 3 | 2 | 6 | 10 | 3 | 2 | | | 3 | 2 | 6 | 10 | 3 | 2 | | ||
+ | Here is the corresponding CSV file: | ||
+ | |||
+ | <code> | ||
Year*, From*, To*, Mean_Patch_Size, Patch_Size_Variance, Patch_Isometry, | Year*, From*, To*, Mean_Patch_Size, Patch_Size_Variance, Patch_Isometry, | ||
1, 1, 3, 50, 10, 1, | 1, 1, 3, 50, 10, 1, | ||
Line 97: | Line 102: | ||
3, 2, 1, 20, 3, 1.5, | 3, 2, 1, 20, 3, 1.5, | ||
3, 2, 6, 10, 3, 2, | 3, 2, 6, 10, 3, 2, | ||
+ | </code> | ||
The model ??? contains the changes to use tables instead of SelectXXXX. | The model ??? contains the changes to use tables instead of SelectXXXX. |