Manipulation and modelling of heterogeneous data is important in several environmental modelling questions. The current research project concentrates on the integration of field-based and agent-based modelling.
The objective is to develop a generic data model and language for field-based and agent-based modeling required for storage and modelling of heterogeneous spatio-temporal systems. Below we briefly describe the data model and the modelling language.
Generic Data Model
A first result of the project is a data model in which both field-based and agent-based phenomena can be represented, as well as relations and networks.
The generic conceptual data model allows us to think about agents, fields and networks using a common set of concepts and terminology.
The conceptual data model functions as a data type for a modelling language for fields and agents. The modelling language is a Domain Specific Language, in which we use ideas from map algebra to design operations that are intuitive to environmental modellers. This language allows domain specialist, who are not software engineers, to construct models using an intuitive and easy-to-use language.
The data model and language are applied to real world cases.
Prototype and example model
This section describes a software data model prototype and an example model related to our manuscript ‘A data model supporting field- and agent-based modelling’, Environmental Modelling & Software (in review). For question or problems about using the software, please contact Merijn de Bakker. This prototype is part of a larger ongoing software project to integrate field-based and agent-based modelling: LUE
The prototype data model and case study model are intended to show the use of the data model in a modelling context and implementation. The case study concerns biomass growth with diffusion and grazing using sample data. The software can be found at our Github site: prototype software. Below we describe how the software is used.
View an animation of 500 time steps here
In the prototype package the code and data are organized in the following folders:
- data Contains sample data. After initialization, two sample HDF5 files (grass.hdf5 and cows.hdf5) are written to this folder. Model plots are also written to this folder
- mapalgebra Contains the core modules that are necessary for running the model, e.g. mapalgebra operations and utilities to read and write from and to the HDF5 files.
- models Contains the casestudy model.
2. Downloading and setting up the software
Download the prototype package and unpack it to a relevant location:
The prototype requires the following software to be installed:
- python 2.7
- h5py 2.6.0 or higher
- numpy 1.10.4 or higher
- matplotlib 1.5.1 or higher
To conveniently view the HDF5 files, HDF5view can be obtained:
Additional information for setting up the prototype on Linux and Windows
Install all the mentioned packages. On Debian based systems do
sudo apt update && sudo apt install python2.7 python-numpy python-matplotlib python-h5py hdf5-tools hdfview
Install the required software. It is also possible to download and install WinPython, which contains all the modules that are necessary to run the prototype and case study.
We have tested the prototype with WinPython 220.127.116.11:
3. Running the case study model
If you just installed Python, make sure all required packages are installed and the paths are set correctly.
On Windows start a command prompt (if using WinPython you could use the WinPython Command Prompt). On Linux start a terminal.
Go to the directory where the prototype package is located. In the prototype go the directory models.
python grazing_casestudy.py <number of timesteps>
So, you can specify the number of timesteps. If this argument is omitted, the number of timesteps is 50.
If the model has been executed, the output to the CMD or terminal will be:
nr_of_timesteps is <the number of specified time steps> model run started model run finished model finalized
In the folder \data the HDF5 files cows.hdf5 and grass.hdf5 and images (one for each timestep) are located. Different from the initial data, the HDF5 files now contain the data for each timestep and the properties that were created during the model run.