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
tutorial:multiple_criteria_evaluation_in_dinamica_ego [2013/08/13 20:55]
admin
tutorial:multiple_criteria_evaluation_in_dinamica_ego [2017/01/27 17:00] (current)
francisco [Sixth step: identifying suitable areas 2]
Line 46: Line 46:
  {{ :​tutorial:​mce_1.2.jpg |}}  {{ :​tutorial:​mce_1.2.jpg |}}
  
-Lets start developing the model. Place //[[:Load Categorical Map]]// on the sketch and open the file ''​\lesson4\original\landuse.tif''​. Now place //​[[:​Calculate Map]]// and //[[:Number Map]]// within it. Enter "​1"​ in **Map Number** in //[[:Number Map]]//. Now place //[[:Save Map]]// and enter ''​unconstrained_areas.tif'',​ make sure you have changed the folder to lesson5. Change file format to **Geotiff** and set **Suffix Digits** to "​0"​. ​+Let's start developing the model. Place //[[:Load Categorical Map]]// on the sketch and open the file ''​\lesson4\original\landuse.tif''​. Now place //​[[:​Calculate Map]]// and //[[:Number Map]]// within it. Enter "​1"​ in **Map Number** in //[[:Number Map]]//. Now place //[[:Save Map]]// and enter ''​unconstrained_areas.tif'',​ make sure you have changed the folder to lesson5. Change file format to **Geotiff** and set **Suffix Digits** to "​0"​. ​
  
 <note tip>​**TIP**:​ you can increase model performance by avoiding saving intermediate map files. In this step, you will save the map just to check the result from this operation. Do not forget to connect all functors.</​note>​ <note tip>​**TIP**:​ you can increase model performance by avoiding saving intermediate map files. In this step, you will save the map just to check the result from this operation. Do not forget to connect all functors.</​note>​
Line 54: Line 54:
 **if i1 = 0 then null else if i1 = 1 then null else if i1 =4 then null else if i1 = 5 then null else 1** **if i1 = 0 then null else if i1 = 1 then null else if i1 =4 then null else if i1 = 5 then null else 1**
  
-The null value will mask out rivers, flooded plains, urban areas, and roads in subsequent map operations. Do not forget to set **Data Cell Type** to "​Unsigned 8 Bit Integer"​ and **Null Value** to 0.+The null value will mask out rivers, flooded plains, urban areas, and roads in subsequent map operations. Do not forget to set **Cell Type** to "​Unsigned 8 Bit Integer"​ and **Null Value** to 0.
  
 {{ :​tutorial:​mce_2.jpg |}} {{ :​tutorial:​mce_2.jpg |}}
Line 80: Line 80:
 **Source** is a map containing the features to which distances will be calculated. A feature is represented by a non-null value. **Mask** is a map used to mask the distance calculation on its null cells. Let’s connect the output from //​[[:​Calculate Categorical Map]]// to **Source** and Categorical Map ''​landuse.tif''​ to **Mask**. Now open the //​[[:​Calculate Categorical Map]]// and write the following equation:\\ **Source** is a map containing the features to which distances will be calculated. A feature is represented by a non-null value. **Mask** is a map used to mask the distance calculation on its null cells. Let’s connect the output from //​[[:​Calculate Categorical Map]]// to **Source** and Categorical Map ''​landuse.tif''​ to **Mask**. Now open the //​[[:​Calculate Categorical Map]]// and write the following equation:\\
  
-**if i1 = 5 then1 else null**+**if i1 = 5 then 1 else null**
  
-Remember that 5 is the number identifier for urban. You do not need to change either **Data cell type** or **Null Value** in both functors, although to save memory you could set "​Signed 8 Bit Integer"​ and **Null Value** to "​0"​ in //​[[:​Calculate Categorical Map]]//. You may also turn on the option **Truncate Distance** in Calc Distance to Feature Map. This will avoid exceeding the maximum numerical representation selected for **Data cell type**.+Remember that 5 is the number identifier for urban. You do not need to change either **Cell type** or **Null Value** in both functors, although to save memory you could set "​Signed 8 Bit Integer"​ and **Null Value** to "​0"​ in //​[[:​Calculate Categorical Map]]//. You may also turn on the option **Truncate Distance** in Calc Distance to Feature Map. This will avoid exceeding the maximum numerical representation selected for **Cell type**.
  
 Now connect the port **Distance** in //[[:Calc Distance to Feature Map]]// to //[[:Save Map]]//. The model should be ready to run. Always save the model before putting it to run. Save it as ''​my_MCE_part1&​2.egoml''​. Examine the result with the Map Viewer. Now connect the port **Distance** in //[[:Calc Distance to Feature Map]]// to //[[:Save Map]]//. The model should be ready to run. Always save the model before putting it to run. Save it as ''​my_MCE_part1&​2.egoml''​. Examine the result with the Map Viewer.
Line 158: Line 158:
 **if i1 = 6 then 0.1 else 0.3** **if i1 = 6 then 0.1 else 0.3**
  
-Now connect its output to a //[[:Calculate ​Cost Map]]// functor (to its **Friction** port). You will need another //​[[:​Calculate Map]]// to pinpoint the neighboring towns from the land-use map using the equation below:+Now connect its output to a //[[:Calc Cost Map]]// functor (to its **Friction** port). You will need another //​[[:​Calculate Map]]// to pinpoint the neighboring towns from the land-use map using the equation below:
  
 **if i1 = 5 then 1 else null** **if i1 = 5 then 1 else null**
Line 164: Line 164:
 <note important>​Important:​ Do not forget to change **Cell Type** both in //​[[:​Calculate Map]]// that generates the friction map and also in //[[:Calc Cost Map]]// to "IEEE 754 Bit Real". Remember that the cell cost is expressed in fractional number.</​note>​ <note important>​Important:​ Do not forget to change **Cell Type** both in //​[[:​Calculate Map]]// that generates the friction map and also in //[[:Calc Cost Map]]// to "IEEE 754 Bit Real". Remember that the cell cost is expressed in fractional number.</​note>​
  
-Now pass the output of the //[[:Calc Cost Map]]// to another //​[[:​Calculate Map]]// to produce a Boolean map according to the maximum time of traveling, as follows:+After connecting the output of the last //​[[:​Calculate Map]]// to  the //[[:Calc Cost Map]]// functor (to its **Source** port), ​pass the output of the //[[:Calc Cost Map]]// to another //​[[:​Calculate Map]]// to produce a Boolean map according to the maximum time of traveling, as follows:
  
 **if i1 < 30 then 1 else null** **if i1 < 30 then 1 else null**
  
-Finally save the output map as ''​near_town_region.tif''​. Note that you have added to the model three additional //​[[:​Calculate Map]]// functors, three //[[:Number Map]]// functors, one //[[:Calc Cost Map]]// and another //[[:Save Map]]//. The model should look like the following figure, in which the functors added in this step appear in the upper part. +Finally save the output map as ''​near_town_region.tif''​. Note that you have added to the model three additional //​[[:​Calculate Map]]// functors, three //[[:Number Map]]// functors, one //[[:Calc Cost Map]]// and another //[[:Save Map]]//. The model should look like the following figure.
 {{ :​tutorial:​mce12.jpg |}} {{ :​tutorial:​mce12.jpg |}}
  
-Check model, integrity, save it as ''​my_MCE_part1&​2&​3.egoml'',​ and run it. Examine map ''​near_town_region.tif''​. Is this what you got?+Save the model as ''​my_MCE_part1&​2&​3.egoml'',​ and run it. Examine map ''​near_town_region.tif''​. Is this what you got?
  
 {{ :​tutorial:​mce13.jpg |}} {{ :​tutorial:​mce13.jpg |}}
Line 194: Line 193:
 Firstly, you can delete the //[[:Save Map]]// functors, since you have already checked their results. Second, you can add comments to some functors highlighting their outcomes. Let’s do it! Firstly, you can delete the //[[:Save Map]]// functors, since you have already checked their results. Second, you can add comments to some functors highlighting their outcomes. Let’s do it!
  
-Grab the Add Comment to Functor tool from the sketch toolbar. Describe the outcome in each functor preceding the //[[:Save Map]]// functors, so you can trace each data flow back to its initial node (that is Map ''​landuse.tif''​).  In order to be able to see the comment you need to close the container //​[[:​Calculate Map]]// first. Do it by clicking on its top left icon. +Grab the Add Comment to Functor tool from the sketch toolbar. Describe the outcome in each functor preceding the //[[:Save Map]]// functors, so you can trace each data flow back to its initial node (that is Map ''​landuse.tif''​). Do it by clicking on its top left icon. 
  
 Write in respective functors: Near town regions, Malaria free zone, Away from towns, Unconstrained land uses, Not too far from main roads. Write in respective functors: Near town regions, Malaria free zone, Away from towns, Unconstrained land uses, Not too far from main roads.
Line 242: Line 241:
 ==== Fifth step: identifying suitable areas ==== ==== Fifth step: identifying suitable areas ====
  
-In this step, you will identify the suitable areas equal to or greater than 1000 hectares. First, delete //[[:Load Map]]// ''​five_criteria_combined.tif''​. Remember that the less the software accesses the disk, the faster the model runs. Now, drag from Map Algebra tab the functor [[:Calc Patch Label Map]]. This functor labels patches of cells using sequential numbers. A patch consists of a continuous group of neighboring cells of the same category (see also lesson 10: Landscape metrics in Dinamica EGO). You need this in order to solve the area criterion. Connect the output from "​Combine Five Criteria"​ to it. Some of its parameters are:+In this step, you will identify the suitable areas equal to or greater than 1000 hectares. First, delete //[[:Save Map]]// ''​five_criteria_combined.tif''​. Remember that the less the software accesses the disk, the faster the model runs. Now, drag from Map Algebra tab the functor [[:Calc Patch Label Map]]. This functor labels patches of cells using sequential numbers. A patch consists of a continuous group of neighboring cells of the same category (see also [[landscape_metrics_in_dinamica_ego|Landscape metrics in Dinamica EGO]]). You need this in order to solve the area criterion. Connect the output from "​Combine Five Criteria"​ to it. Some of its parameters are:
  
 **Initial Patch Label**: Set it to "​1"​. ​ **Initial Patch Label**: Set it to "​1"​. ​
Line 248: Line 247:
 <note important>​Important:​ Set **Null Value** to "​0"​ and **Cell Type** to **Signed 32 Bit Integ**er.</​note> ​ <note important>​Important:​ Set **Null Value** to "​0"​ and **Cell Type** to **Signed 32 Bit Integ**er.</​note> ​
  
-This will be sufficient to store all patch label number identifiers. Leave the other parameters untouched. Go to help for further details. Now connect its output to [[:Calc Areas]], available in the Map Algebra tab. As output this functor provides one table with three columns. See [[:Calc Areas#​notes]] for additional information about the [[:Calc Areas]] result. We need area in hectares, <​del>​so use the port **Areas in Hectares** for subsequent connection</​del>​.+This will be sufficient to store all patch label number identifiers. Leave the other parameters untouched. Go to help for further details. Now connect its output to [[:Calc Areas]], available in the Map Algebra tab. As output this functor provides one table with three columns. See [[:Calc Areas#​notes]] for additional information about the [[:Calc Areas]] result.
  
-{{ :tutorial:mce20.jpg |}}+Now, place on the sketch one //[[:Calculate Map]]// and one //[[:Number Map]]// and one //[[:Number Table]]// within itConnect //[[:Calc Areas]]// to Table 1 (this implies that output of //[[:Calc Areas]]// is a lookup table), and **Map** output from //[[:Calc Patch Label Map]]// to Map #1. Now open //​[[:​Calculate Map]]// and write:
  
-Now, place on the sketch one //Calculate Map// and one //Number Map// and one //Number Table// within it. Connect //Calc Areas// to Table 1 (this implies that output of //Calc Areas// is a lookup table), and **Map** output from //Calc Patch Label Map// to Map #1. Now open //Calculate Map// and write: ​+**''​if ​(t1[ [i1]["​Area_In_Hectares"​] ] < 1000then null else 1''​**
  
-**if (t1[i1] < 1000) then null else 1** +Using this formula, the functor will analyze the size of each patch and then eliminate the patches smaller than 1000 hectares. Now place one //[[:Save Map]]// and enter ''​big_areas.tif''​.
- +
-Using this formula, the functor will analyze the size of each patch and then eliminate the patches smaller than 1000 hectares. Now place one //Save Map// and enter ''​big_areas.tif''​.+
  
 {{ :​tutorial:​mce21.jpg |}} {{ :​tutorial:​mce21.jpg |}}
Line 264: Line 261:
 {{ :​tutorial:​mce22.jpg |}} {{ :​tutorial:​mce22.jpg |}}
  
-Great, what a haul! But before moving on to the next step, there is still a last thing to do. In order to keep the patch labels, you need to multiply the output from the last //Calculate Map//, to which you have added the comment "​Identify big patches",​ with the output from //Calc Patch Label//. Therefore, you will keep only the labels for the big patches. ​ +Great, what a haul! But before moving on to the next step, there is still a last thing to do. In order to keep the patch labels, you need to multiply the output from the last //[[:Calculate Map]]//, to which you have added the comment "​Identify big patches",​ with the output from //[[:Calc Patch Label Map]]//. Therefore, you will keep only the labels for the big patches.
  
-Place one //Calculate Categorical Map// and two //Number Map// functors within it. Set their //Number Map// functors to "​1"​ and "​2"​ respectively,​ and remove the //Save Map// functor. Now connect functors as follows:+Place one //[[:Calculate Categorical Map]]// and two //[[:Number Map]]// functors within it. Set their //[[:Number Map]]// functors to "​1"​ and "​2"​ respectively,​ and remove the //[[:Save Map]]// functor. Now connect functors as follows:
  
 {{ :​tutorial:​mce23.jpg |}} {{ :​tutorial:​mce23.jpg |}}
  
-<note important>​You need //Calculate Categorical Map// instead of //Calculate Map//, because patch labels will be used ahead to regionalize the slope map, set Null Value to "​0"​and Cell Type to Signed 32 Bit Integer.</​note>​+<note important>​You need //[[:Calculate Categorical Map]]// instead of //[[:Calculate Map]]//, because patch labels will be used ahead to regionalize the slope map, set **Null Value** to "​0"​ and **Cell Type** to "Signed 32 Bit Integer".</​note>​
  
 Write: **i1*i2**, close the functor and insert the comment "Keep labels only for big patches"​. Now you are ready to move on to the last step. Write: **i1*i2**, close the functor and insert the comment "Keep labels only for big patches"​. Now you are ready to move on to the last step.
Line 278: Line 275:
 The final criterion establishes that the average slope on the selected patches must be less than 0.5 degrees. Place //Load Map// and load it with ''​\lesson4\originals\slope.tif''​. Now revise Lesson3, as you will to need to reapply the concept of region. The final criterion establishes that the average slope on the selected patches must be less than 0.5 degrees. Place //Load Map// and load it with ''​\lesson4\originals\slope.tif''​. Now revise Lesson3, as you will to need to reapply the concept of region.
  
-Drag //Region Manager//, //For Each Category//, //​Regionalize Map//, and //​Step// ​and insert the two latter functors within the previous ​and //For Each Category// within the //Region Manager// ​and connect them as follows.+Drag //[[:For Each Region]]//, //[[:Regionalize Map]]//, and //[[:Step]]//insert the two latter functors within the previous and connect them as follows.
  
 {{ :​tutorial:​mce24.jpg |}} {{ :​tutorial:​mce24.jpg |}}
  
-The map to be regionalized is the ''​slope.tif''​. ​ The map output from the last //Calculate Categorical Map// will control ​both //Region Manager// and //For Each Category//. Remember that this functor enables the model to iterate according to the map categories passed to it. Now place one //Mux Lookup Table//, one //Extract Map Attributes//,​ one //Calculate Value//, one //Number Table// and one //Set Lookup Table//, all within //For Each Category// and connect them as follows.+The map to be regionalized is the ''​slope.tif''​. ​ The map output from the last //[[:Calculate Categorical Map]]// will control //[[:For Each Region]]//. Remember that this functor enables the model to iterate according to the map categories passed to it. Now place one //[[:Mux Lookup Table]]//, one //[[:Extract Map Attributes]]//, one //[[:Calculate Value]]//, one //[[:Number Table]]// and one //[[:Set Lookup Table Value]]//, all within //[[:For Each Region]]// and connect them as follows.
  
 {{ :​tutorial:​mce25.jpg |}} {{ :​tutorial:​mce25.jpg |}}
  
-Write equation: **t1[13]** in the //Calculate Value//. Remember that 13 is the key for the average of all non null cells in the attribute table. This submodel is very similar to the one introduced in Lesson 3. Open //Extract Map Attributes//​ and set the option:+Write equation: **t1[13]** in the //[[:Calculate Value]]//. Remember that 13 is the key for the average of all non null cells in the attribute table. This submodel is very similar to the one introduced in Lesson 3. Open //[[:Extract Map Attributes]]// and set the option:
  
 {{ :​tutorial:​mce26.jpg |}} {{ :​tutorial:​mce26.jpg |}}
  
-Remember to link //Step// to **Key** on the //Set Lookup Table//+Remember to link //[[:Step]]// to **Key** on the //[[:Set Lookup Table Value]]//
  
 {{ :​tutorial:​mce27.jpg |}} {{ :​tutorial:​mce27.jpg |}}
Line 298: Line 295:
 {{ :​tutorial:​mce28.jpg |}} {{ :​tutorial:​mce28.jpg |}}
  
-Open //Mux Lookup Table// with the Edit Functor Ports and click on **Initial**,​ enter a blank table. Just enter once "​0"​ and "​0",​ as **Key** and **Value**. Register the **Table** output port to be viewed. You might want to see the results.+Open //[[:Mux Lookup Table]]// with the Edit Functor Ports and click on **Initial**,​ enter a blank table. Just enter once "​0"​ and "​0",​ as **Key** and **Value**. Register the **Table** output port to be viewed. You might want to see the results.
  
 {{ :​tutorial:​mce29.jpg |}} {{ :​tutorial:​mce29.jpg |}}
  
-Finally place //Calculate Categorical Map// after the //​Region ​Manager// and place //Map Number Map// and //Number Table// within it. Number them and write the following equation: **if t1[i1] > 0.5** then null else i1+Finally place //[[:Calculate Categorical Map]]// after the //[[:For Each Region]]// and place //[[:Number Map]]// and //[[:Number Table]]// within it. Number them and write the following equation: **if t1[i1] > 0.5** then null else i1 
 + 
 +Save the result as ''​suitable_for_a_new_town.tif''​ on the lesson5 folder. 
  
-Save the result as ''​suitable_for_a_new_town.tif''​. 
  
 {{ :​tutorial:​mce30.jpg |}} {{ :​tutorial:​mce30.jpg |}}
Line 312: Line 311:
 {{ :​tutorial:​mce31.jpg |}} {{ :​tutorial:​mce31.jpg |}}
  
-Finally you just need to organize the model in a more legible layout. Place one //Group// and drag //Calc Patch Label Map//, //Calc Areas//, //Calculate Map// "​Identify big areas", and //Calculate Map// "Keep labels only for big patches"​ into it.+Finally you just need to organize the model in a more legible layout. Place one //[[:Group]]// and drag //[[:Calc Patch Label Map]]//, //[[:Calc Areas]]//, //[[:Calculate Map]]// "​Identify big patches", and //[[:Calculate ​Categorical ​Map]]// "Keep labels only for big patches"​ into it.
  
 {{ :​tutorial:​mce32.jpg |}} {{ :​tutorial:​mce32.jpg |}}
  
-Close it and add the comment "Label and select big patches",​ close the //Region Manager// and add "​Calculate average slope for each big patch",​ close the last //Calculate Map// functor and add "​Eliminate patches with average slope > 0.5" and lastly, add the comment "Save final map" to Map ''​suitable_for_a_new_town.tif''​.+Close it and add the comment "Label and select big patches",​ close the //[[:Region Manager]]// and add "​Calculate average slope for each big patch",​ close the last //[[:Calculate Map]]// functor and add "​Eliminate patches with average slope > 0.5" and lastly, add the comment "Save final map" to Map ''​suitable_for_a_new_town.tif''​.
  
 Save the model as ''​my_MCE_part1&​2&​3&​4&​5&​6_complete.egoml''​. This is the final model. ​ Save the model as ''​my_MCE_part1&​2&​3&​4&​5&​6_complete.egoml''​. This is the final model. ​
Line 328: Line 327:
    
 <note tip> <note tip>
-**TIP**: You will need to recalculate the areas for the remaining patches and pass this table to //For Each//, which allows to browse through a table. Place two //Mux Value// inside the //For Each//, one will handle the maximum area value and the other will store its key.</​note>​+**TIP**: You will need to recalculate the areas for the remaining patches and pass this table to //[[:For Each]]//, which allows to browse through a table. Place two //[[:Mux Value]]// inside the //[[:For Each]]//, one will handle the maximum area value and the other will store its key.</​note>​
  
 [[tutorial:​building_a_land-use_and_land-cover_change_simulation_model| Next Lesson]] [[tutorial:​building_a_land-use_and_land-cover_change_simulation_model| Next Lesson]]