Installing Diva on web on your server


Jump to: navigation, search

The software Diva on web/OceanBrowser is composed by a client and server part. The server essentially supports the standardized requests for listing all available layers and format and projection in which they are available, provides a rendered picture of the required layer, and provides additional information of a given location (often the value of the field). The server is built entirely upon open source software. It is written in python using Matplotlib and basemap for graphical output. It is embedded in Apache and runs on a dedicated Linux server (two Intel Xeon E5420 quad-cores) at the University of Liege. The client part runs in a web browser and uses the JavaScript library OpenLayers to display the layers from the server. A simplified version of OceanBrowser is also used in Diva-on-web, an on-line tool to create interpolated fields from in situ ocean data.


Before you start

You should have a Linux web-server with about 8 GB of RAM (or more). All this steps are automated if you use divaonweb/OceanBrowser with Docker.


The source code is available at:


in addition those packages are recommended

8 - 16 GB of RAM are recommended. Specific instructions for Ubuntu.


In the following we assume that the package is installed in $HOME/Python/packages. This directory must be included in the environment variable PYTHONPATH. If your shell is bash, you can include the following to your file .bashrc

mkdir -p $HOME/Python/packages/
export PYTHONPATH=$PYTHONPATH:$HOME/Python/packages

You can install the package with the command easy_install. If you downloaded a package:

export PYTHONPATH=$PYTHONPATH:$HOME/Python/packages
easy_install --install-dir ~/Python/packages/ divaonweb-x.y.z.tar.gz

Or for the SVN check-out

easy_install --install-dir ~/Python/packages/ divaonweb


To create a new instance of the server called here (my-server), issue the following command:

paster create -t divaonweb_server my-server

Where 'my-server' is the name of the new instance. You may want adjust the file my-server/server.ini.


To launch the server:

paster serve ./my-server/server.ini

You can access the interface at http://localhost:8080. To make public set host:

use = egg:Paste#http
# Change to to make public
#host =
host =


You can also run diva-on-web and OceanBrowser behind an Apache web server. You may need to adapt the file apache/divaonweb.wsgi.

In apache's configuration file (/etc/apache2/sites-enabled/000-default.conf in ubuntu) you need to define WSGIScriptAlias inside the VirtualHost tags:

WSGIScriptAlias /mount-point /path/to/apache/divaonweb.wsgi

For example:

<Directory /home/abarth/workspace/seadatanet-server/apache>
   Require all granted

WSGIDaemonProcess processes=8 threads=15
WSGIScriptAlias /web-vis /home/abarth/workspace/seadatanet-server/apache/divaonweb.wsgi
WSGIApplicationGroup %{GLOBAL}


mkdir /var/www/.python-eggs
chown -R  www-data.www-data /var/www/.python-eggs
touch /home/divaonweb/workspace/seadatanet-server/divaonweb.log
chown -R  www-data.www-data /home/divaonweb/workspace/seadatanet-server/divaonweb.log /home/divaonweb/workspace/seadatanet-server/tmp
mkdir /home/divaonweb/workspace/seadatanet-server/tmp/P011
chown www-data.www-data /home/divaonweb/workspace/seadatanet-server/tmp/P011
sudo chmod +rx /var/www/data

wms_url in server.ini must then be:

wms_url = http://<IP address or server name>/mount-point/Python/web/wms?


Warnings like:

/usr/lib/pymodules/python2.6/matplotlib/ UserWarning:  This call to matplotlib.use() has no effect
because the the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

can be safely ignored.

Web-interface for make a diva analysis on-line

Some additional steps are required to used the web-interface for making diva analysis on-line:

File permission

sudo chown -R www-data.www-data /var/www
sudo chmod -R g+w /var/www
sudo adduser $USER www-data
# logout and login

# not really necessary, but otherwise octave complains
touch /var/www/.octave_hist
sudo chown  www-data.www-data /var/www/.octave_hist


Downloading and installing Diva

svn co svn+ssh:// diva
cd diva
svn up -r '{2009-01-08}'
mkdir bin
cd src/Fortran

adapt divacompile

cd ../..
mkdir -p /var/www/web-vis/Diva/
cp -R bin divastripped /var/www/web-vis/Diva/
cd /var/www/web-vis/Diva/
mkdir divastripped_template
cd divastripped_template/
ln -s ../divastripped/* .
rm divawork gnuwork input meshgenwork output
mkdir -p divawork gnuwork input meshgenwork output/{ghertonetcdf,meshvisu}
cd ..
chown -R www-data.www-data /var/www/web-vis/Diva


  • The following request should produce the land-sea mask of the Earth:,-90,180,90&WIDTH=512&HEIGHT=256

(replace the hostname and the WSGI monting point)


This test is indepented from your NetCDF files.

Versions to avoid

  • matplotlib 1.1.1rc: creates a spurious transparent 1 pixel around every tile (works in matplotlib 1.2.1)


Besides all software listed in Requirements, "Diva on web" uses the great Javascript library Openlayers.

Personal tools