As @uturuncoglu pointed out in ESCOMP/CMEPS#653, if you try to use the routines in shr_wv_sat_mod without first calling shr_wv_sat_init, they can produce 0 values. It would be best if they aborted in this case, or at the very least (if aborting from within these functions isn't acceptable, e.g., because it would require changing functions to no longer be pure and that would be bad for performance) produced obviously-incorrect values that would allow failing faster - e.g., as in:
|
case default |
|
! Providing a correct index is an important precondition for these |
|
! functions. Since we don't have a way of signaling an error, produce an |
|
! obviously unreasonable answer. |
|
es = -huge(1._rk) |
This could be done by having a module-level initialized variable that is checked in each function.
As @uturuncoglu pointed out in ESCOMP/CMEPS#653, if you try to use the routines in shr_wv_sat_mod without first calling shr_wv_sat_init, they can produce 0 values. It would be best if they aborted in this case, or at the very least (if aborting from within these functions isn't acceptable, e.g., because it would require changing functions to no longer be pure and that would be bad for performance) produced obviously-incorrect values that would allow failing faster - e.g., as in:
CESM_share/src/shr_wv_sat_mod.F90
Lines 644 to 648 in f210ab4
This could be done by having a module-level
initializedvariable that is checked in each function.