Defining an area in a grid

56 views
Skip to first unread message
Assigned to agri...@gmail.com by youce...@gmail.com

Charmane Lam

unread,
Jan 11, 2019, 2:30:47 AM1/11/19
to GAMA
Hello, I am a PhD student from Hong Kong. I'm new to ABM and the GAMA platform.

In my simulation, I would like to create an environment with residential area, bare land and coastal area. People living in the residential area will move to the coastal area.

I'm going to use a grid to represent such environment. However, I can't find information on defining the different areas in my grid. Appreciate if someone could recommend any tutorial / model that I could make reference to.

Thanks in advance!!

Arnaud Grignard

unread,
Jan 11, 2019, 8:12:50 AM1/11/19
to GAMA
Hi Charmane,

There are different exemple in the GAMA library using Grid 

You can have a look for instance in Libray Models/Feature/Grids or in this tutorial https://gama-platform.github.io/wiki/PredatorPrey

To predefine your grid an possibility is to define you grid in an .asc file (a simple text file or using a dedicated raster editor like QGIS) and then import the asc file in a grid like in this model
Data Importation/ASC File Import.gaml

Hope this helps

Arnaud

rot...@stud.sbg.ac.at

unread,
Jan 22, 2019, 2:27:01 PM1/22/19
to GAMA
Hi,

I'm using raster grid (converted to .asc as Arnaud already informed), for simulation of forest growth.

I assigned to different grid value (raster bands) land cover types (string).
have a look at pieces of code. You can assign as well for residential area, bare land and coastal area etc.

global {
init {
ask landcover {
// assign bands to different land cover types e.g. band 0 = extensively used

lc_type <- grid_value = 0 ? "extensively_used" : (grid_value = 1 ? "bed_rock" : (grid_value = 2 ? "bushes" : (grid_value = 3 ? "forest" : "meadows")));

// assign color to different bands

color <- grid_value = 0 ? #lawngreen : (grid_value = 1 ? #darkgrey : (grid_value = 2 ? #FFCC33 : (grid_value = 3 ? #darkgreen : #66CC66)));
}
}
}

then in the grid species landcover I created conditions, with probability of germination.


grid landcover file: lulc_54 neighbors: 8 {


string lc_type;
float prob_germ;
float z_max <- 1930.0;
float cell_height;


init {

ask landcover {

}

// probability of seed germination depends on landcover type (grid_value).

if (grid_value = 0.0 and cell_height <= z_max) {
prob_germ <- 0.02;
} else if
(grid_value = 1.0) {
prob_germ <- 0.1;
} else if
(grid_value = 2.0) {
prob_germ <- 0.34;
} else if
(grid_value = 3.0) {
prob_germ <- 1.0;
} else
{
prob_germ <- 0.32;
}
}

}

Note: hope is useful!
Reply all
Reply to author
Forward
0 new messages