This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
devel:brewerpythonmodule [2015/10/23 12:19] ajberjon |
devel:brewerpythonmodule [2020/12/13 21:06] fparraro |
||
---|---|---|---|
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://rbcce.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 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) |