The workspace subpackage provides an interactive interface to ARTS and can be used to directly call workspace methods and agendas as well as access and manipulate workspace variables.


The python interface needs access to the shared library, which is located in the src subfolder of the ARTS build tree. The interface expects the location of the ARTS build tree to be provided in the ARTS_BUILD_PATH environment variable. For the to be built, ARTS needs to be configured with -DENABLE_C_API=1:

cmake -DENABLE_C_API=1 ... /path/to/arts

The Workspace Class

The main functionality of the interface is implemented by the Workspace class. A Workspace object represents an ongoing ARTS simulation and is used to execute controlfiles and workspace methods and access workspace variables

>>> from typhon.arts.workspace import Workspace
>>> ws = Workspace()

Executing Controlfiles

Controlfiles can be executed on a workspace using the execute_controlfile() method.

>>> ws.execute_controlfile("general.arts")

The search path for controlfiles is the current directory plus the paths provided in the environment variable ARTS_INCLUDE_PATH. Controlfiles are parsed only once and then cached. Thus, if a controlfile is modified after it has been loaded, these changes will only be effective after a restart of the python runtime.

Calling Workspace Methods

ARTS workspace methods are available as member functions of each Workspace object:

>>> ws.AtmosphereSet1D()
>>> ws.IndexSet(ws.stokes_dim, 1)

Arguments can be passed to a workspace function in three ways:

  1. As workspace variables using the attributes of the workspace object, such as ws.stokes_dim in the example above.
  2. Using one of the symbolic variables in typhon.arts.workspace.variables
  3. Passing supported python objects directly

Arguments to a WSM can be passed using either positional or named arguments or both. If positional arguments are provided at least all generic output and generic input arguments must be given in order.

>>> ws.VectorNLogSpace(ws.p_grid, 361, 500e2, 0.1 )

Keyword arguments to define generic input and output arguments. Available keywords are the names of the generic outputs and inputs defined in

>>> ws.abs_speciesSet(species=[ "O3" ])

Calls to supergeneric functions are resolved by the interface.

Workspace Variables

Symbolic representation of all workspace variables are available in the typhon.arts.workspace.variables module as module attributes. The purpose of these is to be passed to workspace functions as placeholders for variables in the workspace.

Variable objects can be associated to a workspace, which is the case for variables accessed as attributes of a workspace, i.e. using for example:

>>> ws.y

If that is the case their value can be accessed using the value() member function. In order to print out a textual representation of the value, the print() member function can be used, which will call the corresponding Print() ARTS WSV.

Workspace variables of the groups Vector, Matrix and Tensor with an associated workspace implement the numpy array interface and can therefore be used just as any other numpy array. In some cases, however, it may be necessary to explicitly create a view on the array using numpy.asarray.

arts_agenda(func) Parse python method as ARTS agenda
Include(agenda) Simple helper class to handle INCLUDE statements in agenda definitions.
Workspace([verbosity, agenda_verbosity]) The Workspace class represents an ongoing ARTS simulation.


The agendas submodule.

This module provides the Agenda class, which is used to represent parsed controlfiles and can be executed on a given Workspace object.



ARTS C API Interface

This module provides a foreign function interface for the ARTS C API. It defines the C structs used by the interface as ctypes.Structure child classes as well as the return argument and return types of the function provided by the C API.


The ARTS C API is provided by the library and is required by the module. The module will check if the ARTS_BUILD_PATH variable is set and assume the library can be found in the src subdirectory. If opening the library fails loading the module will fail with an EnvironmentError.


The ctypes library handle holding the ARTS C API.



The methods submodule.

This module exposes all ARTS workspace methods represented by WorkspaceMethod object.

The methods are loaded dynamically when the module is imported, which ensures that they up to date with the current ARTS build.


Dictionary containing all ARTS workspace methods.

WorkspaceMethod(m_id, name, description, …) The WorkspaceMethod class represents ARTS workspace methods.
iter() Iterator returning a WorkspaceMethod object for each available ARTS WSM.


The variables submodule.

This module contains symbolic representations of all ARTS workspace variables.

The variables are loaded dynamically when the module is imported, which ensures that they up to date with the current ARTS build.

TODO: The group names list is redudant w.rt. group_ids.keys(). Should be removed.


List of strings holding the groups of ARTS WSV variables.


Dictionary mapping group names to the group IDs which identify groups in the ARTS C API.

WorkspaceVariable(ws_id, name, group, …[, ws]) The WorkspaceVariable represents ARTS workspace variables in a symbolic way.