devel:brewerpythonmodule
Differences
This shows you the differences between two versions of the page.
| devel:brewerpythonmodule [2015/10/22 11:51] – [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 442: | Line 516: | ||
| import brewerjson | import brewerjson | ||
| | | ||
| - | | + | |
| + | user=' | ||
| + | password=' | ||
| + | date1=datetime.date(2012, | ||
| + | ds=brewerjson.getDataList(brewerid, | ||
| + | | ||
| dsf = brewer.temp_filter(ds, | dsf = brewer.temp_filter(ds, | ||
| Line 457: | Line 536: | ||
| import brewerjson | import brewerjson | ||
| | | ||
| - | | + | |
| + | user=' | ||
| + | password=' | ||
| + | date1=datetime.date(2012, | ||
| + | ds=brewerjson.getDataList(brewerid, | ||
| + | | ||
| dsf=brewer.gmt_filter(ds, | dsf=brewer.gmt_filter(ds, | ||
| Line 474: | Line 558: | ||
| import brewerjson | import brewerjson | ||
| | | ||
| - | | + | |
| + | user=' | ||
| + | password=' | ||
| + | date1=datetime.date(2012, | ||
| + | ds=brewerjson.getDataList(brewerid, | ||
| + | | ||
| dsf=brewer.outliers_filter(ds, | dsf=brewer.outliers_filter(ds, | ||
| Line 489: | Line 578: | ||
| import brewerjson | import brewerjson | ||
| | | ||
| - | | + | |
| - | | + | user=' |
| + | password=' | ||
| + | date1=datetime.date(2012, | ||
| + | | ||
| | | ||
| ds=brewer.airmass_calcl(ds, | ds=brewer.airmass_calcl(ds, | ||
| Line 522: | Line 614: | ||
| import brewerjson | import brewerjson | ||
| | | ||
| - | | + | |
| - | | + | user=' |
| + | password=' | ||
| + | date1=datetime.date(2012,2,7) | ||
| + | date2=datetime.date(2012, | ||
| + | | ||
| + | config=brewerjson.getDataList(brewerid,user,password," | ||
| | | ||
| sl=brewer.instrumental_corl(sl, | sl=brewer.instrumental_corl(sl, | ||
| fit=brewer.tempfit(sl, | fit=brewer.tempfit(sl, | ||
| + | |||
| + | |||
| + | === tempanalysis() === | ||
| + | |||
| + | This function calculate new temperature coefficients or apply the temperature coefficients passed as function parameters. It calculate data for ' | ||
| + | |||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | |||
| + | Each element old, new and zero is a dictionary which includes: | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | |||
| + | The function accepts four input parameters: | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | * //' | ||
| + | |||
| + | **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, | ||
| + | | ||
| + | ta=tempanalysis(sl, | ||
| + | ta.keys() | ||
| ==== Astronomical ==== | ==== Astronomical ==== | ||
| Line 763: | 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 774: | Line 920: | ||
| **Example** | **Example** | ||
| + | import brewer | ||
| + | f=[1,2] | ||
| + | w=[2,3] | ||
| brewer.wsum(f, | brewer.wsum(f, | ||
| Line 780: | 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.1445514685.txt.gz · Last modified: 2015/10/22 11:51 by ajberjon