pylag.variable_library module

Library of standard PyLag variables.

This is a hardcoded library of standard variable names and units which is intended to help with the consistent writing of data to file.

It includes maps for different types of input data, which map PyLag names (e.g. “temperature”) to those used in different types of input data (e.g. “temp” in FVCOM).

pylag.variable_library.get_coordinate_variable_name(coordinate_system, variable_name)[source]

Get coordinate variable name

Parameters
  • coordinate_system (str) – The coordinate system (i.e. cartesian or geographic)

  • variable_name (str) – The variable name (i.e. x1, x2 or x3)

Returns

The coordinate variable name (e.g. longitude)

Return type

str

pylag.variable_library.get_data_type(var_name, precision='s')[source]

Get variable data type

Parameters
  • var_name (str) – The variable name

  • precision (str) – Pass in s for single or d for double precision. Optional, default: s.

Returns

  • Python data type

  • The variable data type

pylag.variable_library.get_integer_type(precision='s')[source]

Return intger data type of the specified precision

Parameters

precision (str) – Pass in s for single or d for double precision. Optional, default: s.

Returns

  • Python data type

  • The variable data type

pylag.variable_library.get_invalid_value(dtype)[source]

Get value used for invalid entries

Parameters

dtype (np.dtype) – The data type.

Returns

Value of invalid values

Return type

int, float

pylag.variable_library.get_long_name(var_name)[source]

Get the variable long name

Parameters

var_name (str) – The variable’s name

Returns

The variable’s long name

Return type

str

pylag.variable_library.get_real_type(precision='s')[source]

Return real data type of the specified precision

Parameters

precision (str) – Pass in s for single or d for double precision. Optional, default: s.

Returns

  • Python data type

  • The variable data type

pylag.variable_library.get_units(var_name)[source]

Get the variable’s units

Parameters

var_name (str) – The variable name

Returns

It’s units

Return type

str