.warning: Inconsistent usage
s2dv has a non-exported function .warning()
. It returns warnings without printing the name of the call function.
# .warning()
acc <- ACC(exp,obs, space_dim = c("lats", "lons"), lat = c(10,11))
Warning message:
! Warning: Parameter 'space_dim' is deprecated. Use 'lat_dim' and 'lon_dim'
! instead.
# warning()
acc <- ACC(exp,obs, space_dim = c("lats", "lons"), lat = c(10,11))
Warning message:
In ACC(exp, obs, space_dim = c("lats", "lons"), lat = c(10, 11)) :
Parameter 'space_dim' is deprecated. Use 'lat_dim' and 'lon_dim' instead.
The advantage is that it makes the console clean. But, if the function is used inside of other functions or tools, it is hard to track where the warnings are from.
For now, .warning() and the basic warning() are both used in s2dv, and the usage is random. We should decide to use one of them only, or identify which function should be used in which situation.
Ps., startR also has .warning(). It is more reasonable to use it in startR because (1) startR returns lots of warnings usually (2) startR is less common to be used inside of other functions.