This is an old revision of the document!


PHP's gd library is missing or unable to create PNG images


LESSON 9: Working with maps and tables iteratively



Which Functors will you use in this lesson?

• Functors: Calc areas and Calculate map

We will use:
- The protected areas map in the year 2000 (Guidebook Dinamica_4/Database/Protected_areas/protected_areas_2000.tif)

- The Legal Amazon Conservation Priority map (Guidebook Dinamica_4/Database/Priority_areas/priority_areas.tif)

- The Legal Amazon Biomass map (Guidebook Dinamica_4/Database/biomass/biomass.tif)

Let's go! Initially, From the library window grab and place on the sketch the Load Categorical Map Functor, which are located in the Input/Output tab. Double click, and open the protected_areas_2000.tif file.



Click on the Map Algebra tab from the library window, grab a Calc areas functor, place it on the sketch and connect the Load Categorical Map to them. The expression result is calculated as a real value and converted to the data cell type of the output map.

Now you need to save the result to a file. For this, Grab and place on the sketch the Save Table functor and connect the functor Calc areas to them. Open Save Map, select a folder and write a name file to save (suggestion: Areas of Legal amazon protected areas.csv).



Mark the eye button at the top of “Save Table” to viewer the results hereafter.

Save your model (Disk button on the main tool bar) and then run it by clicking on the run button (blue arrow on the main tool bar).

Now, click on eye button of “Save Table” to see the result. This functor output is table that looks like this:



What is your model doing? It is loading “protected_areas_2000.tif” file and then calculating the area of each category of Legal Amazon Protected Areas.

Go ahead! Now, The intent is to calculate biomass and Carbon Dioxide content in Biomass in high priority conservation areas within protected areas.

Initially, we must open all the files that will be used. Click on the Input/output tab from the library window and grab two Load Categorical Map functors and place it on the sketch. Double click each Load Categorical Map Functor and open the Legal Amazon Conservation Priority and protected areas map files. Also grab and place a Load Map and open the Legal Amazon Biomass map. You should have something like this:



Now, grab a Calculate Map and place it on the sketch. Click in the hook tool to create three hook functors with Number Map inside the Calculate Map. Now assign a number to each Number Map (Suggestion: “1”, “2” and “3”, respectively). This is a number identifier for each map and will be represented within the equation box as i1, i2 and i3. Now you need to connect the functors to establish a model. Connect the Load Map and Load Categorical Map functors to each Number Map. You should have something like this:



Now, write the following equation inside to Calculate Map to calculate biomass in each high priority conservation areas within protected area. On Dinamica EGO interface you should have something like this:



Now, you need save the result of biomass to a file. Grab a Save Table, place it on the sketch and connect the Calculate map to them. Open Save Map, browse to the folder preferred and write the name file (We suggest: biomass_high priority conservation_protected areas_map.tif).

Mark the eye button at the top of “Save Table” to viewer the results hereafter.

At this step you should have something like this:



Now, we will extract the attributes and calculates basic statistics from Biomass in high priority conservation protected area. For this, Grab and place on the sketch a Extract map attributes functor (this functor produces as output a table with map attributes) and connect the Calculate Map to them.

Grab and place on the sketch a Calculate value functor. Click in the hook tool to create three hook functors inside the Calculate Map: one Number table and two Number value functors. Assign a number to each Number Value and Number Table.

In some cases, is very useful to add a constant value to the operations in Dinamica. In this step, we will demonstrate how to do this. For this, grab and place on the sketch two Real value functors located on the Map Algebra suppl. tab to insert two double precision real constants: One is a CO2 conversion factor (3.666) and other a Carbon Content in Biomass (0.47). Connect the Extract map attributes Map to Number Table and the two Real Value functors to Number Value Functors inside the Calculate Value. At this step you should have something like this:



Now, write the following equation inside to Calculate Value to estimate CO2 content of high priority conservation areas within protected areas using the Map statistics calculate by Extract Map attributes functor (“cellSum” and “cellArea”) and the two constant values added (v1 and v2):

t1[“cellSum”] * t1[“cellArea”] * v1 * v2

On Dinamica EGO interface you should have something like this:



Now, grab a Set Lookup Table Value Functor and place on the sketch to insert the calculate values into a lookup table. It is important to pay attention to add correctly the key to the line where the value will be inserted:



IMPORTANT: If the table is already filled in, it replaces the old values with new values.

Now you need to save the result to a file. For this, Grab and place on the sketch the Save Lookup Table functor and connect the functor Set Lookup Table to them. Open Save Lookup Table, select a folder and write a name file to save (We Suggest: high priority cons_prot areas_CO2.csv).

The final model will look like this:



Mark the eye button at the top of “Save Lookup Table” to viewer the result hereafter.

Save your model (Disk button on the main tool bar) and then run it by clicking on the run button (blue arrow on the main tool bar).

Now, click on eye button of “Save Lookup Table” to see the result. This functor output is table that looks like this:



Congratulations, you have successfully completed this lesson! Now let’s move to the next lesson: LESSON 10: What are, what types and where are the submodels in Dinamica EGO?