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_5 [2019/08/13 16:43]
argemiro
lesson_5 [2020/02/19 16:36] (current)
argemiro
Line 1: Line 1:
-=====LESSON 5Implementing a simple map algebra on Dinamica EGO=====  ​+{{ :logo_logo.png?​400 |}}
 \\ \\
-==In this lesson we would like to demonstrate how to use Dinamica EGO in a very simple way: just converting the values of Belo Horizonte temperature map. We will transform it from Celsius into Fahrenheit.== 
 \\ \\
-**Which Functors will you use in this lesson?**\\ \\ +====LESSON 5Implementing simple map algebra on Dinamica EGO====
-• FunctorsLoad Map, Calculate Map and Save Map\\+
 \\ \\
-Now let us move forward and learn about a very important functor ​to work with maps: Calculate Map. This functor is used for map algebra: ​to combine and process maps, tables and constants. Inside Calculate Map it is possible to write expressions that can include arithmetic, logical and conditional elements.  +In this lesson we demonstrate how to use Dinamica EGO to convert ​the values of Belo Horizonte temperature map from Celsius into the Fahrenheit scale.
-\\ \\ +
-**Let'​s go!** Click on the Input/​output tab, grab and place on the sketch a Load Map and open the air_temperature.tiff file. Next, click on the Map Algebra tab, grab and place on the sketch one Calculate Map. +
-\\ \\ +
-<note tip>​**TIP:​** Calculate Map as a container, it mens does not function by itself. There is a need to add supplementary functors to it</​note>​+
 \\ \\
 \\ \\
-Click in the hook tool  to create a hook functor with Number Map inside the Calculate Map. The container will resize to accommodate the Number Map. For this, click on the Number Map with the Functor Editor tool and enter “1” (do not write the quotation marks). This is a number identifier for a map and will be represented within the equation box as i1 (input 1).+**Which Functors will you use in this lesson?** [[Load Map]], [[Calculate Map]] and [[Save Map]] 
 +\\ 
 +\\ 
 +The [[Calculate Map]] functor is for map algebra: to combine and process maps, tables and constants. Inside [[Calculate Map]] it is possible to write expressions that including arithmetic, logical and conditional elements.  
 +\\ 
 +\\ 
 +**Let'​s go!**  
 +\\ 
 +\\ 
 +Click on the Input/​Output tab, drag a [[Load Map]] to the sketch and open the ''​air_temperature.tif''​ file used in the previous lesson. Next, click on the Map Algebra tab, grab and place on the sketch one [[Calculate Map]] and one [[Save Map]] functor. In the [[Save Map]] functor browse to ''​Guidebook_Dinamica_5\Models\simple_map_algebra''​ and write the file name ''​temperature_fahrenheit.tif''​. 
 +\\ 
 +\\ 
 +Select the [[Calculate Map]] and click on the hook tool on action bar to create a [[Number Map]] inside the [[Calculate Map]] if there isn't one already. The container will resize to accommodate the [[Number Map]]Double ​click on the Number Map and enter “1” (do not write the quotation marks) ​as the Map Number. This is a number identifier for a map and will be represented within the equation box as ''​i1'' ​(input 1).
 \\ \\
 \\ \\
Line 19: Line 25:
 \\ \\
 \\ \\
-<note tip>**TIP:​** ​Each map processed by this container will be represented by the Number Map functor. You can enter other maps by adding more Number Map functors, ​but each one must have a unique number identifier.</​note>​+<note tip> 
 +Each map processed by this container will be represented by the [[Number Map]] functor. You can enter other maps by adding more [[Number Map]] functors, each one having an unique number identifier. ​This is a common usage pattern in Dinamica EGO models allowing an unlimited number of inputs to be used by a given container. 
 +</​note>​ 
 +\\ 
 +\\ 
 +Now you can connect the functor [[Load Map]] to the [[Number Map]]. Use the connect tool (the lightning icon) to establish the connections. Note that the connection must be established between the [[Load Map]] functor and the [[Number Map]] inside of [[Calculate Map]] and not to [[Calculate Map]] itself.
 \\ \\
 \\ \\
-Now you can connect the functor Load Map to the Number Map. Use the connect tool (the arrow icon) to establish the connections:​ 
 {{ :​imagem23.png?​400 |}} {{ :​imagem23.png?​400 |}}
 \\ \\
 \\ \\
-Open the Calculate Map container ​by grabbing the Edit Functor and clicking on it. Note that map #1 is represented by i1. The Calculate Map enables the formulation of various algebraic and logic equations containing maps, tables and constants.  +Open [[Calculate Map]] by double ​clicking on it. Note that map #1 is represented by ''​i1''​. The [[Calculate Map]] enables the formulation of various algebraic and logic equations containing maps, tables and constants.
-Besides writing the equation, there are two parameters that must be set: The Cell Type and the Null Value. You will always find these parameters in functors that produce maps as output. The default is “Signed 32 Bit Integer”, but you can use “IEEE 754 32 Bit Real” to represent fractional numbers+
 \\ \\
 +Besides writing the equation, there are two parameters that must be set: The Cell Type and the Null Value. You will always find these parameters in functors that produce maps as output. The default is set to “Signed 32 Bit Integer”, but you can use “IEEE 754 32 Bit Real” to represent fractional numbers. ​
 \\ \\
-<note tip>**TIP:** Try to use always ​the most economical representation for data cell type to save memory. If you are not sure about the numeric range of the output, use real number representation. </​note>​+\\ 
 +<note tip> 
 +Always aim at the most economical representation for data cell type to save memory. If you are not sure about the numeric range of the output, use real number representation. 
 +</​note>​
 \\ \\
 \\ \\
Line 36: Line 49:
 \\ \\
 \\ \\
-Now, let’s write a simple equation to convert the Belo Horizonte temperature in Celsius ​into Fahrenheit: ​\\ +Now, let’s write a simple equation to convert the Belo Horizonte temperature in the Celsius ​scale to Fahrenheit: ​
-i1 * 1.8 + 32 or Belo Horizonte Temperature * 1.8 + 32+
 \\ \\
 +  i1 * 1.8 + 32
 \\ \\
-<note warning>​Although you won’t need it in this lesson, you might set the null value by first turning on the Null Value flag on the Load Map and then setting its value to “0”.</​note>​+where ''​i1''​ represents ​the ''​Belo Horizonte Temperature''​ map.
 \\ \\
 \\ \\
-{{ :imagem25.png?700 |}}+Despite the fact that the expression is presented using the alias of the functor from where the corresponding map is coming, you specify the map in the expression just typing the identifier i1. Momentarily,​ that identifier will be automatically replaced by the corresponding map alias. Another easy option to enter the map identifier is to click on the corresponding map name on the list above the image expression.
 \\ \\
 \\ \\
-Click on the Input/​output tab, grab and place on the sketch one Save Map and browse ​to the Dinamica EGO\Guidebook Dinamica_4\Models\Set_1\basics\1_load_save and write the name file (“temperature_fahrenheit.tif”)+<​note>​ 
 +Although you won’t need it in this lesson, you might set the null value by first turning ​on the Null Value option ​on the Load Map and then setting its value to a value outside ​the range of values represented in the map. 
 +</​note>​
 \\ \\
 \\ \\
-<note tip>**TIP:​** ​You can rearrange the model by clicking on the button ​execute layout. Note that the model will be organized from left to right or left to bottom according to its execution sequence. </​note>​+{{ :​imagem25.png?​700 |}} 
 +\\ 
 +\\ 
 +<note tip> 
 +You can rearrange the model on the sketch ​by clicking on the Execute Layout ​button. ​ 
 +</​note>​ 
 +\\
 \\ \\
 +The final model will look like this: 
 \\ \\
-The final model will look like this: \\ 
 {{ :​imagem26.png?​600 |}} {{ :​imagem26.png?​600 |}}
 \\ \\
 \\ \\
-Save and run the model by clicking on the run model script button on the top toolbar. ​The map will look like this: +Save and run the model by clicking on the run model script button on the main toolbar. ​After adjusting limits and choosing a suitable transformation,​ as in the previous lesson, the map will look like this: 
-\\ \\+\\  
 +\\
 {{ :​imagem27.png?​700 |}} {{ :​imagem27.png?​700 |}}
 +\\ 
 +\\ 
 +Congratulations,​ you have successfully completed this lesson!  
 +\\ 
 +\\ 
 +☞[[:​lesson_6 | Next Lesson]] 
 +\\ 
 +☞[[:​guidebook_start| Back to Guidebook Start]] ​