normalize_range_arg: Normalize a range argument into a true numeric range
Description
Several functions in this package and the suite accept a range argument
with a flexible syntax. To ensure that all functions and methods behave
in the same way this code has been factored out into a separate function.
a numeric vector of length two, or any other object for which
function range() will return two
default.range
a numeric vector of length two, missing values are
not allowed, but Inf amd -Inf are.
Value
a numeric vector of length two, guaranteed not to have missing
values.
Details
The range argument can contain NAs which are replaced by
the value at the same position in default.range. In addition
a NULL argument for range is converted into default.range.
The default.range is also the limit to which the returned value
is trimmed. The idea is that the value supplied as default is the whole
valid range, and as we use range only for wavelength, the default is
0 to Inf.