def iter(): """ Iterator returning a WorkspaceVariable object for each ARTS WSV available. """ for i in range(arts_api.get_number_of_variables()): s = arts_api.get_variable(i) name = s.name.decode("utf8") description = s.description.decode("utf") group = group_names[s.group] yield WorkspaceVariable(i, name, group, description)
def __init__(self): """ The init function just creates an instance of the ArtsWorkspace class of the C API and sets the ptr attributed to the returned handle. It also adds all workspace methods as attributes to the object. """ self.__dict__["_vars"] = dict() self.ptr = arts_api.create_workspace() self.workspace_size = arts_api.get_number_of_variables() for name in workspace_methods: m = workspace_methods[name] setattr(self, m.name, WSMCall(self, m))
def __init__(self): """ The init function just creates an instance of the ArtsWorkspace class of the C API and sets the ptr attributed to the returned handle. It also adds all workspace methods as attributes to the object. """ self.__dict__["vars"] = dict() self.ptr = arts_api.create_workspace() self.workspace_size = arts_api.get_number_of_variables() for name in workspace_methods: m = workspace_methods[name] def make_fun(method): return lambda *args, **kwargs: method.call( self, *args, **kwargs) setattr(self, m.name, make_fun(m)) getattr(self, m.name).__doc__ = m.description
def __init__(self, verbosity=1, agenda_verbosity=0): """ The init function just creates an instance of the ArtsWorkspace class of the C API and sets the ptr attributed to the returned handle. It also adds all workspace methods as attributes to the object. Parameters: verbosity (int): Verbosity level (0-3), 1 by default agenda_verbosity (int): Verbosity level for agendas (0-3), 0 by default """ self.__dict__["_vars"] = dict() self.ptr = arts_api.create_workspace(verbosity, agenda_verbosity) self.workspace_size = arts_api.get_number_of_variables() for name in workspace_methods: m = workspace_methods[name] setattr(self, m.name, WSMCall(self, m)) self.__verbosity_init__()