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/22 10:32]
ajberjon [measure]
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//.+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 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 ​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 came from B files or Eubrewnet database through its JSON interface. 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 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 ​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 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 ​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 390: Line 464:
 ^ [[devel:​brewerpythonmodule#​outliers_filter|outliers_filter()]] | Returns a list of measurements removing outliers. ^ ^ [[devel:​brewerpythonmodule#​outliers_filter|outliers_filter()]] | Returns a list of measurements removing outliers. ^
 ^ [[devel:​brewerpythonmodule#​measure2summary|measure2summary()]] | Returns the summary everaging in a list of measurements. ^ ^ [[devel:​brewerpythonmodule#​measure2summary|measure2summary()]] | Returns the summary everaging in a list of measurements. ^
-^ [[devel:​brewerpythonmodule#​tempfit|tempfit()]] | Finds a linear regression between instrumentally corrected measurements and temperature. ^+^ [[devel:​brewerpythonmodule#​tempfit|tempfit()]] | Returns the linear regression between instrumentally corrected measurements and temperature. ^
 ^ [[devel:​brewerpythonmodule#​tempanalysis|tempanalysis()]] | Compares results for old, new and zero temperature coefficientes. ^ ^ [[devel:​brewerpythonmodule#​tempanalysis|tempanalysis()]] | Compares results for old, new and zero temperature coefficientes. ^
  
Line 435: Line 509:
  
   * //'​mlinput'//​ is a list of measurements ds, sl, etc.   * //'​mlinput'//​ is a list of measurements ds, sl, etc.
- 
   * //'​temp_range'//​ is a list of 0,1 or 2 temperature values (floats). If //'​temp_range'//​ has zero values nothing is done. If it has one temperature value, the function returns the measurements with //'​temp'//​ values greters or equal to //​temp_range[0]//​. If it has two temperature values, the function returns the measurements with //'​temp'//​ values betwen //​temp_range[0]//​ and //​temp_range[1]//​.   * //'​temp_range'//​ is a list of 0,1 or 2 temperature values (floats). If //'​temp_range'//​ has zero values nothing is done. If it has one temperature value, the function returns the measurements with //'​temp'//​ values greters or equal to //​temp_range[0]//​. If it has two temperature values, the function returns the measurements with //'​temp'//​ values betwen //​temp_range[0]//​ and //​temp_range[1]//​.
  
Line 443: Line 516:
     import brewerjson     import brewerjson
     ​     ​
-    ​params = {} +    brewerid=185 
-    params['​brewerid'​] ​= 185 +    user='​user'​ 
-    ​params['​date'​] = datetime.date(2012,​2,​7) +    password='​password'​ 
-    params['​function'​] = '​getDS'​ +    ​date1=datetime.date(2012,2,7
-    params['​user'​] ​= '​user'​ +    ds=brewerjson.getDataList(brewerid,​user,​password,"​DS",​date1)
-    ​params['​password'​] ​= '​password'​ +
-    ​ +
-    ds brewerjson.getdata(params+
-    ds = brewerjson.formatDS(ds)+
     ​     ​
     dsf = brewer.temp_filter(ds,​[20])     dsf = brewer.temp_filter(ds,​[20])
Line 460: Line 529:
  
   * //'​mlinput'//​ is a list of measurements ds, sl, etc.   * //'​mlinput'//​ is a list of measurements ds, sl, etc.
- 
   * //'​gmt_range'//​ is a list of 0, 1, 2 or 4 datetime values. If //'​gmt_range'//​ has zero values nothing is done. If it has one value, the function returns the measurements with //'​gmt'//​ values greter or equal to //​gmt_range[0]//​. If it has two values, the function returns the measurements with //'​gmt'//​ values between //​gmt_range[0]//​ and //​gmt_range[1]//​. If it has four values, the function returns the measurements with //'​gmt'//​ values between the interval //​gmt_range[0]//​ and //​gmt_range[1]//​ or between the interval //​gmt_range[2]//​ and //​gmt_range[3]//​. ​   * //'​gmt_range'//​ is a list of 0, 1, 2 or 4 datetime values. If //'​gmt_range'//​ has zero values nothing is done. If it has one value, the function returns the measurements with //'​gmt'//​ values greter or equal to //​gmt_range[0]//​. If it has two values, the function returns the measurements with //'​gmt'//​ values between //​gmt_range[0]//​ and //​gmt_range[1]//​. If it has four values, the function returns the measurements with //'​gmt'//​ values between the interval //​gmt_range[0]//​ and //​gmt_range[1]//​ or between the interval //​gmt_range[2]//​ and //​gmt_range[3]//​. ​
  
Line 468: Line 536:
     import brewerjson     import brewerjson
     ​     ​
-    ​params = {} +    brewerid=185 
-    params['​brewerid'​] ​= 185 +    user='​user'​ 
-    ​params['​date'​] = datetime.date(2012,​2,​7) +    password='​password'​ 
-    params['​function'​] = '​getDS'​ +    ​date1=datetime.date(2012,2,7
-    params['​user']='​user'​ +    ds=brewerjson.getDataList(brewerid,​user,​password,"​DS",​date1)
-    ​params['​password']='​password'​ +
-    ​ +
-    ds brewerjson.getdata(params+
-    ds = brewerjson.formatDS(ds)+
     ​     ​
     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 485: Line 549:
 This function returns a filtered list of measurements removing outliers. It is considered as outliers all measurement which are more than //alpha// standard deviations away from the mean on either channel (//'​raw_counts_w0'//,​...,//'​raw_counts_w5'//​). This function returns a filtered list of measurements removing outliers. It is considered as outliers all measurement which are more than //alpha// standard deviations away from the mean on either channel (//'​raw_counts_w0'//,​...,//'​raw_counts_w5'//​).
  
-The function accepts two input parameters: ​//'​mlinput'//​ and //'​alpha'//,​ where //'​mlinput'//​ is a list of measurements ds, sl, etc., and //'​alpha'//​ is a float number. By default //'​alpha'//​ value is 3.+The function accepts two input parameters: ​ 
 +  * //'​mlinput'//​ is a list of measurements ds, sl, etc. 
 +  * //'​alpha'//​ is a float number. By default //'​alpha'//​ value is 3.
  
 **Example** **Example**
Line 492: Line 558:
     import brewerjson     import brewerjson
     ​     ​
-    ​params = {} +    brewerid=185 
-    params['​brewerid'​] ​= 185 +    user='​user'​ 
-    ​params['​date'​] = datetime.date(2012,​2,​7) +    password='​password'​ 
-    params['​function'​] = '​getDS'​ +    ​date1=datetime.date(2012,2,7
-    params['​user']='​user'​ +    ds=brewerjson.getDataList(brewerid,​user,​password,"​DS",​date1)
-    ​params['​password']='​password'​ +
-    ​ +
-    ds brewerjson.getdata(params+
-    ds = brewerjson.formatDS(ds)+
     ​     ​
     dsf=brewer.outliers_filter(ds,​3)     dsf=brewer.outliers_filter(ds,​3)
 +
 +=== measure2summary() ===
 +
 +This function returns a list of averaged measurements to reproduce the brewer summaries from individual data, using //'​n_summary'//​ to group the measurements.
 +
 +The function accepts only an input parameters:
 +  * //'​meslist'//​ is a list of measurements ds, sl, etc.
 +
 +**Example**
 +    import datetime
 +    import brewer
 +    import brewerjson
 +    ​
 +    brewerid=185
 +    user='​user'​
 +    password='​password'​
 +    date1=datetime.date(2012,​2,​7)
 +    ds=brewerjson.getDataList(brewerid,​user,​password,"​DS",​date1)
 +    ​
 +    ds=brewer.airmass_calcl(ds,​config)
 +    ds=brewer.instrumental_corl(ds,​config)
 +    ds=brewer.rayleigh_corl(ds,​config)
 +    dss=brewer.measure2summary(ds)
 +
 +
 +
 +=== tempfit() ===
 +
 +This function does 8 linear regressions between instrumentally corrected measurements (//'​measure_w0'//,​...,//'​measure_w5'//,//'​double_ratio1'//​ and //'​double_ratio2'//​) and temperature. ​
 +
 +The function accepts two input parameters: ​
 +
 +  * //'​mlinput'//​ is a list of instrumentally corrected measurements ds, sl, etc.
 +  * //'​alpha'//​ is a float number used to remove outliers during linear fit. After a first linear regression, residuals are calculated and removed all measurement which residuals are more than //alpha// times the standard deviation of the residuals. The process is repeated until no outlier is removed. By default //'​alpha'//​ value is 0 and no iteration is done.
 +
 +//tempfit// function returns a dictionary with 8 elements '​w0',​ 'w1 ","​ w2 ","​ w3 ","​ w4 ","​ w5 ","​ R5 "​and"​ R6', each containing the values of a (slope), sa (standard deviation of a), b (intercept),​ sb (standard deviation of b), r2 and res (residual list) of the 8 linear regression. In addition the following data is returned:
 +
 +  * //'​tmax'//​ = maximum temperature
 +  * //'​tmin'//​ = minimum temperature
 +  * //'​tnum'//​ = number of different temperature values
 +  * //'​olnum'//​ = number of outlayers
 +  * //'​itnum'//​ = number of iterations performed (if alpha > 0 the linear adjustments are repeated until no outlayers)
 +  * //'​measure'//​ = data used in the linear fit after eliminating the aoutlayers.
 +
 +**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)
 +    fit=brewer.tempfit(sl,​alpha=3)
 +
 +
 +=== tempanalysis() ===
 +
 +This function calculate new temperature coefficients or apply the temperature coefficients passed as function parameters. It calculate data for '​old',​ '​zero'​ and '​new'​ temperature coefficients. The output of the //​tempanalysis()//​ function is a dictionary which includes:
 +
 +  * //'​old'//​ is a dictionay with data from temperature fit when old temperature coefficients are applied
 +  * //'​zero'//​ is a dictionay with data from temperature fit when zero temperature coefficients are applied
 +  * //'​new'//​ is a dictionay with data from temperature fit when new calculated temperature coefficients or passed as function parameter are applied.
 +  * //'​F1avg'//​ is a list with the daily average of the first channel raw intensity for the first channel (//'​raw_counts_w1'//​)
 +  * //'​F1mean'//​ is the average of the daily values //'​F1avg'//​
 +  * //'​F1std'//​ is the standard deviation of the daily values //'​F1avg'//​
 +  * //'​R5conf'//​ is alist with the refence values for R5 in the config data
 +  * //'​R6conf'//​ is alist with the refence values for R6 in the config data
 +
 +Each element old, new and zero is a dictionary which includes:
 +  * //'​tcoef'//​ is a list of temperature coefficients
 +  * //'​fit'//​ is a dictionary with information of temperature fit (output of //​tempfit()//​ function)
 +  * //'​measure'//​ is a dictionary with the data used for the temperature fit
 +  * //'​config'//​ is a dictionary with the config data used for the temperature fit
 +  * //'​R5avg'//​ is a list with the daily average of the //'​double_ratio1'//​ when the correspondig temeprature coefficients are applied
 +  * //'​R5mean'//​ is the average of the daily values //'​R5avg'//​
 +  * //'​R5std'//​ is the standard deviation of the daily values //'​R5avg'//​
 +  * //'​R6avg'//​ is a list with the daily average of the //'​double_ratio2'//​ when the correspondig temeprature coefficients are applied
 +  * //'​R6mean'//​ is the average of the daily values //'​R5avg'//​
 +  * //'​R6std'//​ is the standard deviation of the daily values //'​R5avg'//​
 +
 +The function accepts four input parameters: ​
 +  * //'​slinput'//​ is a list of dictionaries with SL measurements
 +  * //'​configinput'//​ is a list of dictionaries with brewer configurations
 +  * //'​ntc'//​ is a list of //new// temperature coefficients. If //ntc//=[], the function calculates the //new// temperature coefficients.
 +  * //'​alpha'//​ is a float to set the outlayer filter in tempfit function
 +
 +**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)
 +    ​
 +    ta=tempanalysis(sl,​config,​[],​0)
 +    ta.keys()
  
 ==== Astronomical ==== ==== Astronomical ====
Line 739: Line 908:
 ^ Function ^ Short Description ^ ^ Function ^ Short Description ^
 ^ [[devel:​brewerpythonmodule#​wsum|wsum()]] | Returns the weighted sum from all measurements on a list. ^ ^ [[devel:​brewerpythonmodule#​wsum|wsum()]] | Returns the weighted sum from all measurements on a list. ^
 +^ [[devel:​brewerpythonmodule#​weeknum|weeknum()]] | Returns the weighted sum from all measurements on a list. ^ 
 +^ [[devel:​brewerpythonmodule#​weektodate|weektodate()]] | Returns the weighted sum from all measurements on a list. ^
  
 === wsum() === === wsum() ===
  
-This function computes the weighted ​sum from all measurements on a list. Both input lists, measurements and weights, ​should have the same length:+This function computes the sum of products over two lists. Both input lists should have the same length:
  
 \begin{displaymath} \begin{displaymath}
Line 750: Line 920:
  
 **Example** **Example**
 +    import brewer
 +    f=[1,2]
 +    w=[2,3]
     brewer.wsum(f,​w)     brewer.wsum(f,​w)
  
Line 756: 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: ​
 +  * //'​d'//​ is a date
 +  * //'​w'//​ is an integer repressenting the week start value (Sunday:1, Monday:2, Tuesday:3, Wednesday:​4,​ Thursday:5, Friday:6, Saturday:7)
 +  * //'​e'//​ is a bool to use or not use European standard
 +
 +**Example**
 +
 +    import brewer
 +    brewer.weeknum(datetime.date(2015,​1,​5),​1,​False)
 +
 +=== weektodate() ===
 +
 +This returns a tuple with the first and last days of acertain week.
 +
 +The function accepts four input parameters: ​
 +  * //'​n'//​ is an integer representing the week number
 +  * //'​yrs'//​ is an integer representing the year
 +  * //'​w'//​ is an integer repressenting the week start value (Sunday:1, Monday:2, Tuesday:3, Wednesday:​4,​ Thursday:5, Friday:6, Saturday:7)
 +  * //'​e'//​ is a bool to use or not use European standar
 +
 +**Example**
 +
 +    import brewer
 +    brewer.weektodate(2,​2015,​1,​False)
  
devel/brewerpythonmodule.1445509932.txt.gz · Last modified: 2015/10/22 10:32 by ajberjon