Command line navigation interface

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.

Import of bayeos 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

Server Connection

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")


Open connection to http://bayeos.bayceer.uni-bayreuth.de/BayEOS-Server/XMLServlet as user gast
Out[2]:
True

A connection can be closed by calling disconnect()


In [3]:
bayeos.disconnect()


Close connection
Out[3]:
True

Just call the connect() function with the parameter listConnections=True to list all available connection alias.


In [4]:
bayeos.connect(listConnections=True)


Alias               |URL                                                                             |User      
--------------------|--------------------------------------------------------------------------------|----------
guest@bayeos        |http://bayeos.bayceer.uni-bayreuth.de/BayEOS-Server/XMLServlet                  |gast      
Out[4]:
True

Use the alias to reopen the connection.


In [5]:
bayeos.connect(url="guest@bayeos")


Open connection to http://bayeos.bayceer.uni-bayreuth.de/BayEOS-Server/XMLServlet as user gast
Out[5]:
True

Basic Navigation

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()


Alle Messungen
None      |..
126613    |Demo BayXBee                                      |messung_ordner      |2012-04-24 14:30:00 |2013-10-08 11:21:59 
126232    |Dr. Hans-Frisch                                   |messung_ordner      |2012-06-25 10:06:27 |2014-05-23 08:30:00 
14333     |Micrometeorology Dept                             |messung_ordner      |1992-01-06 00:00:00 |2014-08-26 14:36:00 
117846    |Pivot Tabellen                                    |messung_ordner      |1970-01-01 00:00:00 |2020-01-01 00:00:00 
14325     |Steinkreuz                                        |messung_ordner      |1994-03-17 12:00:00 |2008-04-08 10:50:00 

Use the cd() function to change the current working directory. You need to pass in the folder id.


In [7]:
bayeos.cd(14333)


Alle Messungen/Micrometeorology Dept
83        |..
14473     |AWS Ecological Botanical Garden                   |messung_ordner      |1992-01-06 00:00:00 |2014-08-26 14:30:00 

Please call cd('..') to switch into the parent directory.


In [8]:
bayeos.cd('..')


Alle Messungen
None      |..
126613    |Demo BayXBee                                      |messung_ordner      |2012-04-24 14:30:00 |2013-10-08 11:21:59 
126232    |Dr. Hans-Frisch                                   |messung_ordner      |2012-06-25 10:06:27 |2014-05-23 08:30:00 
14333     |Micrometeorology Dept                             |messung_ordner      |1992-01-06 00:00:00 |2014-08-26 14:36:00 
117846    |Pivot Tabellen                                    |messung_ordner      |1970-01-01 00:00:00 |2020-01-01 00:00:00 
14325     |Steinkreuz                                        |messung_ordner      |1994-03-17 12:00:00 |2008-04-08 10:50:00 

The pwd() function prints the current working directory path.


In [9]:
bayeos.pwd()


Alle Messungen

Please close the connection before you shut down the kernel.


In [10]:
bayeos.disconnect()


Close connection
Out[10]:
True