Installing Diva on web on your server
From GHER
Contents |
Requirements
- apache web-server
- mod_wsgi
- scipy
- matplotlib
- basemap
- octave
- NetCDF
- OPeNDAP
- octcdf (octave's NetCDF and OPeNDAP interface)
- netcdf4-python
- Diva
- python-egenix-mxdatetime , python-lxml , python-cheetah
- python-pastedeploy
in addition those packages are recommended
Installation
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
export PYTHONPATH=$PYTHONPATH:$HOME/Python/packages
You can install the package with the command easy_install. If you downloaded a 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
Deployment
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.
Stand-alone
To launch the server:
paster serve ./my-server/server.ini
You can access the interface at http://localhost:8080
Apache
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 you need to define WSGIScriptAlias:
WSGIScriptAlias /mount-point /path/to/apache/divaonweb.wsgi
wms_url in server.ini must then be:
wms_url = http://<IP address or server name>/mount-point/Python/web/wms?
Caveats
Warnings like:
/usr/lib/pymodules/python2.6/matplotlib/__init__.py:835: 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
Diva
Downloading and installing Diva
svn co svn+ssh://modb.oce.ulg.ac.be/home/svn/repos/diva/trunk diva
cd diva
svn up -r '{2009-01-08}'
mkdir bin
cd src/Fortran
adapt divacompile
./divacompile
cd ../..
mkdir /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 ..
sudo chown -R www-data.www-data divastripped_template
Troubleshooting
- The following request should produce the land-sea mask of the Earth:
http://gher-diva.phys.ulg.ac.be/web-vis/Python/web/continents?LAYERS=cont&FORMAT=image%2Fpng&EXCEPTIONS=application%2Fvnd.ogc.se_xml&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=-180,-90,180,90&WIDTH=512&HEIGHT=256
(replace the hostname and the WSGI monting point)
This test is indepented from your NetCDF files.
Credits
Besides all software listed in Requirements, "Diva on web" uses the great Javascript library Openlayers.
