devel:brewerpythonmodule
Differences
This shows you the differences between two versions of the page.
| devel:brewerpythonmodule [2015/10/23 08:28] – [Control] ajberjon | devel:brewerpythonmodule [2022/10/20 08:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Brewer Python | + | ====== Brewer Python |
| - | We describe here the functions and data structured implemented in brewer.py module. The last version of the python | + | We describe here the functions and data structured implemented in brewer.py |
| ===== Installation ===== | ===== Installation ===== | ||
| Line 20: | Line 20: | ||
| ===== Data structures ===== | ===== Data structures ===== | ||
| - | Functions from // | + | Functions from // |
| ==== 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 came from B files or Eubrewnet database through its JSON interface. 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 |
| ^ Field ^ Description ^ | ^ Field ^ Description ^ | ||
| Line 67: | Line 67: | ||
| ==== uv ==== | ==== uv ==== | ||
| - | Dictionary containing values of the UV Brewer measurements, | + | Dictionary containing values of the UV Brewer measurements, |
| ^ Field ^ Description ^ | ^ Field ^ Description ^ | ||
| Line 102: | Line 102: | ||
| ==== hg ==== | ==== hg ==== | ||
| - | Dictionary containing values of HG Brewer calibration. The values came from B files or Eubrewnet database through its JSON interface. It contains the following fields: | + | Dictionary containing values of HG Brewer calibration. The values |
| ^ Field ^ Description ^ | ^ Field ^ Description ^ | ||
| Line 109: | Line 109: | ||
| ==== config ==== | ==== config ==== | ||
| - | Dictionary containing values of brewer settings. The values came from B files, ICF or Eubrewnet database through its JSON interface. It contains the following fields: | + | Dictionary containing values of brewer settings. The values |
| ^ Field ^ Description ^ | ^ Field ^ Description ^ | ||
| Line 176: | Line 176: | ||
| ^ Function ^ Short Description ^ | ^ Function ^ Short Description ^ | ||
| ^ [[devel: | ^ [[devel: | ||
| - | ^ [[devel: | + | ^ [[devel: |
| + | ^ [[devel: | ||
| + | ^ [[devel: | ||
| ^ [[devel: | ^ [[devel: | ||
| + | ^ [[devel: | ||
| ^ [[devel: | ^ [[devel: | ||
| ^ [[devel: | ^ [[devel: | ||
| Line 210: | Line 213: | ||
| * //' | * //' | ||
| + | |||
| + | === airmass_calcl() === | ||
| + | |||
| + | This function applies [[devel: | ||
| + | |||
| + | * //' | ||
| + | * //' | ||
| + | |||
| + | **Example** | ||
| + | import datetime | ||
| + | import brewer | ||
| + | import brewerjson | ||
| + | | ||
| + | brewerid=185 | ||
| + | user=' | ||
| + | password=' | ||
| + | date1=datetime.date(2012, | ||
| + | date2=datetime.date(2012, | ||
| + | ds=brewerjson.getDataList(brewerid, | ||
| + | config=brewerjson.getDataList(brewerid, | ||
| + | ds=brewer.airmass_calcl(ds, | ||
| + | |||
| + | | ||
| === 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: | ||
| + | |||
| + | * //' | ||
| + | * //' | ||
| + | |||
| + | **Example** | ||
| + | import datetime | ||
| + | import brewer | ||
| + | import brewerjson | ||
| + | | ||
| + | brewerid=185 | ||
| + | user=' | ||
| + | password=' | ||
| + | date1=datetime.date(2012, | ||
| + | date2=datetime.date(2012, | ||
| + | sl=brewerjson.getDataList(brewerid, | ||
| + | config=brewerjson.getDataList(brewerid, | ||
| + | sl=brewer.instrumental_corl(sl, | ||
| + | |||
| Line 279: | Line 328: | ||
| This function returns the input //measure// dictionary, updating the following fields as described above: //' | This function returns the input //measure// dictionary, updating the following fields as described above: //' | ||
| + | |||
| + | === rayleigh_corl() === | ||
| + | |||
| + | This function applies [[devel: | ||
| + | |||
| + | * //' | ||
| + | * //' | ||
| + | |||
| + | **Example** | ||
| + | import datetime | ||
| + | import brewer | ||
| + | import brewerjson | ||
| + | | ||
| + | brewerid=185 | ||
| + | user=' | ||
| + | password=' | ||
| + | date1=datetime.date(2012, | ||
| + | date2=datetime.date(2012, | ||
| + | ds=brewerjson.getDataList(brewerid, | ||
| + | config=brewerjson.getDataList(brewerid, | ||
| + | | ||
| + | ds=brewer.airmass_calcl(ds, | ||
| + | ds=brewer.instrumental_corl(ds, | ||
| + | ds=brewer.rayleigh_corl(ds, | ||
| + | |||
| === o3_so2() === | === o3_so2() === | ||
| Line 446: | Line 520: | ||
| password=' | password=' | ||
| date1=datetime.date(2012, | date1=datetime.date(2012, | ||
| - | ds=brewerjson.getDataList(brewerid, | + | ds=brewerjson.getDataList(brewerid, |
| | | ||
| dsf = brewer.temp_filter(ds, | dsf = brewer.temp_filter(ds, | ||
| Line 466: | Line 540: | ||
| password=' | password=' | ||
| date1=datetime.date(2012, | date1=datetime.date(2012, | ||
| - | ds=brewerjson.getDataList(brewerid, | + | ds=brewerjson.getDataList(brewerid, |
| | | ||
| dsf=brewer.gmt_filter(ds, | dsf=brewer.gmt_filter(ds, | ||
| Line 488: | Line 562: | ||
| password=' | password=' | ||
| date1=datetime.date(2012, | date1=datetime.date(2012, | ||
| - | ds=brewerjson.getDataList(brewerid, | + | ds=brewerjson.getDataList(brewerid, |
| | | ||
| dsf=brewer.outliers_filter(ds, | dsf=brewer.outliers_filter(ds, | ||
| Line 508: | Line 582: | ||
| password=' | password=' | ||
| date1=datetime.date(2012, | date1=datetime.date(2012, | ||
| - | ds=brewerjson.getDataList(brewerid, | + | ds=brewerjson.getDataList(brewerid, |
| | | ||
| ds=brewer.airmass_calcl(ds, | ds=brewer.airmass_calcl(ds, | ||
| Line 545: | Line 619: | ||
| date1=datetime.date(2012, | date1=datetime.date(2012, | ||
| date2=datetime.date(2012, | date2=datetime.date(2012, | ||
| - | sl=brewerjson.getDataList(brewerid, | + | sl=brewerjson.getDataList(brewerid, |
| - | config=brewerjson.getDataList(brewerid, | + | config=brewerjson.getDataList(brewerid, |
| | | ||
| sl=brewer.instrumental_corl(sl, | sl=brewer.instrumental_corl(sl, | ||
| Line 593: | Line 667: | ||
| date1=datetime.date(2012, | date1=datetime.date(2012, | ||
| date2=datetime.date(2012, | date2=datetime.date(2012, | ||
| - | sl=brewerjson.getDataList(brewerid, | + | sl=brewerjson.getDataList(brewerid, |
| - | config=brewerjson.getDataList(brewerid, | + | config=brewerjson.getDataList(brewerid, |
| | | ||
| ta=tempanalysis(sl, | ta=tempanalysis(sl, | ||
| Line 834: | Line 908: | ||
| ^ Function ^ Short Description ^ | ^ Function ^ Short Description ^ | ||
| ^ [[devel: | ^ [[devel: | ||
| + | ^ [[devel: | ||
| + | ^ [[devel: | ||
| === wsum() === | === wsum() === | ||
| - | This function computes the weighted | + | This function computes the sum of products over two lists. Both input lists should have the same length: |
| \begin{displaymath} | \begin{displaymath} | ||
| Line 845: | Line 920: | ||
| **Example** | **Example** | ||
| + | import brewer | ||
| + | f=[1,2] | ||
| + | w=[2,3] | ||
| brewer.wsum(f, | brewer.wsum(f, | ||
| Line 851: | Line 929: | ||
| The //wsum()// function returns a //float// with the weighted sum value. | The //wsum()// function returns a //float// with the weighted sum value. | ||
| + | === weeknum() === | ||
| + | |||
| + | This function calculate the week number of year. It is based in the matlab function of the same name. | ||
| + | |||
| + | The function accepts three input parameters: | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | |||
| + | **Example** | ||
| + | |||
| + | import brewer | ||
| + | brewer.weeknum(datetime.date(2015, | ||
| + | |||
| + | === weektodate() === | ||
| + | |||
| + | This returns a tuple with the first and last days of acertain week. | ||
| + | |||
| + | The function accepts four input parameters: | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | |||
| + | **Example** | ||
| + | |||
| + | import brewer | ||
| + | brewer.weektodate(2, | ||
devel/brewerpythonmodule.1445588890.txt.gz · Last modified: 2015/10/23 08:28 (external edit)