User Tools

Site Tools


devel:brewerjsonpythonmodule

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devel:brewerjsonpythonmodule [2015/10/25 22:02] – [Functions] ajberjondevel:brewerjsonpythonmodule [2022/10/20 08:00] (current) – external edit 127.0.0.1
Line 25: Line 25:
  
 ^ Field ^ Description ^ ^ Field ^ Description ^
-^ [[devel:brewerjsonpythonmodule#getDataList|getDataList()]] | Retrieve a list of dictionaries with data from RBCC-E between two dates ^ +^ [[devel:brewerjsonpythonmodule#getDataList|getDataList()]] | Retrieve a list of dictionaries with data from RBCC-E between two dates
-^ [[devel:brewerjsonpythonmodule#getdata|getdata()]] | Retrieve raw data from RBCC-E database ^ +^ [[devel:brewerjsonpythonmodule#writejson|writejson()]] | Write list of dictionaries (measures, config,..) to file. 
-^ [[devel:brewerjsonpythonmodule#formatConfig|formatConfig()]] | Give format of config dictionary to raw data from RBCC-E database +^ [[devel:brewerjsonpythonmodule#readjson|readjson()]] | Read list of dictionaries (measures, config,..) from file. 
-^ [[devel:brewerjsonpythonmodule#formatDS|formatDS()]] | Give format of measure dictionary to raw data from RBCC-E database ^ +
-^ [[devel:brewerjsonpythonmodule#formatUV|formatUV()]] | Give format of uv dictionary to raw data from RBCC-E database +
-^ [[devel:brewerjsonpythonmodule#formatUVR|formatUVR()]] | Give format of uvr dictionary to raw data from RBCC-E database ^+
  
 === getDataList() === === 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//.+This function retrieve a list of [[http://eubrewnet.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//.
  
 The returned dictionaries structures depend on the //function// argument value: The returned dictionaries structures depend on the //function// argument value:
  
 ^ //function// ^ Dictionaries ^ ^ //function// ^ Dictionaries ^
-^ 'getDS' | [[http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#measure|measure]] ^ +^ 'DS' | [[http://eubrewnet.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#measure|measure]] ^ 
-^ 'getSL' | [[http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#measure|measure]] ^ +^ 'SL' | [[http://eubrewnet.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#measure|measure]] ^ 
-^ 'getConfigsbyDate'' | [[http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#config|config]] ^+^ 'ConfigbyDate' | [[http://eubrewnet.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#config|config]] ^
  
 **Example** **Example**
Line 49: Line 47:
     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','getDS',d1,d2)+    data=brewerjson.getDataList(185,'user,'password','DS',d1,d2)
  
-=== 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]].+=== writejson() ===
  
-**Example** +This function save list of [[http://eubrewnet.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#data_structures|dictionaries]] to file. The values of 'gmt' and 'date' are transformed to strings.
-    import brewerjson +
-    import datetime +
-     +
-    params={} +
-    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. +
- +
- +
- +
-=== formatConfig() === +
- +
-This function returns a [[ http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#config config ]] dictionary from the JSON interface output of the Eubrewnet database.+
  
 **Example** **Example**
Line 81: Line 58:
     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']='getConfigsbyDate' +    brewerjson.getdata(data,'output.txt')
-    params['brewerid']=37 +
-    params['date']=datetime.date(2014,10,01+
-    data=brewerjson.getdata(params+
-    config = brewerjson.formatConfig(data)+
  
 +This function accepts two input parameters: //'data'// and //'file'//.
  
-=== formatDS() ===+  * //'data'// is a list of [[http://eubrewnet.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#data_structures|dictionaries]]. 
 +  * //'file'// output file.
  
-This function returns a [[ http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#measure | measure ]] dictionary from the JSON interface output of the Eubrewnet database. 
  
-**Example** +=== readjson() ===
-    import brewerjson +
-    import datetime +
-     +
-    params={} +
-    params['user']='user' +
-    params['password']='password' +
-    params['function']='getDS' +
-    params['brewerid']=37 +
-    params['date']=datetime.date(2014,10,01) +
-    data=brewerjson.getdata(params) +
-    ds = brewerjson.formatDS(data) +
- +
- +
-=== formatUV() ===+
  
-This function returns a [[ http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#uv uv ]] dictionary from the JSON interface output of the Eubrewnet database.+This function read file containing a list of [[http://eubrewnet.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#data_structures|dictionaries]].
  
 **Example** **Example**
Line 117: Line 77:
     import datetime     import datetime
          
-    params={} +    brewerjson.getdata('input.txt')
-    params['user']='user' +
-    params['password']='password' +
-    params['function']='getUV' +
-    params['brewerid']=37 +
-    params['date']=datetime.date(2014,10,01) +
-    data=brewerjson.getdata(params) +
-    uv = brewerjson.formatUV(data)+
  
-=== formatUVR() === 
- 
-This function returns a [[ http://rbcce.aemet.es/dokuwiki/doku.php?id=devel:brewerpythonmodule#uvr | uvr ]] dictionary from the JSON interface output of the Eubrewnet database. 
- 
-**Example** 
-    import brewerjson 
-    import datetime 
-     
-    params={} 
-    params['user']='user' 
-    params['password']='password' 
-    params['function']='getUVR' 
-    params['brewerid']=37 
-    params['date']=datetime.date(2014,10,01) 
-    data=brewerjson.getdata(params) 
-    uvr = brewerjson.formatUVR(data) 
  
  
devel/brewerjsonpythonmodule.1445810579.txt.gz · Last modified: 2015/10/25 22:02 by ajberjon