Units of all variables need to be documented somewhere.
All variables also need range checks/limits to stop them being exceeded. Right now its really hard to tell if a unit is in radians or degrees (as far as I can tell everything but lat/lon is radians) and the code will happily accept degrees for units that should be radians.