Dimensional analysis is a well known technique for checking the consistency of equations involv-
ing physical quantities, constituting a kind of type system. Various type systems for dimensional
analysis, and its re nement to units-of-measure, have been proposed. In this paper, we detail
the design and implementation of a units-of-measure system for Fortran, provided as a pre-
processor. Our system is designed to aid adding units to existing code base: units may be
polymorphic and can be inferred. Furthermore, we introduce a technique for reporting to the
user a set of critical variables which should be explicitly annotated with units to get the maxi-
mum amount of unit information with the minimal number of explicit declarations. This aids
adoption of our type system to existing code bases, of which there are many in computational
science projects.This work was supported in part by a Google Focussed Research Award and by EPSRC grant EP/K011715/1.This is the final version. It first appeared at http://www.sciencedirect.com/science/article/pii/S1877750315000563