User Tools

Site Tools


devel:brewerjsonpythonmodule

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

devel:brewerjsonpythonmodule [2015/09/21 10:23]
ajberjon
devel:brewerjsonpythonmodule [2022/10/20 08:00]
Line 1: Line 1:
-====== 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 [[http://​rbcce.aemet.es/​svn/​python/​libbrewerjson/​|rbcce subversion repository]]. 
- 
-===== Installation ===== 
- 
-Brewer JSON library can be imported from python code adding the path to brewerjson.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 ^ 
-^ [[devel:​brewerjsonpythonmodule#​getdata|getdata()]] | Retrieve raw data from RBCC-E database ^ 
-^ [[devel:​brewerjsonpythonmodule#​getDataList|getDataList()]] | Retrieve a list of dictionaries with data from RBCC-E between two dates ^ 
- 
-=== getdata() === 
- 
-This function retrieves brewer data using the interface described in the [[codes:​accessfunctions|access functions Section]]. This function accepts only an argument //params// which is a dictionary. Mandatory elements in //params// are: //user//, //​password//,​ //​berwerid//​ and //​function//​. Other elements should be provided depending on the selected //​function//​. The //​function//​ element refers to the different functions described in the [[codes:​accessfunctions|access functions Section]]. 
- 
-**Example** 
-    import brewerjson 
-    import datetime 
-    ​ 
-    params['​user'​]='​user'​ 
-    params['​password'​]='​password'​ 
-    params['​function'​]='​getDS'​ 
-    params['​brewerid'​]=37 
-    params['​date'​]=datetime.date(2014,​10,​01)'​ 
-    data=brewerjson.getdata(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() === 
- 
-This function retrieve a list of [[http://​rbcce.aemet.es/​dokuwiki/​doku.php?​id=devel:​brewerpythonmodule#​data_structures|dictionaries]] with data of the registered brewers at the RBCC-E database. Arguments are //​berwerid//,​ //user//, //​password//,​ //​function//,​ //date1// and //date2//. If //date2// is omitted the function returns only data of the day //data1//. 
- 
-Valid values of //​function//​ argument are only '​getDS',​ '​getDSS',​ '​getSL',​ '​getSLS'​ and '​getConfigsbyDate'​. 
- 
-**Example** 
-    import brewerjson 
-    import datetime 
-    ​ 
-    d1=datetime.date(2014,​10,​01) 
-    d2=datetime.date(2014,​10,​02) 
-    data=brewerjson.getDataList(37,'​user,'​password','​getDS',​d1,​d2) 
- 
- 
- 
  
devel/brewerjsonpythonmodule.txt ยท Last modified: 2022/10/20 08:00 (external edit)