unitasserts: Common assertions on unit string inputs

Description Usage Arguments Details

Description

All of the unit conversion functions are looking for a length-1 character vector. This function checks that these conditions are met.

Usage

1
unitasserts(iunit, ounit)

Arguments

iunit

Input unit

ounit

Output unit

Details

The conditions are applied as assertions and will therefore cause errors rather than warnings if they fail. This a departure from our usual practice. We do it because having the wrong length or wrong type is a programming error, not a data error. Therefore, we expect these to trigger only in during testing new modules, in which case an error and immediate halt is appropriate.


JGCRI/iamrpt documentation built on June 30, 2019, 3:19 a.m.