Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lesson_14 [2019/08/30 12:45]
argemiro
lesson_14 [2020/02/20 17:43]
argemiro
Line 1: Line 1:
-{{ :logo_guidebook1.jpg?400 |}} +{{ :logo_logo.png?400 |}}
-\\ +
-=====LESSON 14: Using Repeat to make successive calculations===== ​  +
-\\+
 \\ \\
 +=====  LESSON 14: Using "For Each Category"​ and "​Region Manager"​ to works with the concept of region ​ =====
 +
  
 ==== What will you learn? ==== ==== What will you learn? ====
 + 
 + 
  
 +  * How to use the concept of Regions
 +  * Functors: \\ - //[[:Region Manager]]//​\\ - //[[:For Each Category]]//​
 +
 +{{ :​tutorial:​region1.jpg|}}\\
 \\ \\
 +This subset of functors permits division of a map into several regional maps, which can be input for separate models or submodels, whose parameters are customized for each map’s region. Let’s adapt the model ''​Calc_forest_remaining_extent_per_state''​ (You can find this model in the folder: ''​\Guidebook_Dinamica_5\Models\using_concept_of_region''​) to use the concept of regions. First open the Region Tab in the library window.\\
 \\ \\
-The intent of this exercise is: 
 \\ \\
 \\ \\
-For thiswe will use+These functors can be combined to produce regional maps and submodelsas well as to merge the regional maps into a single map after a processing is performed. In this lesson you will learn how to retrieve the area of the remaining forest for each state; as a result each regional map will correspond to a state area. Open the model the model ''​Calc_forest_remaining_extent_per_state''​. Select the functors within the container //​[[:​Repeat]]//​ with the Hand tool and then drag them out of //​[[:​Repeat]]//​.\\ 
 +\\ 
 + ​{{:​tutorial:​inc._it._model_17.jpg|}}{{:​tutorial:region2.jpg|}}
  
 +
 +
 +<note tip>​**TIP**:​ Use Crtl + right button to keep continually selecting the functors, this will avoid selecting //​[[:​Repeat]]//​ as well. The functor //​[[:​Repeat]]//​ will shrink.
 +</​note>​
 +
 +Delete the container //​[[:​Repeat]]//​ and place the containers //[[:Region Manager]]// from the Region tab and //[[:For Each Category]]//​ from the Control tab. Place the latter within the first.{{ :​tutorial:​region3.jpg |}}\\
 \\ \\
-\\+//[[:Region Manager]]// manages the regionalization process, while //[[:For Each Category]]//​ replaces the //​[[:​Repeat]]//​ making the model iterate for each category present in the categorical map used to define the regions, in this case the map of the Brazilian Amazon states.
  
-//Lesson under construction//+<​note>​While ​//[[:Repeat]]// iterates sequentially,​ //[[:For Each Category]]//​ iterates according to the map categories, which do not need to be sequential.</​note>​ 
 + 
 +Now select all functors, except the input and output maps, and place them within //[[:For Each Category]]//​.  
 + 
 +<note tip>​**TIP**:​ it is easier to select everything to be placed within //[[:For Each Category]]//​ and then to take only //[[:Load Map]]// and //[[:Save Map]]// out of it.</​note> ​  
 + 
 +Now break the link between //[[:Load Categorical Map]]// and //​[[:​Calculate Map]]// (use the Remove Items tool and click on the arrow connecting both functors); next, connect the first to //[[:Region Manager]]// and to //[[:For Each Category]]//​ too. This map will control the regionalization process splitting the other maps into several regions according to its cell classes or categories through the functor //​[[:​Regionalize Map]]//. Drag this functor and place it within //[[:For Each Category]]//,​ break the link between Map ''​brazilian_amazon_lanscape.tif''​ (You can find this map in the folder: ''​\Guidebook_Dinamica_5\Database\using_concept_of_region''​) and //​[[:​Calculate Map]]// and finally connect the first to //​[[:​Regionalize Map]]//​. ​  
 + 
 +{{ :​tutorial:​region6.jpg |}}\\ 
 +\\ 
 +Note that there are two //[[:Number Map]]// functors disconnected within //​[[:​Calculate Map]]//. You do not need the Map #2 and Value #1 anymore, so delete them. Now connect //​[[:​Regionalize Map]]// to Map #1. Open the [[:Save  
 +Lookup Table]] functor and change the file name to ''​remaining_forest_extent_per_state''​. Make sure it will be saved into folder ''​\Guidebook_Dinamica_5\Models\using_concept_of_region''​\\ 
 +\\ 
 +{{ :​tutorial:​region7.jpg |}}\\ 
 +\\ 
 +\\ 
 +At a last step, you will need to modify the //​[[:​Calculate Map]]//. Open it with Edit Functor. Write: **if i1 = 2 then 1 else null**. Remember that "​2"​ represents forest.\\ 
 +\\ 
 +{{ :​tutorial:​region5.jpg |}}\\ 
 +\\ 
 +Finally save the model as a new file ''​calc_forest_remaining_extent_per_state_using_subregions''​ into folder ''​\Guidebook_Dinamica_5\Database\using_concept_of_region''​ and run it.\\  
 +\\ 
 +Can you explain how this model works?\\ 
 +\\ 
 +Observe that you did not need to segregate the information per state in //​[[:​Calculate Map]]// because //​[[:​Regionalize Map]]// already did it. 
 +  
 +<​note>​The region approach is a helpful way to break the map into several subsets either to customize a submodel, for example to run with different parameters per country, state or county, or to optimize the memory usage as the model does not need to handle all the map cells for a specific calculation or processing, but only the cells selected from a region per time</​note>​ 
 +\\ 
 +\\ 
 +===Congratulations,​ you have successfully completed this lesson!=== 
 +\\ 
 +☞[[lesson_15|Next Lesson]] 
 +\\ 
 +☞[[:​guidebook_start| Back to Guidebook Start]]