Observation Step Values.
The biggest problem in CRHM has been the mix of DAILY alogorithms and INTERVAL alogorithms in the same model. DAILY alogorithms are normally processed at the end of every day since only then are daily means or totals of climate or meteorological data available. INTERVAL alogorithms can be handled every interval.
STEP Value.
In CRHM there is a variable called STEP which is incremented every interval. The value for the first interval of a model run is 1. This is always the first interval of the first day of the model run, e.g. 00:30AM or 1:00AM. If Step is divided by the number of measurements taken per day (FREQ), i.e. 24 or 48, the remainder will be 1 for the first interval of the day or 0 for the last interval of the day. This relationship is used in CRHM modules to determine when to calculate DAILY alogorithms.
Example1.
if(STEP%FREQ == 0)
{calculate an expression for the last interval of the day} or
Example2.
if(STEP%FREQ == 1)
QsiD = Qsi
else
QsiD = Qsid + Qsi
The latter code will calculate the total incoming short-wave radiation for the day. If it is combined in a module with the former code, the DAILY alogorithm will access the daily total incoming short-wave radiation.