nctoolkit.DataSet.set_units

DataSet.set_units(unit_dict=None, **kwargs)

Set the units for variables

Parameters:
  • unit_dict (dict) – A dictionary where the key-value pairs are the variables and new units respectively.

  • kwargs (*) – Alternative method for setting units using direct assignment

Examples

Set the units for a variable called ‘tas’ to ‘K’: >>> ds.set_units({‘tas’: ‘K’})

Set the units for a variable called ‘tas’ to ‘K’ using kwargs: >>> ds.set_units(tas=’K’)