module documentation

Undocumented

Class HTMLBackend Undocumented
Function apply_operator Recursively apply mathematical operator(s).
Function bib2html Undocumented
Function eval_expr Evaluate a mathematical expression stored as a string in a JSON file.
Function extract_ds Recursively extract a formula from a list of operands and dataset fields.
Function extract_name Recursively extract a formula from a list of operands and dataset fields.
Function extract_vars Extract a list of unique variable names from an expression.
Function will_it_float Test a string to determine if it will convert to a float.
Function _bib2html_bibdata Undocumented
Function _bib2html_list Undocumented
Function _bib2html_string Undocumented
def apply_operator(operands, operator, name=False): (source)

Recursively apply mathematical operator(s).

Parameters
operands:listList of operands, either two field names, or a field name and another list of field names (e.g. [U, V], or [T, [U, V]], or [T, [U, [V, X]]])
operator:strOperator to apply recursively to the pairs of operands (one of +, -, *, /, or ^)
name:boolIf true, return a string of the applied operation, if false, return the value.
Returns
(type(operands), str)output - Returns the result of the mathematical expression, with the same type as operands[0] or a string representation of the expression
def bib2html(bib, style=None, backend=None): (source)

Undocumented

def eval_expr(expr): (source)

Evaluate a mathematical expression stored as a string in a JSON file.

Parameters
expr:strMathematical expression, stored as a single string: e.g. "1 + 1 * 3", "24 * 3600 * 365", etc. Will be checked to contain _only_ numbers and mathematical symbols: [0-9], +, -, *, /, ^, (, and )
Returns
floatresult - Result of mathematical expression
def extract_ds(expr, dset, name=False): (source)

Recursively extract a formula from a list of operands and dataset fields.

Parameters
expr:listList of expressions where first element is operator, subsequent two elements are operands, either numeric values, fields within dset, or an expression of this kind. (e.g. ["^", ["+", ["*", "U", "U"], ["*", "V", "V"]], "0.5"] for the wind velocity)
dset:xarray.DatasetDataset which contains the fields described in expr
name:bool, optionalIf true, output the string of the interpreterd expression rather than its result
Returns
xarray.DataArrayoutput - Evaluated expression
def extract_name(expr): (source)

Recursively extract a formula from a list of operands and dataset fields.

Parameters
expr:listList of expressions where first element is operator, subsequent two elements are operands, either numeric values, fields within dset, or an expression of this kind. (e.g. ["^", ["+", ["*", "U", "U"], ["*", "V", "V"]], "0.5"] for the wind velocity)
Returns
stroutput - Human redable text of evaluated expression
def extract_vars(expr): (source)

Extract a list of unique variable names from an expression.

def will_it_float(test_str: str) -> bool: (source)

Test a string to determine if it will convert to a float.

Parameters
test_str:strString to be tested
Returns
float, bool_will - If the string converts to a float, return the float, if not return False
def _bib2html_bibdata(bib, style=None, backend=None): (source)

Undocumented

def _bib2html_list(bib, style=None, backend=None): (source)

Undocumented

def _bib2html_string(bib, style=None, backend=None): (source)

Undocumented