User Tools

Site Tools


devel:brewerjsonpythonmodule

This is an old revision of the document!


Brewer JSON Python Module

The Brewer JSON Python Module provides the functions to connect to the RBCC-E database and to download data of the different Brewer equipments.

We describe here the functions implemented in brewerjson.py module. The last version of the python module is available from rbcce subversion repository.

Installation

Brewer JSON library can be imported from python code adding the path to brewer.py module to the Python path (list of directories Python goes through to search for modules and files):

import sys
sys.path.append("/home/to/module/")

Alternatively, you can download brewer.py file to the standard location for third-party Python modules. This location varies by platform and by how you built/installed Python itself. Typical locations are shown in the following table:

Platform Standard installation location
Windows C:\PythonXY\Lib\site-packages
Unix /usr/local/lib/pythonX.Y/site-packages

Functions

The functions of this module are:

Field Description
getdata() Retrieve raw data from RBCC-E database
getDataList() Retrieve a list of dictionaries with data from RBCC-E between two dates

getdata()

This function retrieve brewer data using the interface describing in the access functions Section. This function accepts only an argument params which is a dictionary. Mandatory elements in params are the following strings: user, password, berwerid and function. The function element refers to the different functions described in theaccess functions Section.

Example

  params['user']='user'
  params['password']='password'
  params['function']='getDS'
  params['brewerid']='037'
  params['date']='2014-10-01'
  data=brewerjson.check_hg(params)

In this example we retrieve data from the url: http://rbcce.aemet.es/eubrewnet/getdata/getDS?brewerid=037&date=2014-10-01

This function returns different data structures depending on function parameter.

getDataList()

devel/brewerjsonpythonmodule.1442828367.txt.gz · Last modified: 2015/09/21 09:39 by ajberjon