polyfemos.front.userdef

Provides config values from YAML files

See more info in Configuration

copyright

2019, University of Oulu, Sodankyla Geophysical Observatory

license

GNU Lesser General Public License v3.0 or later (https://spdx.org/licenses/LGPL-3.0-or-later.html)

Public Functions

polyfemos.front.userdef.channel_codes(config_value=[])[source]
Parameters

config_value (list) – channel_codes from yaml files

Return type

list[str]

Returns

list of all data channels available in polyfemos web across all the stations in the selected network

polyfemos.front.userdef.check_network_code(func_)[source]

Decorated functions check for currently selected network code. The name of the decorated function is used to extract the configuration value from the networks configuration yaml file. If the value is present in the configuration file it is passed to the func_ as config_value keyword argument.

Parameters

func_ (func) –

Return type

func

Returns

a decorated function

polyfemos.front.userdef.datacoveragebrowser_func(config_value='')[source]
Parameters

config_value (str) – datacoveragebrowser_func value from yaml files

Return type

func

Returns

see get_datacoveragebrowser_func() for more info.

polyfemos.front.userdef.definitions(key, config_value={})[source]
Parameters
  • key (str) – internal name for definition, e.g. ‘datarealtimeness’

  • config_value (dict) – a dictionary from yaml files mapping the internal names in to their user defined values

Return type

str

Returns

user defined value corresponding the internal name

polyfemos.front.userdef.filepathformats(key, config_value={})[source]
Parameters
  • key (str) – The desired filepathformat from the filepathformats dictionary

  • config_value (dict) – filepathformats dictionary from yaml files

Return type

func

Returns

polyfemos.front.userdef.get_datacoveragebrowser_func(function='', **kwargs)[source]

Available functions:

Parameters

function (str) –

Return type

func

Returns

data coverage scanner function. If an invalid function is given, returns False.

polyfemos.front.userdef.get_network_code()[source]

Fetches the code of the currently selected network from cookies. If none is selected returns the default network code, which is the first entry in the network_codes list in global_config.yml file.

Return type

str

Returns

network code

polyfemos.front.userdef.get_outlierremfunc(function='', **kwargs)[source]

Available functions:

Parameters

function (str) –

Return type

func

Returns

outlier removal function with additional kwargs applied to it. If an invalid function is given, returns False

polyfemos.front.userdef.network_codes()[source]
Return type

list

Returns

network_codes list from global config yaml file

polyfemos.front.userdef.paths(key, config_value={})[source]
Parameters
  • key (str) – The desired filepath from the paths dictionary

  • config_value (dict) – paths dictionary from yaml files

Return type

str

Returns

polyfemos.front.userdef.secret_key()[source]

A secret_key entry is read from the global configuration yaml file. If no secret key is given in the configuration file or the default entry is unchanged, a different random secret key is used when polyfemos web is reloaded.

See generate_secret_key() for more info.

Return type

str

Returns

secret key

polyfemos.front.userdef.sohpars(visibilities={1, 2}, config_value=[])[source]
Parameters
  • visibilities (set) – returned sohpars are selected based on given visibilities

  • config_value (list) – list of state of health parameter dictionaries from yaml files

Return type

list[str]

Returns

list of state of health parameter names

polyfemos.front.userdef.station_ids(config_value=[])[source]
Parameters

config_value (list) – station_ids from yaml files

Return type

list[str]

Returns

list of station ids (e.g. "FN.MSF") visible in polyfemos web

polyfemos.front.userdef.summary_outlierremfunc_info(config_value=[])[source]
Parameters

config_value (list) –

Return type

list[str]

Returns

For summary table page, information about used advanced outlier removal options

polyfemos.front.userdef.summary_outlierremfuncs(station_id='', sohpar_name='', config_value={})[source]
Parameters
  • station_id (str) – id of the station, e.g. “FN.MSF”

  • sohpar_name (str) – name of the state of health parameter

  • config_value (dict) – the summary_outlierremfuncs dictionary from yaml files

Return type

func

Returns

outlier removal function corresponding station_id and sohpar_name pair. User may define different outlier removal functions with different station_id and sohpar_name combinations. The key in the dict should be station_id:sohpar_name, e.g. FN.RANF:Vault_temperature.

polyfemos.front.userdef.ticklabels(key, config_value={})[source]

If some state of health parameters require specific Y axis labeling, the custom tick labels are defined here.

keys of the ‘tl’ dictionary are names of the soh parameters. Values are JavaScript code blocks which define the tick labels. Word ‘tick’ in JS code will be interpreted as tick variable.

Parameters
  • key (str) – Name of the soh parameter

  • config_value (dict) – ticklabels dictionary from yaml files

Return type

str

Returns

JavaScript code mapping the integer data values into string values.

polyfemos.front.userdef.transform_func(key)[source]
Parameters

key (str) – internal sensor code

Return type

func

Returns

UWV to NEZ transform function

polyfemos.front.userdef.users()[source]
Return type

dict

Returns

users dictionary from global config yaml file