User Tools

Site Tools


devel:brewerpythonmodule

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
devel:brewerpythonmodule [2015/10/23 12:19]
ajberjon
devel:brewerpythonmodule [2022/10/20 08:00] (current)
Line 1: Line 1:
-====== Brewer Python ​Module ​======+====== Brewer Python ​Library ​======
  
-We describe here the functions and data structured implemented in brewer.py module. The last version of the python ​module ​is available from [[http://​rbcce.aemet.es/​svn/​python/​libbrewer/​|rbcce subversion repository]].+We describe here the functions and data structured implemented in brewer.py ​library. A Python library to the Eubrewnet database can be found in the [[ http://​eubrewnet.aemet.es/​dokuwiki/​doku.php?​id=devel:​brewerjsonpythonmodule | brewerjson ​module ​]]. The last version of the brewer ​python ​library ​is available from [[http://​rbcce.aemet.es/​svn/​python/​libbrewer/​|rbcce subversion repository]].
  
 ===== Installation ===== ===== Installation =====
Line 20: Line 20:
 ===== Data structures ===== ===== Data structures =====
  
-Functions from //​brewer.py//​ module use four different data structures for both input and output. These structures are python dictionaries:​ //​measure//,​ //uv//, //hg//, //config// and //bdaily//. These structures can be generated by using [[http://rbcce.aemet.es/​dokuwiki/​doku.php?​id=devel:​brewerjsonpythonmodule|brewerjson module]].+Functions from //​brewer.py//​ module use four different data structures for both input and output. These structures are python dictionaries:​ //​measure//,​ //uv//, //hg//, //config// and //bdaily//. These structures can be generated by using [[http://eubrewnet.aemet.es/​dokuwiki/​doku.php?​id=devel:​brewerjsonpythonmodule|brewerjson module]].
  
 ==== measure ==== ==== measure ====
-Dictionary containing values of the DS and SL Brewer measurements. Some of the dictionary fields will be used as input to the calculations of the library functions, and others will be used as the output. The values can came from B files or from Eubrewnet database through its JSON interface by using [[http://rbcce.aemet.es/​dokuwiki/​doku.php?​id=devel:​brewerjsonpythonmodule|brewerjson module]]. It contains the following fields:+Dictionary containing values of the DS and SL Brewer measurements. Some of the dictionary fields will be used as input to the calculations of the library functions, and others will be used as the output. The values can came from B files or from Eubrewnet database through its JSON interface by using [[http://eubrewnet.aemet.es/​dokuwiki/​doku.php?​id=devel:​brewerjsonpythonmodule|brewerjson module]]. It contains the following fields:
  
 ^ Field ^ Description ^ ^ Field ^ Description ^
Line 67: Line 67:
 ==== uv ==== ==== uv ====
  
-Dictionary containing values of the UV Brewer measurements,​ including uv, ux, and ua. Some of the dictionary fields will be used as input to the calculations of the library functions, and others will be used as the output. The values can came from B files or from Eubrewnet database through its JSON interface by using [[http://rbcce.aemet.es/​dokuwiki/​doku.php?​id=devel:​brewerjsonpythonmodule|brewerjson module]]. It contains the following fields:+Dictionary containing values of the UV Brewer measurements,​ including uv, ux, and ua. Some of the dictionary fields will be used as input to the calculations of the library functions, and others will be used as the output. The values can came from B files or from Eubrewnet database through its JSON interface by using [[http://eubrewnet.aemet.es/​dokuwiki/​doku.php?​id=devel:​brewerjsonpythonmodule|brewerjson module]]. It contains the following fields:
  
 ^ Field ^ Description ^ ^ Field ^ Description ^
Line 102: Line 102:
  
 ==== hg ==== ==== hg ====
-Dictionary containing values of HG Brewer calibration. The values can came from B files or from Eubrewnet database through its JSON interface by using [[http://rbcce.aemet.es/​dokuwiki/​doku.php?​id=devel:​brewerjsonpythonmodule|brewerjson module]]. It contains the following fields:+Dictionary containing values of HG Brewer calibration. The values can came from B files or from Eubrewnet database through its JSON interface by using [[http://eubrewnet.aemet.es/​dokuwiki/​doku.php?​id=devel:​brewerjsonpythonmodule|brewerjson module]]. It contains the following fields:
  
 ^ Field ^ Description ^ ^ Field ^ Description ^
Line 109: Line 109:
  
 ==== config ==== ==== config ====
-Dictionary containing values of brewer settings. The values can came from B files, from ICF or from Eubrewnet database through its JSON interface by using [[http://rbcce.aemet.es/​dokuwiki/​doku.php?​id=devel:​brewerjsonpythonmodule|brewerjson module]]. It contains the following fields:+Dictionary containing values of brewer settings. The values can came from B files, from ICF or from Eubrewnet database through its JSON interface by using [[http://eubrewnet.aemet.es/​dokuwiki/​doku.php?​id=devel:​brewerjsonpythonmodule|brewerjson module]]. It contains the following fields:
  
 ^ Field ^ Description ^ ^ Field ^ Description ^
Line 176: Line 176:
 ^ Function ^ Short Description ^ ^ Function ^ Short Description ^
 ^ [[devel:​brewerpythonmodule#​airmass_calc| airmass_calc()]] | Calculates sun position and air mass (rayleigh and ozone) for brewer individual measurements. ^ ^ [[devel:​brewerpythonmodule#​airmass_calc| airmass_calc()]] | Calculates sun position and air mass (rayleigh and ozone) for brewer individual measurements. ^
-^ [[devel:​brewerpythonmodule#​instrumental_cor|instrumental_cor()]] | Applies instrumental corrections (darkcount, deadtime, temperature,​ filter attenuation) to brewer individual ​raw measurements. ^+^ [[devel:​brewerpythonmodule#​airmass_calcl| airmass_calcl()]] | Calculates sun position and air mass (rayleigh and ozone) for a list of brewer measurements. ^ 
 +^ [[devel:​brewerpythonmodule#​instrumental_cor|instrumental_cor()]] | Applies instrumental corrections (darkcount, deadtime, temperature,​ filter attenuation) to brewer individual ​measurements. ^ 
 +^ [[devel:​brewerpythonmodule#​instrumental_corl|instrumental_corl()]] | Applies instrumental corrections (darkcount, deadtime, temperature,​ filter attenuation) to a list of brewer ​measurements. ^
 ^ [[devel:​brewerpythonmodule#​rayleigh_cor|rayleigh_cor()]] | Applies Rayleigh corrections to brewer instrumentally corrected individual measurements. ^ ^ [[devel:​brewerpythonmodule#​rayleigh_cor|rayleigh_cor()]] | Applies Rayleigh corrections to brewer instrumentally corrected individual measurements. ^
 +^ [[devel:​brewerpythonmodule#​rayleigh_corl|rayleigh_corl()]] | Applies Rayleigh corrections to a list of brewer instrumentally corrected measurements. ^
 ^ [[devel:​brewerpythonmodule#​o3_so2|o3_so2()]] | Calculates $O_3$ and $SO_2$ from the brewer corrected individual measurements. ^ ^ [[devel:​brewerpythonmodule#​o3_so2|o3_so2()]] | Calculates $O_3$ and $SO_2$ from the brewer corrected individual measurements. ^
 ^ [[devel:​brewerpythonmodule#​o3_so2_sl|o3_so2_sl()]] | Calculates Standard Lamp correction for $O_3$ and $SO_2$. ^ ^ [[devel:​brewerpythonmodule#​o3_so2_sl|o3_so2_sl()]] | Calculates Standard Lamp correction for $O_3$ and $SO_2$. ^
Line 210: Line 213:
   * //'​airmass_rayleigh'//​. This is defined as the Rayleigh air mass, and is  calculated as the output of //​brewer_airmass()//,​ using //'​zenith_angle'//​ and a height of 5km as input.   * //'​airmass_rayleigh'//​. This is defined as the Rayleigh air mass, and is  calculated as the output of //​brewer_airmass()//,​ using //'​zenith_angle'//​ and a height of 5km as input.
  
 +
 +=== airmass_calcl() ===
 +
 +This function applies [[devel:​brewerpythonmodule#​airmass_calc| airmass_calc()]] to a list of brewer measuremments. It accepts two input parameters: //'​measure'//​ and //'​config'//​.
 +
 +  * //'​measure'//​ is a list of measurements ds, sl, etc.
 +  * //'​config'//​ is a list of dictionaries with brewer configurations.
 +
 +**Example**
 +    import datetime
 +    import brewer
 +    import brewerjson
 +    ​
 +    brewerid=185
 +    user='​user'​
 +    password='​password'​
 +    date1=datetime.date(2012,​2,​7)
 +    date2=datetime.date(2012,​2,​8)
 +    ds=brewerjson.getDataList(brewerid,​user,​password,"​DS",​date1,​date2)
 +    config=brewerjson.getDataList(brewerid,​user,​password,"​ConfigbyDate",​date1,​date2)
 +    ds=brewer.airmass_calcl(ds,​config)
 +
 +  ​
  
 === instrumental_cor() === === instrumental_cor() ===
Line 245: Line 271:
     * $double\_ratio1 = \sum_{i} measure\_w_i * w\_so2_{i+1} $     * $double\_ratio1 = \sum_{i} measure\_w_i * w\_so2_{i+1} $
     * $double\_ratio2 = \sum_{i} measure\_w_i * w\_o3_{i+1} $     * $double\_ratio2 = \sum_{i} measure\_w_i * w\_o3_{i+1} $
 +
 +
 +=== instrumental_corl() ===
 +
 +This function applies [[devel:​brewerpythonmodule#​instrumental_cor()| instrumental_cor()]] to a list of brewer measuremments. It accepts two input parameters: //'​measure'//​ and //'​config'//​.
 +
 +  * //'​measure'//​ is a list of measurements ds, sl, etc.
 +  * //'​config'//​ is a list of dictionaries with brewer configurations.
 +
 +**Example**
 +    import datetime
 +    import brewer
 +    import brewerjson
 +    ​
 +    brewerid=185
 +    user='​user'​
 +    password='​password'​
 +    date1=datetime.date(2012,​2,​7)
 +    date2=datetime.date(2012,​2,​8)
 +    sl=brewerjson.getDataList(brewerid,​user,​password,"​SL",​date1,​date2)
 +    config=brewerjson.getDataList(brewerid,​user,​password,"​ConfigbyDate",​date1,​date2)
 +    sl=brewer.instrumental_corl(sl,​config)
 +
  
  
Line 279: Line 328:
  
 This function returns the input //measure// dictionary, updating the following fields as described above: //'​measure_w1'//,​ //'​measure_w2'//,​ //'​measure_w3'//,​ //'​measure_w4'//,​ //'​measure_w5'//,​ //'​single_ratio1'//,​ //'​single_ratio2'//,​ //'​single_ratio3'//,​ //'​single_ratio4'//,​ //'​double_ratio1'//​ and //'​double_ratio2'//​. This function returns the input //measure// dictionary, updating the following fields as described above: //'​measure_w1'//,​ //'​measure_w2'//,​ //'​measure_w3'//,​ //'​measure_w4'//,​ //'​measure_w5'//,​ //'​single_ratio1'//,​ //'​single_ratio2'//,​ //'​single_ratio3'//,​ //'​single_ratio4'//,​ //'​double_ratio1'//​ and //'​double_ratio2'//​.
 +
 +=== rayleigh_corl() ===
 +
 +This function applies [[devel:​brewerpythonmodule#​irayleigh_corl()| rayleigh_corl()]] to a list of brewer instrumentally corrected measurements. It accepts two input parameters: //'​measure'//​ and //'​config'//​.
 +
 +  * //'​measure'//​ is a list of measurements ds, sl, etc.
 +  * //'​config'//​ is a list of dictionaries with brewer configurations.
 +
 +**Example**
 +    import datetime
 +    import brewer
 +    import brewerjson
 +  ​
 +    brewerid=185
 +    user='​user'​
 +    password='​password'​
 +    date1=datetime.date(2012,​2,​7)
 +    date2=datetime.date(2012,​2,​8)
 +    ds=brewerjson.getDataList(brewerid,​user,​password,"​DS",​date1,​date2)
 +    config=brewerjson.getDataList(brewerid,​user,​password,"​ConfigbyDate",​date1,​date2)
 +    ​
 +    ds=brewer.airmass_calcl(ds,​config)
 +    ds=brewer.instrumental_corl(ds,​config)
 +    ds=brewer.rayleigh_corl(ds,​config)
 +
  
 === o3_so2() === === o3_so2() ===
Line 446: Line 520:
     password='​password'​     password='​password'​
     date1=datetime.date(2012,​2,​7)     date1=datetime.date(2012,​2,​7)
-    ds=brewerjson.getDataList(brewerid,​user,​password,"​getDS",​date1)+    ds=brewerjson.getDataList(brewerid,​user,​password,"​DS",​date1)
     ​     ​
     dsf = brewer.temp_filter(ds,​[20])     dsf = brewer.temp_filter(ds,​[20])
Line 466: Line 540:
     password='​password'​     password='​password'​
     date1=datetime.date(2012,​2,​7)     date1=datetime.date(2012,​2,​7)
-    ds=brewerjson.getDataList(brewerid,​user,​password,"​getDS",​date1)+    ds=brewerjson.getDataList(brewerid,​user,​password,"​DS",​date1)
     ​     ​
     dsf=brewer.gmt_filter(ds,​[datetime.datetime(2012,​ 2, 7, 12, 0, 0),​datetime.datetime(2012,​ 2, 7, 15, 0, 0)])     dsf=brewer.gmt_filter(ds,​[datetime.datetime(2012,​ 2, 7, 12, 0, 0),​datetime.datetime(2012,​ 2, 7, 15, 0, 0)])
Line 488: Line 562:
     password='​password'​     password='​password'​
     date1=datetime.date(2012,​2,​7)     date1=datetime.date(2012,​2,​7)
-    ds=brewerjson.getDataList(brewerid,​user,​password,"​getDS",​date1)+    ds=brewerjson.getDataList(brewerid,​user,​password,"​DS",​date1)
     ​     ​
     dsf=brewer.outliers_filter(ds,​3)     dsf=brewer.outliers_filter(ds,​3)
Line 508: Line 582:
     password='​password'​     password='​password'​
     date1=datetime.date(2012,​2,​7)     date1=datetime.date(2012,​2,​7)
-    ds=brewerjson.getDataList(brewerid,​user,​password,"​getDS",​date1)+    ds=brewerjson.getDataList(brewerid,​user,​password,"​DS",​date1)
     ​     ​
     ds=brewer.airmass_calcl(ds,​config)     ds=brewer.airmass_calcl(ds,​config)
Line 545: Line 619:
     date1=datetime.date(2012,​2,​7)     date1=datetime.date(2012,​2,​7)
     date2=datetime.date(2012,​2,​8)     date2=datetime.date(2012,​2,​8)
-    sl=brewerjson.getDataList(brewerid,​user,​password,"​getSL",​date1,​date2) +    sl=brewerjson.getDataList(brewerid,​user,​password,"​SL",​date1,​date2) 
-    config=brewerjson.getDataList(brewerid,​user,​password,"​getConfigsbyDate",​date1,​date2)+    config=brewerjson.getDataList(brewerid,​user,​password,"​ConfigbyDate",​date1,​date2)
     ​     ​
     sl=brewer.instrumental_corl(sl,​config)     sl=brewer.instrumental_corl(sl,​config)
Line 593: Line 667:
     date1=datetime.date(2012,​2,​7)     date1=datetime.date(2012,​2,​7)
     date2=datetime.date(2012,​2,​8)     date2=datetime.date(2012,​2,​8)
-    sl=brewerjson.getDataList(brewerid,​user,​password,"​getSL",​date1,​date2) +    sl=brewerjson.getDataList(brewerid,​user,​password,"​SL",​date1,​date2) 
-    config=brewerjson.getDataList(brewerid,​user,​password,"​getConfigsbyDate",​date1,​date2)+    config=brewerjson.getDataList(brewerid,​user,​password,"​ConfigbyDate",​date1,​date2)
     ​     ​
     ta=tempanalysis(sl,​config,​[],​0)     ta=tempanalysis(sl,​config,​[],​0)
devel/brewerpythonmodule.1445602741.txt.gz · Last modified: 2015/10/23 12:19 by ajberjon