ctdam.proc.modules.external_functions module

class ctdam.proc.modules.external_functions.ExternalFunctions(modules)[source]

Bases: UserDict

A collection of all external functions that are available.

These can be used interchangeably with the other processing modules.

Parameters:

modules (list) – A list of modules to import functions from (e.g. gsw)

available_modules()[source]

Return all modules.

Return type:

list

functions_of_certain_module(module)[source]

Display processing functions of certain module.

Parameters:

module (str)

Return type:

dict

get_all_functions()[source]

Return all functions of all modules.

Return type:

dict

list_of_function_names(module='')[source]

Return all function names for a specific module or in general.

Parameters:

module (str) – A module to display from (Default value = “”)

Return type:

list

get_module_functions(module)[source]

Retrieve ExternalFunctionInfo instances for all functions of a module.

Parameters:

module

Return type:

dict

class ctdam.proc.modules.external_functions.ExternalFunctionInfo(external_function)[source]

Bases: object

Parsed information of external processing functions.

Parameters:

external_function (Callable) – A function

run(ctd_data, parameters={})[source]

Execute the function.

Does either run on explicetly given parameters or tries to determine the input parameters itself.

Parameters:
  • ctd_data (CTDData) – The data to work on

  • parameters (dict) – The input parameters (Default value = {})

Return type:

bool

execute_funtion(args, ctd_data, second_sensor=False)[source]

Run function with any source of parameters.

Parameters:
  • args (list) – All arguments for the function

  • ctd_data (CTDData) – The CTD data to work on

  • second_sensor (bool) – Whether working on second sensor (Default value = False)

Return type:

bool

create_cnv_metadata(return_value, second_sensor=False)[source]

Build metadata for the new parameter column.

Uses parsed function docstring.

Parameters:
  • return_value (dict) – The expected return value metadata information

  • second_sensor (bool) – Whether working on second sensor (Default value = False)

Return type:

dict

map_parameter(parameter, ctd_data=None)[source]

Mapping of function arguments to internally used parameter names.

Obviously a bottleneck for new functions.

Parameters:
  • parameter (str) – The target parameter of interest

  • ctd_data (CTDData | None) – The CTD data to work on (Default value = None)

Return type:

list

parse_docstring(raw_docstring)[source]

Parses function docstring information into attributes.

Parameters:

raw_docstring – The function docstring

class ctdam.proc.modules.external_functions.ExternalFunctionCaller(module, processing_functions)[source]

Bases: ArrayModule

Module interface to allow same handling as the other processing modules.

Parameters:
  • module (str) – The module name

  • processing_functions (ExternalFunctions) – A ExternalFunctions instance

transformation()[source]

Execute the external function.

Return type:

bool