PyBet Tools User Guide

1. Introduction

BET models are a set of probabilistic tools aiming to provide probabilistic estimation of volcanic unrest, eruption and of any hazardous phenomena relating with the volcanic activity. The background theory of these models is based on the definition of ad-hoc Bayesian event trees, where each node is treated through a Bayesian inference approach. Details on the BET models can be found in literature (among others see Marzocchi et al., 2004; Marzocchi et al., 2008, Marzocchi et al., 2010) and are out of the scope of this document.

Here we present some of the current software implementations of these models, with the specific goal of providing a user-friendly interface to the final users. The softwares have been developed by using the Python programming language, since the broad compatibility of Python allows to install them on all the most common operating systems (Linux, Mac OSX, Windows) and also on the VHub cyber-infrastructure, where they can be freely run online or downloaded. In the next sub sections they are briefly introduced.

1.1 PyBetVH

PyBetVH is a completely new, free, open-source and cross-platform software implementation of the Bayesian Event Tree for Volcanic Hazard (BET_VH). The purpose of the tool is to provide a graphical support to BET_VH model, which estimates the long-term probability of any magmatic hazardous phenomenon (i.e., lava flows, tephra fall, pyroclastic flows, lahars, etc.) occurring in a selected time frame, accounting for all the uncertainties. The BET_VH model represents a flexible tool to provide probabilities of any specific event at which we are interested in, by merging all the available information, such as theoretical models, a priori beliefs, and past data. It is mainly based on the Bayesian inference and it deals with long-term forecasting only, therefore it can be useful in land use planning. More details can be found in Marzocchi et al. (2010) and it has been used in several applications (Selva et al., 2010; Sandri et al., 2012; Sandri et al., 2014; Thompson et al., 2015; Tonini et al., 2015)

PyBetVH calculates hazard curves which describe the distribution of the exceedance probability as a function of intensity (e.g., tephra load) on a grid of points covering the target area. The computed hazard curves are (i) absolute (accounting for the probability of eruption in a given time frame, and for all the possible vent locations and eruptive sizes) and (ii) Bayesian (computed at different percentiles, in order to quantify the epistemic uncertainty). Such curves allow representation of the full information contained in the probabilistic volcanic hazard assessment (PVHA) and are well suited to become a main input to quantitative risk analyses. PyBetVH allows for interactive visualization of both the computed hazard curves, and the corresponding Bayesian hazard/probability maps. PyBetVH is designed to minimize the efforts of end users, making PVHA results accessible to people who may be less experienced in probabilistic methodologies, e.g. decision makers.

More details on PyBetVH tool and can be found in Tonini et al. (2015), where the use of the tool is illustrated through the example of PVHA for tephra fallout from the Okataina Volcanic Centre (OVC), New Zealand, by highlight the range of outputs that the tool can generate.

1.2 PyBetEF

PyBetEF is an open and cross-platform implementation of BET_EF (Bayesian Event Tree for Eruption Forecasting) equipped with a Graphical User Interface. BET_EF model aims to provide probabilities of unrest/eruption forecasting of magmatic events, by merging all the relevant available information such as theoretical models, a priori beliefs, monitoring measures, and any kind of past data. BET_EF is based on a Bayesian procedure and it relies on the fuzzy approach to manage monitoring data. The method deals with short- and long-term forecasting; therefore, it can be useful in many practical aspects such as land use planning and volcanic emergencies (Marzocchi et al., 2008).

1.3 PyBetUnrest

PyBetUnrest is an open and cross-platform implementation of BET_UNREST model. BET_UNREST is an extension of BET_EF including non-magmatic volcanic unrest and its relating hazardous phenomena, by adding a specific branch to the event tree (Rouwet et al., 2014).

The tool is currently under final testing for VHub and relating publications are in preparation/under review



Disclaimer

Even though any volcanic system could theoretically be analysed with a BET tool, the critical role played by hazard assessments in civil protection issues prevents us from leaving the user free to use all the applications already available. Therefore, BET tools are provided “empty” and the user must provide by himself/herself all of the information of the volcano he/she is interested in.

The use of BET tools makes the user fully responsible of its input data, results and relative applications. By using or downloading one of the BET tools, the user accepts that INGV and authors are not responsible for any wrong application by the user who takes his/her own responsibility.




2. Local Installation Requirements

All PyBet tools require Python and some Python third party modules/libraries which need to be installed in order to be able to run the tools. The first step is to check if the Python interpreter is installed. By typing “python” in a terminal window followed by the Enter key, the prompt should give a similar response:

rob@robelix:~$ python
Python 2.7.3 (default, Apr 20 2012, 22:39:59) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

The required additional modules/libraries are:

  1. wxPython (graphical user interface library)
  2. Numpy (scientific computing library)
  3. Matplotlib (2D plotting library)
  4. Pillow (a fork of the former Python Image library)

All of them are open source and freely available and usable for all the most common operating systems (Linux, Mac OSX and Windows). Depending on the operating system and on the experience of the user in using its machine and/or Python, the procedure to install these libraries can be approached in different ways.

2.1 Linux systems

In the majority of Linux distributions, Python libraries can be easily installed by means of their own package managers, which install, update, remove softwares in the system in a consistent manner, by checking for all the required dependencies and shared libraries. For Debian-like distributions, you can use the synaptic tool or simply the following command from the terminal:

sudo apt-get install python-numpy python-matplotlib python-wxgtk3.0 python-pil  

The procedure for other distributions is very similar.

2.2 Mac OSX/Windows

Since both these operating systems do not have a native package manager to handle libraries and softwares in a smart way as Linux distribution, so the installation of Python libraries could not be so straightforward. One can download and install the single libraries from the respective web sites, being very careful to the Python Standard Library version installed on his/her own computer as reference to choose the correct files. Moreover, Mac OSX users can try to use MacPorts (https://www.macports.org/) or Homebrew (http://brew.sh/), depending on their own expertise in using these tools, which should play as package managers similarly to the ones available for Linux systems. Alternatively, as easiest way, one can install the Enthought Canopy free version https://store.enthought.com. Canopy is a very rich Python package distribution, which will install a scientific Python environment in your system. It is less flexible, but more solid and it takes care of all the libraries compatibility. Once you have installed Canopy (as any other software in your own operating system), one should set the Canopy Python environment as the default Python. Official instruction can be found for Windows and Mac OSX.

Note for Mac OSX users: if the above procedure does not set the Python Canopy environment as your default Python, you can manually set your .bash_profile as follows:

export PATH=/Users/$YOURUSERNAME/Library/Enthought/Canopy_64bit/User/bin:$PATH

When Canopy is set as your default Python environment, you should get something similar by running the python command from your terminal:

macosx@macuser:~$ python
Enthought Canopy Python 2.7.9 | 64-bit | (default, Jun 30 2015, 19:41:21) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.6)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>



2.3 Requirements verification

Independently on the operating system you are using and on the method used to install these Python libraries, their correct installation can be verified by entering in the Python interactive shell and manually importing the libraries:

rob@robelix:~$ python
Python 2.7.3 (default, Apr 20 2012, 22:39:59) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import matplotlib
>>> import wx
>>> from PIL import Image

If the previous requirements are satisfied, you can proceed with the installation of the tool(s) on your system.




3. Running the tools

3.1 PyBetVH

Download the source code from the PyBetVH main page on the VHub web site (Download does not require to be registered users). Under the launch tool button on the right, by clicking on download, it will be asked to save a compressed file (betvh-rxxx.tar.gz). The archive must be placed in a folder where the user has full permissions (reading, writing and executing) on files. This will be the installation folder of PyBetVH and should not be moved anymore. After having extracted the files from the tar.gz file, the following folder tree structure should appear:

rob@robelix:downloads$ ls -hot betvh-rxxx
total 68K
drwxr-xr-x 2 rob 4.0K Jan  8 22:04 bin
drwxr-xr-x 2 rob 4.0K Jan  8 22:02 src
drwxr-xr-x 2 rob 4.0K Nov  9 19:01 data
drwxr-xr-x 3 rob 4.0K Nov  9 19:01 doc
drwxr-xr-x 3 rob 4.0K Nov  9 19:01 examples
drwxr-xr-x 2 rob 4.0K Nov  9 19:01 middleware
drwxr-xr-x 2 rob 4.0K Nov  9 19:01 rappture
-rw-r--r-- 1 rob  723 Nov  9 19:01 LICENSE.txt
-rw-r--r-- 1 rob  35K Nov  8 16:56 COPYING

This is the structure required by VHub repository. After having opened a terminal window and moved into src/ folder, it must be executed the following command:

rob@robelix:betvh-rxxx$ make install all

The command above installs all the executable files in the bin/ directory.

Depending on your operating system, you can now set a link, named for example “PyBetVH“, to the main executable, which is in /yourpath/bin/betvh.py. Finally, if all the operations above have been successfully concluded, the tool can be launched by simply doing, from any position in your file system, in the terminal window:

rob@robelix:~$ PyBetVH

or whatever name you decided to give to the executable.



3.2 PyBetEF

PyBetEF is still not install on VHub. You can download it from here. Uncompress the .zip file and place the whole folder where you prefer. The folder contains the PyBetEF main program and all the modules needed to be properly executed. The user should not modify, remove or do any change to this folder, since the risk is to compromise the functionality of the tool. The tool is ready to be launched for a first trial. Open a terminal and move inside the folder containing the PyBetEF source files:

rob@robelix:~$ cd /your/path/to/PyBetEF/folder/

then launch the tool:

rob@robelix:~$ python PyBetEF.py

There are several ways to make this operation faster. In Linux and Mac OSX systems, as illustrative example, one can make the PyBetEF.py main program file executable and then create a (symbolic) link to it in a folder belonging to its PATH environment variable:

rob@robelix:~$ chmod u+x /your/path/to/PyBetEF/folder/PyBetEF.py  
rob@robelix:~$ ln -s /your/path/to/PyBetEF/folder/PyBetEF.py $HOME/bin/pybetef

In this way one should be able to run the tool from any place of her/his filesystem by opening a terminal and simply doing:

rob@robelix:~$ pybetef  

In Windows one can create a link (i.e., on the Desktop) by clicking with the mouse’s right button ans selecting create a link. Then double click on the link should directly launch the tool.

3.3 PyBetUnrest

STILL IN PREPARATION



References

  1. Marzocchi W., L. Sandri, P. Gasparini, C. Newhall, E. Boschi, 2004. Quantifying probabilities of volcanic events: the example of volcanic hazard at Mt. Vesuvius. J. Geophys. Res., 109, B11201, doi:10.1029/2004JB003155.
  2. Marzocchi,W., Sandri, L., Selva J., BET_EF: a probabilistic tool for long- and short-term eruption forecasting , Bull. Volcanol., 70, 623-632, doi:10.1007/s00445-007-0157-y, 2008
  3. Marzocchi, W., L. Sandri, Selva, J., 2010, BET_VH: a probabilistic tool for long-term volcanic hazard assessment, Bulletin of Volcanology, Volume 72, Number 6, 705-716, doi: 10.1007/s00445-010-0357-8
  4. Rouwet, D., Sandri, L., Marzocchi, W., Gottsmann, J., Selva, J., Tonini, R., Papale, P., 2014. Recognizing and tracking volcanic hazards related to non-magmatic unrest: a review. J. Appl. Volcanol. 3, 17. http://dx.doi.org/10.1186/s13617-014-0017-3.
  5. Sandri, L., Jolly, G., Lindsay, J., Howe, T., Marzocchi, W., 2012. Combining long- and short-term probabilistic volcanic hazard assessment with cost-benefit analysis to support decision making in a volcanic crisis from the Auckland Volcanic Field, New Zealand. Bull. Volcanol. 74, 705–723. http://dx.doi.org/10.1007/s00445-011-0556-y.
  6. Sandri, L., Thouret, J.C., Constantinescu, R., Biass, S., Tonini, R., 2014. Long-term multi-hazard assessment for El Misti volcano (Peru). Bull. Volcanol. 76 (2), 1–26. doi: 10.1007/s00445-013-0771-9.
  7. Selva, J., Costa A., Marzocchi, W., L. Sandri, 2010, BET_VH: exploring the influence of natural uncertainties on long-term hazard from tephra fallout at Campi Flegrei (Italy), Bulletin of Volcanology, Volume 72, Number 6, 717-733, DOI: 10.1007/s00445-010-0358-7
  8. Thompson M.A., Lindsay J.M., Sandri L., Biass S., Bonadonna C., Jolly G., Marzocchi W. 2015. Exploring the influence of vent location and eruption style on tephra fall hazard from Okataina Volcanic Centre, New Zealand, Bulletin of Volcanology, 77(5), doi: 10.1007/s00445-015-0926-y
  9. Tonini, R., Sandri, L., Costa, A., Selva, J., 2015. Brief communication: the effect of submerged vents on probabilistic hazard assessment for tephra fallout. Nat. Hazards Earth Syst. Sci. 15, 409–415. http://dx.doi.org/10.5194/nhess-15-409-

2015.

Created on , Last modified on