User Tools

Site Tools


codes:dbaccess

ACCESS FUNCTIONS

Definition of the access functions that are developed in Eubrewnet

The users with the right permissions have access to some functions to directly get the information stored in the database. The root of the access functions is the same for all http://eubrewnet.aemet.es/eubrewnet/data/. From this point users can select different function. As Example Get DS.

The DS database access function provides the Direct Sun individual measures enhanced by information from their summaries and if they are between correct Mercury Lamp Tests.

Description of the DS Get Function:

  • Function: DS
  • Description: Get the Direct Sun individual measures. Gives extra information from the summaries as the temperature or the double ratios and set a flag for mercury (hg_test) if the measure is between two correct mercury tests with a difference of 1 or less from the reference.
  • Inputs:
    1. format: see Format
  • Output: Direct Sun individual measures with extra values comming from:
    1. Summary: temp (temperature), zenith_angle, airmass, double_ratio1, double_ratio2
    2. B file: date (in ISO 8601 format)
    3. HG measures: hg_test (0: measures is not between two correct HG tests; 1: measure between two correct HG tests)

There is a Get Function Table with a summary of the available functions to access stored data and their links as example. The extended documentation for each function can be directly access from the table using the links in the column Long Description.

For products, the Eubrewnet provides an interface for processing by demand. The Process Function Table gives a summary of the available process functions. Even the data providers can force a process and database stored data update using the update interface. The Update Function Table sumarizes the available functions. Providers can force only the update of the products of their Brewers.

There are some common inputs for the functions as the parameter format or the list of common inputs (as the brewerid and dates) wich can be used in almost every function. The description can be found in the COMMON SECTION.

Examples of the use of the functions are provided for Matlab 2013A, Matlab 2015A and Python in the EXAMPLE SECTION.

For security purposes user authentication has been added to this tools and their use is registered.


COMMON

Format

The access functions provide four different ways of data access using the format input parameter.

Format input Description Example
jsonM JSON matrix formed by lists of lists (default value). The first list is formed by the value names and the following lists are the query outputs Get DS by default
jsonO JSON object of lists, where each key is the value name and its value is the time sorted list of them Get DS with jsonO format
text Human readable comma separated values where first row is the value names and the following are the query outputs Get DS with text format
csv CSV direct download where first row are the value names and the following are the query outputs Get DS with text format

Common Inputs

Almost all functions receive the following inputs, too:

Parameter Description Example
brewerid Brewer identification number Get function with brewerid input parameter
date Date in YYYY-MM-DD format Get function with date input parameter
enddate Date in YYYY-MM-DD format. If provided, the function will return the query in a date range Get function with enddate input parameter

Examples of connections in matlab and python are provided for understanding.


Means

For the O3L1_0, O3L1_5, and AODL1_5 functions, passing the &means=xk variable in the URL will return the mean of all the output fields in the period specified by xk, where x is a number and k is any of min, h (hours), d (days), or M (months). The output includes two extra fields, stats_nobs, with the number of measurements which have been used to calculate the mean, and stats_std_o3 with the standard deviation of the ozone over the specified period. Examples:


GET FUNCTIONS

Function Short Description Long Description Link
DS Returns DS measures DS Get DS
DSS Returns the DS summaries DSS Get DSS
ZS Returns ZS measures ZS Get ZS
ZSS Returns the ZS summaries ZSS Get ZSS
FM Returns FM measures FM Get FM
FMS Returns the FM summaries FMS Get FMS
SL Returns SL measures SL Get SL
SLS Returns the SL summaries SLS Get SLS
ConfigbyDate Returns the available Configuration ConfigbyDate Get Config by Date
HG Returns the mercury lamp tests HG Get HG
HP Returns the grating synchronisation tests HP Get HP
FV Returns the FV tests FV Get FV
BFV Returns the FV tests (from B file) BFV Get BFV
AP Returns the AP tests (from B file) AP Get AP
SC Returns the SC tests (from B file) SC Get SC
SCO3 Same as SC with additional information (O3, ms9, longitude, …); also, a specific micrometer step can be selected using &step=XXX SC Get SCO3
BHeader Returns the B File Header with INST values BHeader Get BHeader
DTO3 Returns the DTO3 tests (from B file) DTO3 Get DTO3
RSO3 Returns the RSO3 tests (from B file) RSO3 Get RSO3
ActiveBrewers Returns the number of Brewers whith at least one SL test by dates HG Get HG
FileStatus Returns the status of the received files FileStatus Get FileStatus
ActiveBrewers Returns the number of Active Brewers ActiveBrewers Get ActiveBrewers
Umkehr Returns the Umkehr measures Umkehr Get Umkehr
BfilesbyLocation Returns the Available B files for a range of locations BfilesbyLocation Get Bfiles by Location
BrewerLocation Returns the changes in location of a Brewer BrewerLocation Get Brewer Location
AVG Returns the available AVG measures AVG Get AVG
O3L1 Returns the Level 1 of Ozone O3L1 Get O3L1
O3L1_5 Returns the Level 1.5 of Ozone O3L1_5 Get O3L1_5
O3L2_0 Returns the Level 2.0 of Ozone O3L2_0 Get O3L2_0
O3L1ZS Returns the Level 1 of the Zenith Sky Ozone O3L1ZS Get O3ZS
O3L1_5ZS Returns the Level 1.5 of the Zenith Sky Ozone O3L1_5ZS Get O3L1_5ZS
O3L2_0ZS Returns the Level 2.0 of the Zenith Sky Ozone O3L2_0ZS Get O3L2_0ZS
AODL1_5 Returns the Aerosol Optical Depth Level 1.5 product AODL1_5 Get AODL1_5

Descriptions

DS

  • Function: DS
  • Description: Get the Direct Sun individual measures. Gives extra information from the summaries as the temperature or the double ratios and set a flag for mercury (hg_test) if the measure is between two correct mercury tests with a difference of 1 or less from the reference.
  • Inputs:
    1. format: see Format
  • Output: Direct Sun individual measures with extra values comming from:
    1. Summary: temp (temperature), zenith_angle, airmass, double_ratio1, double_ratio2
    2. B file: date (in ISO 8601 format)
    3. HG measures: hg_test (0: measures is not between two correct HG tests; 1: measure between two correct HG tests)

DSS

  • Function: DSS
  • Description: Get the Direct Sun Summary measures. Set a flag for mercury (hg_test) if the measure is between two correct mercury tests with a difference of 1 or less from the reference.
  • Inputs:
    1. format: see Format
  • Output: Direct Sun Summary measures with extra value coming fromm:
    1. HG measures: hg_test (0: measures is not between two correct HG tests; 1: measure between two correct HG tests)

ZS

  • Function: ZS
  • Description: Get the Zenith Sky individual measures. Gives extra information from the summaries as the temperature or the double ratios and set a flag for mercury (hg_test) if the measure is between two correct mercury tests with a difference of 1 or less from the reference.
  • Inputs:
    1. format: see Format
  • Output: Zenith Sky individual measures with extra values comming from:
    1. Summary: temp (temperature), zenith_angle, airmass, double_ratio1, double_ratio2
    2. B file: date (in ISO 8601 format)
    3. HG measures: hg_test (0: measures is not between two correct HG tests; 1: measure between two correct HG tests)

ZSS

  • Function: ZSS
  • Description: Get the Zenith Sky Summary measures. Set a flag for mercury (hg_test) if the measure is between two correct mercury tests with a difference of 1 or less from the reference.
  • Inputs:
    1. format: see Format
  • Output: Zenith Sky Summary measures with extra value coming fromm:
    1. HG measures: hg_test (0: measures is not between two correct HG tests; 1: measure between two correct HG tests)

FM

  • Function: FM
  • Description: Get the Focused Moon individual measures. Gives extra information from the summaries as the temperature or the double ratios and set a flag for mercury (hg_test) if the measure is between two correct mercury tests with a difference of 1 or less from the reference.
  • Inputs:
    1. format: see Format
  • Output: Focused Moon individual measures with extra values comming from:
    1. Summary: temp (temperature), zenith_angle, airmass, double_ratio1, double_ratio2
    2. B file: date (in ISO 8601 format)
    3. HG measures: hg_test (0: measures is not between two correct HG tests; 1: measure between two correct HG tests)

FMS

  • Function: FMS
  • Description: Get the Focused Moon Summary measures. Set a flag for mercury (hg_test) if the measure is between two correct mercury tests with a difference of 1 or less from the reference.
  • Inputs:
    1. format: see Format
  • Output: Focused Moon Summary measures with extra value coming fromm:
    1. HG measures: hg_test (0: measures is not between two correct HG tests; 1: measure between two correct HG tests)

SL

  • Function: SL
  • Description: Get the Standard Lamp individual measures. Gives extra information from the summaries as the temperature or the double ratios.
  • Inputs:
    1. format: see Format
  • Output: Zenith Sky individual measures with extra values comming from:
    1. Summary: temp (temperature), zenith_angle, airmass, double_ratio1, double_ratio2

SLS


ConfigbyDate

  • Function: ConfigbyDate
  • Description: Returns the latest operative configuration (see configuration info) with earlier date than given as input. If a date range is provided, returns the list of available configuration during the date range.
  • Inputs:
    1. format: see Format
  • Output: Configuration or list of configurations

HP


HG

  • Function: HG
  • Description: Returns Mercury Tests with a mercury flag (hg_test) which sets if its a passed mercury test or not
  • Inputs:
    1. format: see Format
  • Output: Mercury tests with extra value:
    1. hg_test (0: measures is not between two correct HG tests; 1: measure between two correct HG tests)

FV


BFV


AP


SC


BHeader

  • Function: BHeader
  • Description: Returns B File Header. Values like date of B file, latitude, longitude and pressure and the content of the used ICF file
  • Inputs:
    1. format: see Format
  • Output: Inst section from B file with extra fields. All of them from the B file:
    1. brewerid
    2. date
    3. location
    4. latitude
    5. longitude
    6. temp
    7. press

DTO3


RSO3


FileStatus

  • Function: FileStatus
  • Description: Give the status after parsing of a file. Users can look for files for a Brewer between a range of dates or directly look for the information of a specific file.
  • Inputs:
    1. format: see Format
    2. file: name of the file to see STATUS
  • Outputs: File status information as:
    1. date: date of the file
    2. status: error status of the Brewer (0: No error)
    3. path: where to find the file
    4. fname: name of the file
    5. process_date, process_time: timestamp of the parsing
    6. kind: kind of the file
    7. text: messages thrown while file parsing

AVG

Get O3L1

In Products Description Ozone Level 1 there is a summary table with product content


Get O3L1_5

  • Function: O3L1_5
  • Description: Give the processed Ozone calculated using standard Algorithm and Direct Sun Measures. The Standard Lamp corrections, ETC by filter and Straylight corrections. The measures are filtered by standard deviation, max airmass, correct mercury test, maximun and mininum values. The Operators have to upload configurations for calculation. See Ozone Level Definition and Configuration Upload Instructions
  • Inputs:
    1. format: see Format
    2. means: see means
  • Outputs: Ozone calculated from the DS raw counts using standard algorithm from Brewer Python Library. Measurements have been enhanced with info from:
    1. Filter flag
    2. Correction flag
    3. r5, r6 and their references

In Products Description Ozone Level 1.5 there is a summary table with product content


Get O3L2_0

  • Function: O3L2_0
  • Description: Give the processed Ozone calculated using standard Algorithm and Direct Sun Measures. The Standard Lamp corrections, ETC by filter and Straylight corrections. The measures are filtered by standard deviation, max airmass, correct mercury test, maximun and mininum values. The Operators have to upload configurations for calculation. See Ozone Level Definition and Configuration Upload Instructions. The Level 2.0 is available only for validated Configurations.
  • Inputs:
    1. format: see Format
    2. debug: change the ouput to see the corrections that are being applied. (True)
    3. rejected: returns the filtered data, too (True)
  • Outputs: Ozone calculated from the DS raw counts using standard algorithm from Brewer Python Library. Measurements have been enhanced with info from:
    1. Filter flag
    2. Correction flag
    3. r5, r6 and their references
  • Outputs in case that the debug input is set, the output will contain:
    1. date index, solar zenith angle, airmass, temperature, filter
    2. o3, o3 sl correction, o3 etc correction by slit, o3 straylight correction,
    3. r6, r6 of reference, filter flag, correction flag

In Products Description Ozone Level 2.0 there is a summary table with product content


Get O3L1ZS, O3L1_5ZS, and O3L2_0ZS

  • Functions: O3L1ZS, O3L1_5ZS, and O3L2_0ZS
  • Description: These functions provide the same output as the O3L1, O3L1_5, and O3L2_0 described above, but for the Zenith Sky measurement. Note that the 9 empirical Zenith Sky constants must be defined in the Brewer configuration.
  • Input: same as the O3L1, O3L1_5, and O3L2_0 functions
  • Output: same as the O3L1, O3L1_5, and O3L2_0 functions

Get AODL1_5

  • Function: AODL1_5
  • Description: returns Aerosol Optical Depth summaries for the wavelengths considered – as of October 2020, counts are taken from DS measurements so the AOD is calculated for the six wavelengths at approx. 303, 306, 310, 313, 317, and 320 nm, provided a calibration exists for each of them. For the the Ozone contribution to the AOD, the O3L1.5 data is used. For full details of the AOD determination, see J. López-Solano et al., Atmos. Chem. Phys. 18, 3885–3902 (2018). An operative AOD configuration must be available for the requested period.
  • Input:
    1. format: see Format
    2. means: see means
  • Output: the following AOD-specific fields are included in the standard output alongside the other usual ones (Brewer ID, pressure, sza, …):
    1. aodconfigid: ID of the AOD configuration used in the calculation
    2. aodconfigdate: date of the AOD configuration used in the calculation
    3. wavelengths_i: wavelength i, in nm. As of October 2020, counts are taken from DS measurements so the AOD is calculated for the six wavelengths at approx. 303, 306, 310, 313, 317, and 320 nm
    4. aod_i: AOD for the wavelength i
    5. std_aod_i: standard deviation of the AOD summaries at wavelength i

Note: the airmass field corresponds to the aerosol airmass, which is currently approximated by the Rayleigh airmass.


Get O3L1byStation, O3L1_5byStation, and O3L2_0byStation


Get AODL1_5byStation


Get uvscans


Get compareuvtimes

  • Function: compareuvtimes
  • Description: This function lists the UV scans available in Eubrewnet in a date range, for two input Brewers.
  • Input:
    1. brewerid: this is the ID of the reference Brewer. This follows the format described in Brewerid in common inputs
    2. compid: this is the ID of the Brewer which is being compared to the reference Brewer
    3. format: see Format
    4. scans: a comma-separated list of UV scan types to list. If ommited, defaults to ux,ua,uv
    5. maxminutes: maximum difference between the scans of the two Brewers. If omitted, it defaults to 5 minutes
  • Output: besides the usual output, the following UV-specific fields are provided:
    1. scan and compscan: type of UV-scan (ua, ux, uv) of the two Brewers
    2. mmmm and compmmmm: decimal minutes from 00:00 to the start of the UV scan for the two Brewers
    3. deltaminutes: diference in decimal minutes between the starting times of the two UV scans

Get compareuv

  • Function: compareuv
  • Description: This function lists the irradiance ratios in a date range, for two input Brewers.
  • Input:
    1. brewerid: this is the ID of the reference Brewer. This follows the format described in Brewerid in common inputs
    2. compid: this is the ID of the Brewer which is being compared to the reference Brewer
    3. format: see Format
    4. scans: a comma-separated list of UV scan types to list. If ommited, defaults to ux,ua,uv
    5. maxminutes: maximum difference between the scans of the two Brewers. If omitted, it defaults to 5 minutes
    6. level: UV product level used to calculate the irradiances. If omitted, defaults to level 1
  • Output: besides the usual output, the following UV-specific fields are provided:
    1. scan and compscan: type of UV-scan (ua, ux, uv) of the two Brewers
    2. mmmm and compmmmm: decimal minutes from 00:00 to the start of the UV scan for the two Brewers
    3. deltaminutes: diference in decimal minutes between the starting times of the two UV scans
    4. ratio_l: where l=2865, 2870, …, 3630: ratio of compared to reference irradiances at the l wavelength


PROCESS FUNCTIONS

O3L1 Returns the Level 1 of Ozone O3L1 Process O3L1
O3L1_5 Returns the Level 1.5 of Ozone O3L1_5 Process O3L1_5
O3L2_0 Returns the Level 2.0 of Ozone O3L2_0 Process O3L2_0
AODL1_5 Returns Level 1.5 AOD AODL1_5 Process AODL1_5
TempCoef Returns SL Temperature analysis TempCoef Process TempCoef

Process O3L1

In Products Description Ozone Level 1 there is a summary table with product content


Process O3L1_5

  • Function: O3L1_5
  • Description: Process Ozone calculated using standard Algorithm and Direct Sun Measures. The Standard Lamp corrections, ETC by filter and Straylight corrections. The measures are filtered by standard deviation, max airmass, correct mercury test, maximun and mininum values. The Operators have to upload configurations for calculation. See Ozone Level Definition and Configuration Upload Instructions
  • Inputs:
    1. format: see Format
    2. debug: change the ouput to see the corrections that are being applied. (True)
    3. rejected: returns the filtered data, too (True)
  • Outputs: Ozone calculated from the DS raw counts using standard algorithm from Brewer Python Library. Measurements have been enhanced with info from:
    1. Filter flag
    2. Correction flag
    3. r5, r6 and their references
  • Outputs in case that the debug input is set, the output will contain:
    1. date index, solar zenith angle, airmass, temperature, filter
    2. o3, o3 sl correction, o3 etc correction by slit, o3 straylight correction,
    3. r6, r6 of reference, filter flag, correction flag

In Products Description Ozone Level 1.5 there is a summary table with product content


Process O3L2_0

  • Function: O3L2_0
  • Description: Process Ozone calculated using standard Algorithm and Direct Sun Measures. The Standard Lamp corrections, ETC by filter and Straylight corrections. The measures are filtered by standard deviation, max airmass, correct mercury test, maximun and mininum values. The Operators have to upload configurations for calculation. See Ozone Level Definition and Configuration Upload Instructions. The Level 2.0 is available only for validated Configurations.
  • Inputs:
    1. format: see Format
    2. debug: change the ouput to see the corrections that are being applied. (True)
    3. rejected: returns the filtered data, too (True)
  • Outputs: Ozone calculated from the DS raw counts using standard algorithm from Brewer Python Library. Measurements have been enhanced with info from:
    1. Filter flag
    2. Correction flag
    3. r5, r6 and their references
  • Outputs in case that the debug input is set, the output will contain:
    1. date index, solar zenith angle, airmass, temperature, filter
    2. o3, o3 sl correction, o3 etc correction by slit, o3 straylight correction,
    3. r6, r6 of reference, filter flag, correction flag

In Products Description Ozone Level 2.0 there is a summary table with product content


Process AODL1_5

  • Function: AODL1_5
  • Description: returns Aerosol Optical Depth summaries for the wavelengths considered – as of October 2020, counts are taken from DS measurements so the AOD is calculated for the six wavelengths at approx. 303, 306, 310, 313, 317, and 320 nm, provided a calibration exists for each of them. For the the Ozone contribution to the AOD, the O3L1.5 data is used. For full details of the AOD determination, see J. López-Solano et al., Atmos. Chem. Phys. 18, 3885–3902 (2018). An operative AOD configuration must be available for the requested period.
  • Input:
    1. format: see Format
    2. debug: returns additional information, including separate contributions to the AOD from the Ozone, Rayleigh, and counts.
    3. rejected: returns all the individual measurements, including those rejected. As in the case of Ozone, the cause for rejection is coded in the aod_filter_flag fields – the values are analogue to those of the Ozone filter_flag: see the table below
    4. showerrors: displays errors found during the calculation.
    5. means: see means
  • Output: the following AOD-specific fields are included in the standard output alongside the other usual ones (Brewer ID, pressure, sza, …):
    1. aodconfigid: ID of the AOD configuration used in the calculation
    2. aodconfigdate: date of the AOD configuration used in the calculation
    3. wavelengths_i: wavelength i, in nm. As of October 2020, counts are taken from DS measurements so the AOD is calculated for the six wavelengths at approx. 303, 306, 310, 313, 317, and 320 nm
    4. aod_i: AOD for the wavelength i
    5. std_aod_i: standard deviation of the AOD summaries at wavelength i
Flag name Flag value Description
FLAG_AOD_STD_FILT 1 The standard deviation of the AOD summaries is > 0.02
FLAG_AOD_AIRMASS_FILT 2 The airmass is larger than some threshold value (Nov 2020: not in use yet)
FLAG_AOD_MIN_FILT 8 AOD < 0
FLAG_AOD_MAX_FILT 16 AOD > 4
FLAG_AOD_BLACKLIST 32 Date in the exclusion list
FLAG_AOD_BAD_OZONE_FILT 64 The ozone data does not have a filter_flag of 0

Process UVL1

  • Function: UVL1
  • Description: converts the raw counts measured by the Brewer to irradiances (in W/m2/nm) using the operative UV response. An operative UV configuration with the UV response must be available for the requested period.
  • Input:
    1. format: see Format
    2. means: see means
  • Output: the following UV-specific fields are included in the standard output alongside the other usual ones (Brewer ID, config_date, config_id, pressure, …):
    1. mmmm: decimal minutes from 00:00 to the start of the UV scan
    2. scan: type of UV scan performed (uv, ux, ua, …)
    3. irr_l, where l=2865, 2870, …, 3630: irradiance at the l wavelength, in W/m2/nm
    4. mmmm_l: decimal minute from 00:00 at which the measurement at the l wavelength started
    5. duv and duv_cost: erythema-weighted UV irradiances, using the same method as in the standard Brewer software, and the method proposed during COST Action ES1207 (EUBREWNET)
    6. uvi and uvi_cost: UV indexes calculated as duv/25 and duv_cost/25
    7. correction_flag: binary flag with the corrections applied. In the level 1 UV product, only the straylight correction for non MK III Brewers is applied. The complete list of corrections and their flag values are listed in the next table.
Flag name Flag value Description
FLAG_UV_STRAYLIGHT_COR 1 Straylight correction for non MK III Brewers has been applied in UVL1
FLAG_UV_SPIKES_COR 2 Spike correction has been applied UVL1_5
FLAG_UV_TEMPERATURE_COR 4 Temperature correction has been applied in UVL1_5
FLAG_UV_SHICRIVM_INSTR 8 Instrumental irradiances calculated with SHICRIVM
FLAG_UV_COSINE_CLEARSKY_COR 16 Cosine correction in clear-sky conditions has been applied in UVL2
FLAG_UV_COSINE_DIFFUSE_COR 32 Cosine correction in cloudy conditions has been applied in UVL2

Process UVL1_5

  • Function: UVL1_5
  • Description: Starting from the level 1 UV product, spike and temperature corrections are applied to the irradiances. The spike correction is always applied if needed. An operative UV configuration with the Temperature correction data must be available for the requested period. Output data is further filtered by the UV Exclusion List
  • Input:
    1. format: see Format
    2. means: see means
  • Output: the following UV-specific fields are included in the standard output alongside the other usual ones (Brewer ID, config_date, config_id, pressure, …):
    1. mmmm: decimal minutes from 00:00 to the start of the UV scan
    2. scan: type of UV scan performed (uv, ux, ua, …)
    3. irr_l, where l=2865, 2870, …, 3630: irradiance at the l wavelength, in W/m2/nm
    4. mmmm_l: decimal minute from 00:00 at which the measurement at the l wavelength started
    5. duv and duv_cost: erythema-weighted UV irradiances, using the same method as in the standard Brewer software, and the method proposed during COST Action ES1207 (EUBREWNET)
    6. uvi and uvi_cost: UV indexes calculated as duv/25 and duv_cost/25, respectively
    7. correction_flag: binary flag with the corrections applied. In the level 1.5 UV product, the spike and temperature correction may be applied. For the complete list of corrections and their values, see here

Process UVL1_6

  • Function: UVL1_6
  • Description: Starting from the level 1.5 UV product, process the data using SHICRIVM. As of 2022-06-22, the output irradiances are calculated using the same generic slit function for all Brewer instruments. Output data is further filtered by SHICRIVM's QA/QC, retaining only measurements with GREEN and YELLOW flags.
  • Input:
    1. format: see Format
    2. means: see means
  • Output: the following UV-specific fields are included in the standard output alongside the other usual ones (Brewer ID, config_date, config_id, pressure, …):
    1. mmmm: decimal minutes from 00:00 to the start of the UV scan
    2. scan: type of UV scan performed (uv, ux, ua, …)
    3. irr_l, where l=2865, 2870, …, 3630: irradiance at the l wavelength, in W/m2/nm. Corresponds to the Irr instr output of SHICRIVM.
    4. shift_l: wavelength shifts calculated by SHICRIVM
    5. mmmm_l: decimal minute from 00:00 at which the measurement at the l wavelength started
    6. duv and duv_cost: erythema-weighted UV irradiances, using the same method as in the standard Brewer software, and the method proposed during COST Action ES1207 (EUBREWNET)
    7. uvi and uvi_cost: UV indexes calculated as duv/25 and duv_cost/25, respectively
    8. correction_flag: binary flag with the corrections applied. For the complete list of corrections and their values, see here

Process UVL2

  • Function: UVL2
  • Description: Starting from the level 1.6 UV product, the cosine correction is applied to the irradiances. An operative UV configuration with the Cosine correction data must be available for the requested period. As in the case of level 1.6, output data is further filtered by the UV Exclusion List
  • Input:
    1. format: see Format
    2. means: see means
  • Output: the following UV-specific fields are included in the standard output alongside the other usual ones (Brewer ID, config_date, config_id, pressure, …):
    1. mmmm: decimal minutes from 00:00 to the start of the UV scan
    2. scan: type of UV scan performed (uv, ux, ua, …)
    3. irr_l, where l=2865, 2870, …, 3630: irradiance at the l wavelength, in W/m2/nm
    4. mmmm_l: decimal minute from 00:00 at which the measurement at the l wavelength started
    5. duv and duv_cost: erythema-weighted UV irradiances, using the same method as in the standard Brewer software, and the method proposed during COST Action ES1207 (EUBREWNET)
    6. uvi and uvi_cost: UV indexes calculated as duv/25 and duv_cost/25, respectively
    7. correction_flag: binary flag with the corrections applied. In the level 2 UV product, either a clear sky or a diffuse cosine correction may be applied. For the complete list of corrections and their values, see here

Process TempCoef

  • Function: TempCoef
  • Description: This function analyses the temperature sensitivity of SL measurements.
  • Input:
    1. format: see Format
    2. tc: if we pass the tc parameter with no value, the fit is done with the SL measurements corrected using the temperature coefficients from the operational setup on Eubrewnet. If we pass six values separated by commas, the fit is done with the corrected SL measurements using these values as temperature coefficients. If the tc parameter is omitted, no temperature correction is applied to the SL measurements.
    3. tmin: all data below tmin are removed.
    4. tmax: all data above tmax are removed.
    5. alpha: Outliers can be removed by giving the alpha parameter a value greater than zero. In this case, after performing the linear regression, all measures whose residuals are greater than the standard deviation of all residuals multiplied by the alpha factor will be removed, and the linear regression will be repeated. This process is repeated iteratively until all values are below this threshold.
  • Output: the following fields are included in the output:
    1. channel: Brewer measurement channels in the ozone position next to R5 and R6.
    2. a: intercept value for the linear regression.
    3. sa: standard error of the intercept of the linear regression.
    4. b: slope value for the linear regression.
    5. sb: standard error of the slope of the linear regression.
    6. r2: R-squared of the linear regression.


UPDATE FUNCTIONS

O3L1 Update the Database content for the Level 1 of Ozone O3L1 Update O3L1
O3L1_5 Update the Database content for 1.5 of Ozone O3L1_5 Update O3L1_5
O3L2_0 Update the Database content for 2.0 of Ozone O3L2_0 Update O3L2_0

Update O3L1


Update O3L1_5

  • Function: O3L1_5
  • Description: Process and Updates Ozone calculated using standard Algorithm and Direct Sun Measures. The Standard Lamp corrections, ETC by filter and Straylight corrections. The measures are filtered by standard deviation, max airmass, correct mercury test, maximun and mininum values. The Operators have to upload configurations for calculation. See Ozone Level Definition and Configuration Upload Instructions. Only the providers of the RAW data can update the processed data. After updating, the product will be accesible using Get function.
  • Inputs:
    1. format: see Format
  • Outputs: The time to process and update the product

Update O3L2_0

  • Function: O3L2_0
  • Description: Process and Updates Ozone calculated using standard Algorithm and Direct Sun Measures. The Standard Lamp corrections, ETC by filter and Straylight corrections. The measures are filtered by standard deviation, max airmass, correct mercury test, maximun and mininum values. The Operators have to upload configurations for calculation. See Ozone Level Definition and Configuration Upload Instructions. Only the providers of the RAW data can update the processed data. After updating, the product will be accesible using Get function. The Level 2.0 is available only for validated Configurations.
  • Inputs:
    1. format: see Format
  • Outputs: The time to process and update the product

EXAMPLES

MATLAB 2013A

A matlab function is available for users for understanding the Authentication method.

Failed to retrieve: http://rbcce.aemet.es/svn/matlab/get_dss_auth.m

MATLAB 2015A

Example for Matlab 2015a

%% to get data in matlab (2015)
% brewer thesaloniki #005
% date    2015-05-10
%  Level 1:observations
 
url2='http://eubrewnet.aemet.es/eubrewnet/data/process/O3L1?brewerid=005&date=2015-05-10';
 
wop=weboptions('Username', 'brewer', 'Password', 'redbrewer','ContentType','json');
 
[data_json]=webread(url2, wop);
 
header=data_json{1}
 
table_dss=cell2table(cat(1,data_json{2:end}),'Variablenames',header)

PYTHON

A python script is available for users for understanding the Authentication method.

connect_example.py

#! /usr/bin/python
##################################################################################
# Module: connect_example.py                                                     #
# Usage: $>connect_example.py -h                                                 #
# Comments:                                                                      #
# - Connects to Eubrewnet and returns the result of a get function to the        #
# database. Executes between two different days to check system perfomance       #
# Author: Bentorey Hernandez Cruz (2015-01-01)                                   #
##################################################################################
import urllib2, base64,json
import sys, getopt
import datetime
import os
 
user = 'user'
password = 'password'
 
#getdataUrl = 'http://rbcce.ciai.inm.es/eubrewnet/getdata'
getdataUrl = 'http://rbcce.aemet.es/eubrewnet/data/get'
 
##################################################################################
# Function: usage                                                                #
# Comments: Show information message                                             #
##################################################################################
def usage():
  print '************************************************************************'
  print 'Usage:'
  print '    $>./connect_example.py [options]'
  print 'Options:'
  print '    -b, --brewerid:  Brewer    (DEFAULT = 157)'
  print '    -d, --date: Start date in YYYY-MM-DD format (DEFAULT = 2015-01-01)'
  print '    -e, --enddate: End date in YYYY-MM-DD format (DEFAULT = 2015-01-01)'
  print '    -f, --function: Function to be executed (DEFAULT = DSS)'
  print '    -h, --help: Show this help'
  print '************************************************************************'
 
 
##################################################################################
# Function: main                                                                 #
# Comments: Parses the options that have been selected in command line or set    #
# the default values                                                             #
##################################################################################
def main(argv):
  params = {}
  params['function'] = 'DSS'
  params['brewerid'] = '157'
  params['date'] = datetime.date(2015,1,1)
  params['enddate'] = datetime.date(2015,1,1)
  try:
    opts, args = getopt.getopt(argv, "h:b:d:e:f:", ["help", "brewerid=", "date=","enddate=", "function="])
 
  except getopt.GetoptError:
    usage()
    sys.exit(2)
  for opt, arg in opts:
    if opt in ("-h", "--help"):
      usage()
      sys.exit()
    elif opt in ("-f", "--function"):
      params['function'] = arg
    elif opt in ("-b", "--brewerid"):
      try:
        params['brewerid'] = int(arg)
        params['brewerid'] = str(params['brewerid']).zfill(3)
      except:
        usage()
        sys.exit(2)
    elif opt in ("-d", "--date"):
      try:
        params['date'] = datetime.datetime.strptime(arg, "%Y-%m-%d").date()
      except:
        usage()
        sys.exit(2)
    elif opt in ("-e", "--enddate"):
      try:
        params['enddate'] = datetime.datetime.strptime(arg, "%Y-%m-%d").date()
      except:
        usage()
        sys.exit(2)
 
  return params
 
##################################################################################
# Function: connection                                                           #
# Comments: Try to connect to a specific url using Basic Authentication          #
##################################################################################
def connection(url,user,password):
  request = urllib2.Request(url)
  base64string = base64.standard_b64encode('%s:%s' % (user, password))
  request.add_header("Authorization", "Basic %s" % base64string)
  content = urllib2.urlopen(request).read()
  return json.loads(content)
 
##################################################################################
# Function: getdata
# Comments: Build the url of a specific function given by
##################################################################################
def getdata(params, user,password):
  brewerid = params['brewerid']
  date = params['date'].strftime('%Y-%m-%d')
  enddate = params['enddate'].strftime('%Y-%m-%d')
 
  url = "/".join([getdataUrl,params['function']])
  brewerid = "=".join(['brewerid',brewerid])
  date = "=".join(['date',date])
  url = "?".join([url, brewerid])
  url = "&".join([url,date])
  url = "&".join([url,enddate])
 
  content = connection(url,user,password)
 
  return content
 
##################################################################################
if __name__ == '__main__':
  print 'Connection example\n'
 
  params = main(sys.argv[1:])
  print params
 
  date_ini = params['date']
  tic = datetime.datetime.now()
  while params['date'] <= params['enddate']:
    print getdata(params,user,password)
    params['date'] = params['date'] + datetime.timedelta(1,0,0)
 
  toc = datetime.datetime.now()
 
  print "TIME for", params['function'], "and Brewer #", params['brewerid'], "between", date_ini.strftime("%Y-%m-%d"),"and",params['enddate'].strftime("%Y-%m-%d"),"->", toc - tic
##################################################################################

Bypassing data filters

Data with a non-zero filter_flag value will not be included in the O3L1_5 and AODL1_5 output unless &rejected is added included in the URL. For example, the output of

https://eubrewnet.aemet.es/eubrewnet/data/process/O3L1_5?brewerid=185&date=2018-11-01&enddate=2018-11-02&format=text&fields=gmt,filter_flag

only shows data with filter_flag equal to zero, whereas

https://eubrewnet.aemet.es/eubrewnet/data/process/O3L1_5?brewerid=185&date=2018-11-01&enddate=2018-11-02&rejected&format=text&fields=gmt,filter_flag

includes observations with filter_flag values of 1 and 4 which will would have been hidden were it not for the &reject included in the URL

The filter_flag values correspond to the following conditions and variables:

Flag type Flag name Description Value
Ozone data filter FLAG_OZONE_STD_FILT Above the ozone standard deviation threshold 1
Ozone data filter FLAG_AIRMASS_FILT Above max airmass 2
Ozone data filter FLAG_HG_FILT Wrong HG 4
Ozone data filter FLAG_MIN_FILT Below Min Ozone Value 8
Ozone data filter FLAG_MAX_FILT Above Max Ozone Value 16
Ozone data filter FLAG_BLACKLIST Date in Exclusion List 32
AOD data filter FLAG_AOD_STD_FILT The standard deviation of the AOD summaries is > 0.02 1
AOD data filter FLAG_AOD_AIRMASS_FILT The airmass is larger than some threshold value (Nov 2020: not in use yet) 2
AOD data filter FLAG_AOD_MIN_FILT AOD < 0 8
AOD data filter FLAG_AOD_MAX_FILT AOD > 4 16
AOD data filter FLAG_AOD_BLACKLIST Date in Exclusion list 32
AOD data filter FLAG_AOD_BAD_OZONE_FILT The ozone data does not have a filter_flag of 0 64

You can also omit any of these data filters adding allowfilter=xxx[,yyy] to the URL, where xxx is one of the Flag names in the above table. Note you can pass more than one Flag name, separating them by commas. Capitalization is not taken into account.

Thus for example, if the last URL is changed to

https://eubrewnet.aemet.es/eubrewnet/data/process/O3L1_5?brewerid=185&date=2018-11-01&enddate=2018-11-02&rejected=True&format=text&fields=gmt,filter_flag&allowfilter=FLAG_OZONE_STD_FILT,flag_hg_filt

both the FLAG_OZONE_STD_FILT and FLAG_HG_FILT data filters will be ignored and all the data will have a filter_flag value of 0.

codes/dbaccess.txt · Last modified: 2022/10/20 08:16 (external edit)