This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
devel:brewerjsonpythonmodule [2016/05/18 20:13] ajberjon |
devel:brewerjsonpythonmodule [2016/05/18 20:28] ajberjon |
||
---|---|---|---|
Line 38: | Line 38: | ||
^ 'DS' | [[http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#measure|measure]] ^ | ^ 'DS' | [[http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#measure|measure]] ^ | ||
^ 'SL' | [[http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#measure|measure]] ^ | ^ 'SL' | [[http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#measure|measure]] ^ | ||
- | ^ 'ConfigsbyDate'' | [[http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#config|config]] ^ | + | ^ 'ConfigbyDate' | [[http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#config|config]] ^ |
**Example** | **Example** | ||
Line 46: | Line 46: | ||
d1=datetime.date(2014,10,01) | d1=datetime.date(2014,10,01) | ||
d2=datetime.date(2014,10,02) | d2=datetime.date(2014,10,02) | ||
- | data=brewerjson.getDataList(37,'user,'password','DS',d1,d2) | + | data=brewerjson.getDataList(185,'user,'password','DS',d1,d2) |
- | === getdata() === | + | === writejson() === |
- | 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]]. | + | This function save a list of [[http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#data_structures|dictionaries]] to file. The values of 'gmt' and 'date' are transformed to strings. |
**Example** | **Example** | ||
Line 56: | Line 56: | ||
import datetime | import datetime | ||
| | ||
- | params={} | + | d1=datetime.date(2014,10,01) |
- | params['user']='user' | + | d2=datetime.date(2014,10,02) |
- | params['password']='password' | + | data=brewerjson.getDataList(185,'user,'password','DS',d1,d2) |
- | params['function']='getDS' | + | brewerjson.getdata(data,'output.txt') |
- | 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. | + | |
+ | This function accepts two input parameters: //'data'// and //'file'//. | ||
+ | * //'data'// is a list of [[http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#data_structures|dictionaries]]. | ||
+ | * //'file'// output file. | ||
=== formatConfig() === | === formatConfig() === |