fields.parse_value#

fields.parse_value(value, default_units)[source]#

Parse an array of values into the correct units.

Parameters:
  • value (array-like or tuple) – The array from which to convert values to correct units. If value is a unyt_array, the unit is simply converted, if value is a tuple in the form (v_array,v_unit), the conversion will be made and will return an unyt_array. Finally, if value is an array, it is assumed that the default_units are correct.

  • default_units (str) – The default unit for the quantity.

Returns:

The converted array.

Return type:

unyt_array