Modelagem Dinâmica com TerraME: Aula 3 Interface entre TerraME e LUA Gilberto Câmara (INPE) Tiago Garcia de Senna Carneiro (UFOP)

Slides:



Advertisements
Similar presentations
Algebraic Formalism over Maps João Pedro Cerveira Cordeiro Gilberto Câmara Ubirajara F. Moura Cláudio Barbosa Felipe Almeida GeoInformation Group Image.
Advertisements

Spatio-Temporal Database Constraints for Spatial Dynamic Simulation Bianca Maria Pedrosa Luiz Camolesi Júnior Gilberto Câmara Marina Teresa Pires Vieira.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Chapter 7: User-Defined Functions II
CELLULAR AUTOMATA Derek Karssenberg, Utrecht University, the Netherlands LIFE (Conway)
Map Analysis with Raster Datasets Francisco Olivera, Ph.D., P.E. Department of Civil Engineering Texas A&M University.
Introduction to Structured Query Language (SQL)
Names and Bindings Introduction Names Variables The concept of binding Chapter 5-a.
A Language to Support Spatial Dynamic Modeling Bianca Pedrosa, Gilberto Câmara, Frederico Fonseca, Tiago Carneiro, Ricardo Cartaxo Brazil’s National Institute.
Geography 241 – GIS I Dr. Patrick McHaffie Associate Professor Department of Geography Cook County, % population < 5.
Dr. David Liu Objectives  Understand what a GIS is  Understand how a GIS functions  Spatial data representation  GIS application.
Introduction At the heart of the growth of a multi-cellular organism is the process of cellular division… … aka (in computing) self-replication.
Nawaf M Albadia Introduction. Components. Behavior & Characteristics. Classes & Rules. Grid Dimensions. Evolving Cellular Automata using Genetic.
Spatial Dynamical Modeling with TerraME Tiago Carneiro Gilberto Câmara.
Spatial Dynamical Modeling with TerraME Tiago Carneiro Gilberto Câmara Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Spatial Dynamical Modeling with TerraME (part 2) Gilberto Câmara.
TIAGO GARCIA CARNEIRO ANA PAULA AGUIAR GILBERTO CÂMARA ANTÔNIO MIGUEL MONTEIRO TerraME - A tool for spatial dynamic modelling LUCC Workshop Amsterdam,
Designing and Performing Geographic Analysis Processes with GISCASE Cirano Iochpe, Guillermo N. Hess, Cláudio Ruschel, Alécio P. D. Binotto, Luciana V.
Computing with C# and the.NET Framework Chapter 1 An Introduction to Computing with C# ©2003, 2011 Art Gittleman.
Indiana GIS Conference, March 7-8, URBAN GROWTH MODELING USING MULTI-TEMPORAL IMAGES AND CELLULAR AUTOMATA – A CASE STUDY OF INDIANAPOLIS SHARAF.
Beyond OGC Standards: The New Challenges for Open Source GIS Gilberto Câmara Director General, National Institute for Space Research (INPE) Brazil OGRS.
Chapter 6: User-Defined Functions
PowerBuilder Online Courses - by Prasad Bodepudi
 2008 Pearson Education, Inc. All rights reserved JavaScript: Arrays.
Course material – G. Tempesti Course material will generally be available the day before the lecture Includes.
Cellular Automata Spatio-Temporal Information for Society Münster, 2014.
Cellular Automata Martijn van den Heuvel Models of Computation June 21st, 2011.
Model Iteration Iteration means to repeat a process and is sometimes referred to as looping. In ModelBuilder, you can use iteration to cause the entire.
Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
Geosimulation Geosimulation models are developed to represent phenomena that occur in urban systems in highly realistic manner In particular, Cellular.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
8 1 Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Efficient RDF Storage and Retrieval in Jena2 Written by: Kevin Wilkinson, Craig Sayers, Harumi Kuno, Dave Reynolds Presented by: Umer Fareed 파리드.
Developing a Framework for Modeling and Simulating Aedes aegypti and Dengue Fever Dynamics Tiago Lima (UFOP), Tiago Carneiro (UFOP), Raquel Lana (Fiocruz),
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
Introduction to Compilers. Related Area Programming languages Machine architecture Language theory Algorithms Data structures Operating systems Software.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Introduction to Interactive Media Interactive Media Tools: Authoring Applications.
Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally.
Introduction to Spatial Dynamical Modelling Gilberto Câmara Director, National Institute for Space Research.
Cellular Automata Martijn van den Heuvel Models of Computation June 21st, 2011.
Pedro R. Andrade Münster, 2013
Introduction to Enviromental Modelling Lecture 1 – Basic Concepts Gilberto Câmara Tiago Carneiro Ana Paula Aguiar Sérgio Costa Pedro Andrade Neto.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Towards Unifying Vector and Raster Data Models for Hybrid Spatial Regions Philip Dougherty.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Modelos Hidrologicos: Runoff Pedro Ribeiro de Andrade Gilberto Camara.
Spatial Analysis with Raster Datasets-1 Francisco Olivera, Ph.D., P.E. Srikanth Koka Department of Civil Engineering Texas A&M University.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
Spatial Dynamical Modeling with TerraME Tiago Carneiro Gilberto Câmara Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.
An Introduction to TerraME Pedro Ribeiro de Andrade São José dos Campos,
1 Sections 5.1 – 5.2 Digital Image Processing Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Lua for TerraME: A Short Introduction Pedro Ribeiro de Andrade Tiago G. S. Carneiro Gilberto Câmara Münster, 2014.
Modelagem Dinâmica com TerraME Aula 5 – Building simple models with TerraME Tiago Garcia de Senna Carneiro (UFOP) Gilberto Câmara (INPE)
Spatio-Temporal Information for Society Münster, 2014
Cellular Automata Pedro R. Andrade Tiago Garcia de Senna Carneiro
Pedro Ribeiro de Andrade Münster, 2013
Pedro R. Andrade Münster, 2013
Spatial Dynamical Modeling with TerraME
Implementing Chares in a High-Level Scripting Language
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Database System Concepts and Architecture.
Pedro R. Andrade Münster, 2013
Spatio-temporal information in society: cellular automata
Chapter 9 Introduction To Classes
Database SQL.
Spatial Analysis with Raster Datasets-1
Presentation transcript:

Modelagem Dinâmica com TerraME: Aula 3 Interface entre TerraME e LUA Gilberto Câmara (INPE) Tiago Garcia de Senna Carneiro (UFOP)

What is TerraME? TerraME is a development environment for spatial dynamical modelling Uses a spatial database for data storage and retrieval

Which Cellular Automata? For realistic geographical models  the basic CA principles too constrained to be useful Extending the basic CA paradigm  From binary (active/inactive) values to a set of inhomogeneous local states  From discrete to continuous values (30% cultivated land, 40% grassland and 30% forest)  Transition rules: diverse combinations  Neighborhood definitions from a stationary 8-cell to generalized neighbourhood  From system closure to external events to external output during transitions

Spatial dynamic modeling Locations change due to external forces Realistic representation of landscape Elements of dynamic models Geographical space is inhomogeneous Different types of models  discretization of space in cells  generalization of CA  discrete and continous processes  Flexible neighborhood definitions  Extensibility to include user- defined models DemandsRequirements

TerraLib TerraLib Enviromental Modeling Framework C++ Signal Processing librarys C++ Mathematical librarys C++ Statistical librarys TerraME Virtual Machine TerraME architecture & applications TerraME Compiler TerraME Language RondôniaModel DinamicaModel TROLLModelCLUEModel fonte: Carneiro (2006)

TerraME functionality fonte: Carneiro (2006)

TerraME Runtime Environment

Cell Spaces

2500 m2.500 m e 500 m Cellular Data Base Resolution

Computational Modelling with Cell Spaces Cell Spaces Components  Cell Spaces  Generalizes Proximity Matriz – GPM  Hybrid Automata model  Nested enviroment fonte: Carneiro (2006)

TerraME extensions to Lua To build spatial dynamic models, TerraME includes new value types in LUA using the constructor mechanism. These values are: CellularSpace, Cell, Neighbourhood

Cellular Space A CellularSpace is a multivalued set of Cells. It consists of a geographical area of interest, divided into a regular grid. Each cell in the grid has one or more attributes. CellularSpaces are stored and retrieved from a TerraLib database, so the modeller should specify the properties of the CellularSpace

Constructors in Lua LUA has a powerful syntactical tool, called constructor. When the modeller writes name{…}, the LUA interpreter replaces it by name({… }), passing the table {…} as a parameter to the function name( ). This function typically initializes, checks properties values and adds auxiliary data structure or methods.

Cellular Space Usa o construtor de LUA csCabecaDeBoi = CellularSpace { dbType = "MySQL", host = "localhost", database = "CabecaDeBoi ", user = "", password = "", layer = "cells90x90", theme = "cells", select = { "altitude", "infCap" } where = "mask <> ‘noData’"; }

Loading Data -- Loads the TerraLib cellular space csCabecaDeBoi = CellularSpace { dbType = "ADO", host = "amazonas", database = "c:\\cabecaDeBoi.mdb", user = "", password = "", layer = "cellsSerraDoLobo90x90", theme = "cells", select = { "altimetria", “soilWater", “infCap" } } csCabecaDeBoi:load(); csCabecaDeBoi:loadMooreNeighbourhood; GIS

Cell Spaces Cellular Space

Referencing cells A CellularSpace has a special attribute called cells. It is a one-dimensional table of references for each Cell in the CellularSpace -- c is the seventh cell in the cellular space c = csCabecaDeBoi.cells[ 7 ]; -- Updating the attribute “infcap” from the seventh cell c.infcap = 10; print (csCabecaDeBoi.cells[7].infCap);

Database management -- loads a cellular space csAmazonia:load(); csAmazonia:loadNeighbourhood("Moore"); … -- save (time, themeName, attrTableName) -- for time = 1, 10,1 do csAmazonia:save(time, “sim", {"water"}); end

The Cell type A Cell value has two special attributes: latency and past. The latency attribute registers the period of time since the last change in a cell attribute value. The past attribute is a copy of all cell attribute values in the instant of the last change. if(cell.cover == "abandoned" and cell.latency >= 10 ) then cell.cover = "secFor"; end cell.water = cell.past.water + 2;

Traversing a Cell Space "for...end" statement: "for i, cell in pairs (csQ.cells) do...end”. The i and cell variable in the statement are the index and the value of a cell inside the cells attribute from the cellular space csQ. for i, cell in pairs( csQ.cells ) do cell.water = cell.past.water + 2; end

Traversing a Cell Space ForEachCell(cs, function()) Applies the chosen function to each cell of the cellular space. This function enables using different rules in a cellular space. ForEachCell(csQ, function(cell) cell.Water = cell.past.Water + 2; return true; end);

Traversing a Cell Space for i, cell in pairs( csQ.cells ) do cell.water = cell.past.water + 2; end -- usar para um percorrimento genérico -- percorrer por um valor ordenado ForEachCell(csQ, function(cell) cell.Water = cell.past.Water + 2; return true; end); -- pode aplicar diferentes funções

Von Neumann Neighborhood Moore Neighborhood Isotropic neighbourhoods in cell spaces

Traversing a Neighbourhood csq:loadNeighbourhood(“Moore”); ForEachCell(csQ, function(cell) count = 0; ForEachNeighbour(cell, 0, function(cell, neigh) if (neigh.past.value == 1 and neigh ~= cell) then count = count + 1; end end; ); -- for each neighbor

Traversing a Neighbourhood csQ:loadNeighbourhood(“Moore”); for i, cell in pairs( csQ.cells ) do count = 0; ForEachNeighbour(cell, 0, function(cell, neigh) if (neigh.past.value == 1) then count = count + 1; end end; ); -- for each neighbor end

Synchronizing a cell space TerraME keeps two copies of a cellular space in memory: one stores the past values of the cell attributes, and another stores the current (present) values of the cell attributes. The model equations must read (the right side of the equation rules) the past copy, and must write (the left side of the equation rules) the values to the present copy of the cellular space. At the correct moment, it will be necessary to synchronize the two copies of the cellular space, copying the current attribute values to the past copy of the cellular space.

Synchronization Leia sempre do antigo (“past”); Escreva sempre no novo (“present”); …. csQ:syncronize();

for i, cell ipairs( csValeDoAnary ) do end count = 0 ; print(“Number of deforested cells: ”.. count); if ( cell.past.cover == “forest” ) then cell.cover = “deforested”; count = count + 1 ; end cell.synchronize( ); Syncronization tntn t n+1 rule ? fonte: Carneiro (2006)

References Carneiro, T., Nested-CA: a foundation for multiscale modeling of land use and land change., in PhD Thesis in Computer Science. National Institute of Space Research: São José dos Campos, Brazil. Carneiro, T.; Câmara, G., A Gentle Introduction to TerraME. INPE Report, Ierusalimschy, R Programming in Lua (2 nd edition). Rio de Janeiro, Lua.Org.