Skip to content

Configuring System Measurement Units

The simplest configuration of system units is to simply set units to metric or imperial or uk. This is done in reactor.yaml as shown below (in the reactor section):

reactor:
  # Set the measurement system: "imperial" or "metric" or "uk" (default: imperial)
  units: imperial

In countries like the UK, where a mix of imperial and metric units are used commonly, you can use an alternate structure to define the units for each purpose. In this case, units is an object, and the default subkey defines the base unit system (so you don't have to define all of the various units), and you can specify overrides for any specific unit that needs to something other than the base unit's default.

reactor:
  units:
    default: metric
    visibility: miles

The keys known currently are:

  • default -- the default system of units for anything that isn't otherwise specified; one of: imperial, metric, uk;
  • temperature -- the units for temperature, may be k, f or c;
  • linear -- the units for distances, generically; one of: mm, millimeters, m, meters, km, kilometers, in, inches, ft, feet, mi, miles;
  • longlinear -- the units for distance for long measurements; same values as linear; if not specified, linear is used;
  • shortlinear -- the units for distance for short measurements; same values as linear; if not specified, linear is used;
  • visibility -- the unit to use specifically for reporting visible distance (in weather); same values as linear; if not specified, longlinear is used;
  • rainfall -- the unit to use specifically for reporting rainfall (weather, a linear measurement); same values as linear; if not specified, shortlinear is used;
  • speed -- the units for speeds, generically; one of: mps, m/s, m/sec, kph, k/h, km/h, fps, f/s, ft/s, ft/sec, mph, mi/h;
  • windspeed -- the units to use specifically when reporting windspeed; same values as speed; if not specified, speed is used;
  • pressure -- the units to use to report pressure measurements; one of: hPa, mbar, bar, inhg, mmhg

Tip

Notice that there's a heirarchy at work here. For example, to find the unit for visibility, Reactor scans the configuration like this: visibility -> longlinear -> linear -> default, and the first hit determines the units used.

Updated: 2021-Mar-08