We will show how you how to use the bayeos.cli
module to handle connections to a BayEOS Server. You can navigate through the folder structure to get series data as a numpy array. The logic to navigate a BayEOS Server is based on the api of our BayEOS-R package.
The bayeos package can be imported as any other python package. We will rename the cli module as bayeos.
In [1]:
from bayeos import cli as bayeos
Let us now open the connection to our freely available BayEOS Server and save the connection information in a encrypted file on our local disk. We can pick the connection information later on by an alias.
In [2]:
bayeos.connect(url="http://bayeos.bayceer.uni-bayreuth.de/BayEOS-Server/XMLServlet",user="gast",password="gast",save_as="guest@bayeos")
Out[2]:
A connection can be closed by calling disconnect()
In [3]:
bayeos.disconnect()
Out[3]:
Just call the connect()
function with the parameter listConnections=True
to list all available connection alias.
In [4]:
bayeos.connect(listConnections=True)
Out[4]:
Use the alias to reopen the connection.
In [5]:
bayeos.connect(url="guest@bayeos")
Out[5]:
The basic navigation interface is loosely based on the UNIX
file sytem navigation commands.
We can show the content of a working directory by calling the ls()
function. The output shows the id, name, type, first and last result date of folders and series rendered as a table.
In [6]:
bayeos.ls()
Use the cd()
function to change the current working directory. You need to pass in the folder id.
In [7]:
bayeos.cd(14333)
Please call cd('..')
to switch into the parent directory.
In [8]:
bayeos.cd('..')
The pwd()
function prints the current working directory path.
In [9]:
bayeos.pwd()
Please close the connection before you shut down the kernel.
In [10]:
bayeos.disconnect()
Out[10]: