ViroCon: A software to compute multivariate extremes using the environmental contour method

The environmental contour method is used by researchers and practitioners to define multivariate extremes of environmental conditions. These extreme conditions are then used to design or analyze marine structures. Here, we present a software called ViroCon


Motivation and significance
The environmental contour method is a method to define multivariate extremes based on a joint probabilistic description of variables like significant wave height and wind speed.The method's roots can be traced back to the publications by Haver [1,2] and Winterstein et al. [3].Now, the environmental contour method is widely used to define extreme environmental loads for marine structures like offshore wind turbines, vessels and wave energy converters.In the last 10 years various definitions for the method's exceedance region have been proposed and consequently the environmental contour method can be interpreted as the title of a family of different specific environmental contour methods.These specific methods are for example the inverse first-order reliability method (IFORM) [3], the inverse second-order reliability method (ISORM) [4], the hyperplanes-based contour method by Huseby et al. [5] and the highest density contour method (HDC method) [6].Environmental contour methods are widely used both in engineering practice and in academic research.
Academic researchers often use the environmental contour method when they analyze structures.In the last two decades, wind turbine design and its structural analysis became a big research area and various authors used the environmental contour method in their work [8][9][10][11][12].Similarly, researchers working on the structural analysis of vessels [13], wave energy converters Fig. 1.ViroCon's software architecture visualized with the unified modeling language (UML [7]).For simplicity only the most important packages and classes are shown.[14,15], floating structures for oil and gas production [16][17][18] and bridges [19,20] have used the method.The environmental contour method is a well-accepted method to define extreme environmental loads and is recommended in various engineering guidelines and standards [21][22][23].Consequently, it has potential applications whenever a research project demands a rational way of defining such loads.
In many research projects the environmental contour method is needed as a prerequisite, but is not the core of the research.Nevertheless, researchers need to first translate the statistical concepts of the environmental contour method into machine-readable steps and then write the software.Currently, to the authors knowledge, there exists no publicly available software package that supports multiple environmental contour methods.The authors are aware of two open-source implementations of the environmental contour method: (i) a Python implementation of the inverse firstorder reliability method in the WEC Design Response Toolbox [24] and (ii) a Matlab implementation of the highest density contour method [25].In addition, the authors are aware of two closedsource implementations: (iii) ''Proban'' offers the inverse firstorder reliability method [26] and (iv) ''Riscue'', which is free for noncommercial purposes, offers the hyper-planes based contour method [5,27].All these implementations are focused on a single specific environmental contour method (when the methods are classified based on the definition for the exceedance region).Here, we present the software ''ViroCon'' (from environmental contour), which allows users to work with multiple environmental contour methods, either with an importable Python package or with an easy-to-use browser-based graphical user interface.

Software description
ViroCon is written in Python 3.6.It is separated into two main software packages, one called viroconcom, which implements the statistical computation procedures, and one called viroconweb, which provides an easy-to-use browser-based graphical user interface.

Software architecture
The package viroconcom performs the statistical computations, while the package viroconweb, which is a Django web application [28], imports viroconcom to access its statistical methods (Fig. 1).The package viroconcom contains the main classes Fit, MultivariateDistribution, IFormContour, ISormContour and HighestDensityContour.These classes hold the package's main data objects, which store information about how a distribution has been fitted to measurement data (Fit), information about a multivariate distribution (MultivariateDistribution) and information about a computed environmental contour (IFormContour, ISormContour and HighestDensityContour).The package viroconweb holds three main packages: info for presenting static web sites, user for handling users of the web-application and contour for everything related to the computing of an environmental contour.

Software functionalities
While viroconcom can be used by software developers in various ways, we designed the user interface of viroconweb around two work flows.The main work flow of a user is to start by uploading a csv-file, which contains measurement data (Fig. 2).These measurement data are first stored and then used to fit a probabilistic model to it.This model is also stored and can be used as the input to compute an environmental contour.If the user computes an environmental contour the resulting contour is first saved and then presented to the user.Then, users can either download a report describing the contour or download a csv-file, which holds the contour's coordinates.The alternative work flow is to define a probabilistic model directly (instead of fitting it to measurement data).Then this probabilistic model can be used as an input to compute an environmental contour.
ViroCon offers the conditional modeling approach (CMA) [30] to define multivariate distributions.A multivariate distribution can be built up by using normal, log-normal and Weibull distributions for individual variables and by modeling the dependence structure between the variables with dependence functions.Available dependence functions are a 3-parameter exponential function, f (x) = c 0 + c 1 exp (xc 2 ), and a 3-parameter power function, f (x) = c 0 + c 1 x c 2 .These model elements allow users to construct a wide range of models, among them the bivariate model of significant wave height and spectral peak period and the bivariate model of significant wave height and wind speed that are currently recommended in DNVGL's authorative recommended practice DNV-RP-C205 [22].
viroconcom's methods are implemented for n dimensions, viroconweb's visualization, however, is restricted to four dimensions.Fitting a model to measurement data is based on maximum likelihood estimation.The current version offers users to compute environmental contours based on the inverse first-order reliability method, the inverse second-order reliability method and the highest density contour method (Table 1).In viroconweb's graphical user interface, however, only IFORM contours and highest density contours are available.

Software evaluation
The implemented environmental contour methods were evaluated by calculating similar environmental contours as those presented in Vanem and Bitner-Gregersen [31], Haselsteiner et al. [6]

package IFORM [3] ISORM [4]
HDC method [6] viroconcom and Chai and Leira [4].These contours are based on a probabilistic model of the variables significant wave height (H s ) and zeroupcrossing period (T z ).The model's parameters were set by fitting it to a data set of sea states with a duration of 6 h.For evaluation, we computed environmental contours with return periods of 25 and 50 years.Consequently, the exceedance probabilities were α = 1/(25 × 365.25 × 24/6) ≈ 2.74 × 10 −5 and α = 1/(50 × 365.25 × 24/6) ≈ 1.37 × 10 −5 .We report the maximum values for significant wave height and zero-upcrossing period along the contour (Table 2).These two values do not represent a single sea state because the maximum value of H s occurs at a different sea state than the maximum value of T z .
The values calculated with viroconcom compare well with the results from Vanem and Bitner-Gregersen [31], Haselsteiner et al. [6] and Chai and Leira [4] (Table 2).In summary, in each case that we found exact values in the literature (5 of 10, Table 2), the deviation between the results from the literature and from viroconcom was much less than 1%.

Computing a contour by importing viroconcom
The package viroconcom is designed as an importable Python package that users can import to access its methods.Listing 1 gives an example how a user can import the Fit and IFormContour classes to first fit a distribution to some sample data and then compute an environmental contour.Users can visualize a computed fit (Fig. 3) and an environmental contour (Fig. 4), for example with the popular package matplotlib [32].

Computing a contour with viroconweb's graphical user interface
The package viroconweb is designed to offer an easy-to-use graphical user interface to fit a probabilistic model to measurement data and then to compute an environmental contour.We implemented views that show the users overviews of all their measurement data, probabilistic models and environmental contours.
In the view that gives an overview about the probabilistic models, the user can click on the respective symbol to calculate an IFORM contour or a highest density contour (Fig. 5).If users click on one of these symbols they are presented a view in which they must enter the settings for the environmental contour, for example the return period or the duration of the environmental state.After confirming the settings, users will be presented a view that shows the computed environmental contour and which provides the possibility to download a report and to download the extreme environmental design conditions (the contour's coordinates; Fig. 6).

Impact
Because the environmental contour method is a widely used method to define extreme environmental loads, a well-designed implementation of these methods could generate broad impact.The method is recommended in authoritative engineering guidelines and standards by organizations like the international electrotechnical commission [21] and DNVGL [22,23].It is used in the design and analysis of offshore wind turbines [8][9][10][11][12], vessels [13], wave energy converters [14,15], floating structures for oil and gas  production [16][17][18] and bridges [19,20].Consequently, both, academic researchers and practitioners working on marine structures are potential users of the software.
ViroCon can help researchers, who pursue research questions concerning the design and analysis of marine structures.Using the package viroconweb, researchers can start with a measurement file and end up with a set of extreme environmental design conditions in an easy, quick and reproducible manner.That way researchers can define design conditions much quicker and more reliable than if they would implement the fitting and contour methods themselves.In addition, researchers can easily reproduce the design conditions that peers have used in their research if both use the standard methods that are implemented in ViroCon.That way studies on marine structures under extreme environmental loads can gain reproducibility and comparability.
Another field of research that we expect ViroCon to impact are studies that compare different environmental contour methods or explore the properties of an environmental contour method.Such studies are for example the publications by Leira [33], Huseby et al. [5], Jonathan et al. [34], Vanem [35][36][37], Eckert-Gallup and Martin [38], Haselsteiner et al. [6,39], Chai and Leira [4], Gramstad et al. [40] and Wang et al. [18].ViroCon can be used as an accepted implementation of important methods and can be extended to include more methods for fitting distributions and computing environmental contours.

Conclusions
Here, we presented a software called ViroCon, which implements methods to fit a multivariate distribution to measurement data and methods to compute an environmental contour based on that distribution.Environmental contours are a rational way to define multivariate extreme values corresponding to a given return period.We structured ViroCon to have two main software packages, viroconcom for the statistical computations, and viroconweb for an easy-to-use graphical user interface.Because a wide range of research questions about the design and analysis of marine structures needs rationally defined extreme values of environmental conditions, we expect that ViroCon will be used by many researchers.

Fig. 2 .
Fig. 2. viroconweb's software functionality visualized as a flowchart, which shows the main steps to compute an environmental contour.Users can either start by uploading measurement data (start 1) or by defining a probabilistic model directly (start 2).

Fig. 3 .
Fig. 3. Left: A Weibull distribution fitted to a sample with viroconcom's class Fit, which uses maximum likelihood estimation.Right: Evaluation of the quality of the model fit with a quantile-quantile plot generated by calling scipy's [29] function stats.probplot.

Fig. 5 .
Fig.5.Overview about all probabilistic models that the user 'max_mustermann' has access to.This screen, generated by the viroconweb package, provides the user the possibility to share probabilistic models with other users ('Share'), inspect them ('Show'), compute an IFORM contour ('IFORM'), compute a highest density contour ('HDC') or delete the model ('Delete').

Fig. 6 .
Fig. 6. viroconweb's output of an environmental contour.The user 'max_mustermann' sees the environmental contour that he computed.All information about the contour and about the probabilistic model that was used to calculate the contour is summarized in a report.The user can download this report or download the extreme environmental design conditions (the contour's coordinates) as an ASCII file.

Table 2
Evaluation of the implemented environmental contour methods.The maximum values along computed and published environmental contours are compared.α= exceedance probability, IFORM = inverse first-order reliability method, ISORM = inverse second-order reliability method, HDC = highest density contour.αCan be reproduced by running viroconcom's file examples/compare_ contour_methods.py.
a b Estimated from a published figure.