This is an old revision of the document!


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


LESSON 15: Using "while" to make successive calculations



In the previous exercise we calculate the biomass of the expanded area every year. However, it may be necessary to calculate the biomass of the expanded area each year by category of Legal Amazon Protected Areas.

For this, we will use:

  • The protected areas map in the year 2000 (Guidebook Dinamica_4/Database/Protected_areas/protected_areas_2000.tif)
  • The Legal Amazon Biomass map (Guidebook Dinamica_4/Database/biomass/biomass.tif)



This exercise is very similar to the previously model. However, now, calculate Map produces a map containing the remaining forest for each category every year.
Grab the container Repeat from the Control tab and place it on the sketch. Drag the previously model into it. It will automatically resize to envelop Calculate Map. We will extract the attributes and statistics by category using an Extract Categorical Map Attributes. This functor calculates basic statistics from a map for each area delimited by a class. Also grab the functors Get table from key and Lookup table and place it on the Repeat.



The functor Lookup Table is a structure used as a link to other functors, transforming a table into a lookup table.

The functor Get Table From Key retrieves the sub-table corresponding to the given chain of keys (In this case: “12”) from a given input table.



Click on the Mux Table with the Edit Functor Ports. Every Mux functor has two input ports. In the first iteration, it reads the input from the Initial port; thereafter it receives the data from the model step through the port Feedback.

TIP:Note that in addition to the Year and CO2 content columns we have the type of Legal Amazon Protected Areas.





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

Click on the layout tool Left to Right and your final model will look like the one below:



Save and run the model!

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



The result is returned in a table contains the extracted classes and their corresponding attributes year per year by each category of Legal Amazon Protected Areas.