The wvrserve program

The program wvrretrieve which can be used to retrieve atmospheric water vapour and optionally estimate excess continuum at 183 GHz is quite computationally intensive. At the same time, too high a loading of the ALMA control computers should be avoided as the may not handle these gracefully.

For this reason I implemented a very simple server/client arrangement so that the control computers can call the wvrretrieve program on another computer (obvious candidate being osf-red) fetch the results from there. This arrangement is used in the new, experimental on-line plotter for pwv and cloud estimate.

This arrangement is described here if:

  1. People are interested in how it works/doing something similar some time in some other project
  2. To help with running the experimental plotter


The arrangement consist of (obviously) two parts.

One one machine is the server, this is where the heavy computation is done and CPU load is not too high a concern. In our case this machine is osf-red. Since the computation is done on this machine, this is where the wvrretrieve program must be installed, which it indeed it is.

On the server machine the script is run. This creates the server and listens for requests for pwv computation on port 8000.

On the client side, one simply connects to port 8000 of osf-red and asks for a computation given WVR readings; the result is then returned.


The implementation uses the XMLRPC protocol as implemented in the Python SimpleXMLRPCServer module.

This module makes it extremely to make any function available over the XMLRPC protocol. In this case we make only one function available, named wvrretrieve. This Python function in turn calls the stand-alone executable of the same name by using the subprocess module.


The use of the client is described elsewhere. To use the server, it needs just to be started, with the path adjusted so that it can see the wvrretrieve executable.

On osf-red, an example invocation is:

PATH=/users/bnikolic/p/wvr-0-16-b2/bin/:$PATH python

Note that for full functionality version of 0.16 of wvr software should be used (in this case we are using 0.16-beta-2 version).

Full listing of

This is the full listing:

# Bojan Nikolic <>
# This file is part of LibAIR
A very simple wrapper that turns the wvrretrieve process into an
XMLRPC server
import string
import subprocess

from SimpleXMLRPCServer import SimpleXMLRPCServer
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler

# Restrict to a particular path.
class RequestHandler(SimpleXMLRPCRequestHandler):
    rpc_paths = ('/RPC2',)

# Create server
server = SimpleXMLRPCServer(("", 8000),

def wvrretrieve(TObs1, TObs2, TObs3, TObs4,
    sout, serr=p.communicate()
    for l in sout.split("\n"):
        if len(ld)==0:
        if ld[0]=="c:":
        if ld[0]=="tau183:":
        if ld[0]=="evidence:":
    return res


# Run the server's main loop

Table Of Contents

Previous topic

Some notes on Python relevant to ALMA and ALMA data reduction

Next topic

casata: CASA Tools for Analysis