Get Series Data

The cli.getSeries() series function is without a doubt the most important package function. It is the core function to get data out of the BayEOS-Server. An active connection is necessary to call the function. Let's open a connection to our BayEOS Server by reusing the guest alias of our CLI Example.

In [1]:
from bayeos import cli as bayeos

Open connection to as user gast

Default Parameters

A first look at the function definition showed, that there are several ways to call the function. The easiest approach is to navigate into a folder with data series and call the getSeries() function with it's default arguments. This will produce a numpy array with channel columns and rows of data from yesterday until todoay for all series in your current folder.

In [2]:

Alle Messungen/Micrometeorology Dept/AWS Ecological Botanical Garden/AWS EBG Data start May 08, 1997/Lufttemperatur & Feuchte
14294     |..
2718      |Lufttemperatur 02 m Höhe (HMP45)                  |messung_massendaten |1997-05-08 06:00:00 |2014-08-26 14:30:00 
2717      |Relative Luftfeuchte 02 m Höhe (HMP45)            |messung_massendaten |1997-05-08 06:00:00 |2014-08-26 14:30:00 

In [3]:
data = bayeos.getSeries()

Fetching data of series:[2718, 2717]
Rows fetched:232

Let's check the type of our data variable.

In [4]:


Each numpy array contains metainformation in a property called dtype. It's up to you to reuse these properties during the analysis of your data.

In [5]:

dtype([('dateTime', '>i4'), ('Lufttemperatur 02 m Höhe (HMP45)', '>f4'), ('Relative Luftfeuchte 02 m Höhe (HMP45)', '>f4')])

The first column of our data array contains values as integer. These values represent the time of observation in seconds since January 1, 1970, 00:00:00 GMT. Further columns represent the series values as Floats. You can produce python dateTime typed values out of the first column values with the following statement:

In [6]:
import datetime as dt
dateCol = [dt.datetime.fromtimestamp(t) for t in data['dateTime']]

Select of Series by ID

Series can be selected by id or a list of ids.

In [7]:
data = bayeos.getSeries(2718)

Rows fetched:232

In [8]:
data = bayeos.getSeries([2718,2717])

Rows fetched:232

Filter Rows by Start and/or Until Date of Observation

You can filter the series values by a start and/or until value. Both parameters must fullfill the following restrictions:

  • start := {'yesterday'|'today'|'%Y-%m-%d %H:%M'}
  • until := {'yesterday'|'today'|'%Y-%m-%d %H:%M'}

Here are examples showing the different possibilities to call the function:

In [9]:
data = bayeos.getSeries([2718,2717],start='yesterday')

Rows fetched:232

In [10]:
data = bayeos.getSeries([2718,2717],start='yesterday',until='today')

Rows fetched:232

In [11]:
date = bayeos.getSeries([2718,2717],start='2014-08-01 00:00',until='2014-08-07 00:00')

Rows fetched:865

Filter Rows by Time Interval of Observation

There are several fixed time intervals defined to pick a time period:

  • today
  • this week
  • this month
  • this year
  • yesterday
  • last week
  • last month
  • last year

You can use the interval name and ommit the start end until parameter to filter the data:

In [12]:
data = bayeos.getSeries([2718,2717],interval="last week")

Rows fetched:1009

Select Aggregated Values

Server side aggregated series values can be accessed by calling the getSeries() function with aggFunc and aggInt parameters:

In [13]:
data = bayeos.getSeries([2718,2717],interval="last week",aggfunc="avg",aggint="day")

Rows fetched:8

The available functions can be determined at runtime:

In [14]:
print("Aggregation functions:" + str([x for x in bayeos.getAggFunc()]))
print("Aggregation intervals:" + str([x for x in bayeos.getAggInt()]))

Aggregation functions:['avg', 'max', 'sum', 'min']
Aggregation intervals:['30min', 'day', 'hour', 'month', 'year']


If set for aggegarated values, additional count columns will be added to the output array.

In [15]:
data = bayeos.getSeries([2718,2717],interval="last week",aggfunc="avg",aggint="day",csFlag=True)

Rows fetched:8

If set for non aggregated values, status flag column (range(10)) will be added for each value column.

In [16]:
data = bayeos.getSeries([2718,2717],interval="last week",csFlag=True)

Rows fetched:1009

In [17]:

dtype([('dateTime', '>i4'), ('Lufttemperatur 02 m Höhe (HMP45)', '>f4'), ('Lufttemperatur 02 m Höhe (HMP45)_status', '>i4'), ('Relative Luftfeuchte 02 m Höhe (HMP45)', '>f4'), ('Relative Luftfeuchte 02 m Höhe (HMP45)_status', '>i4')])