src/oceanbox.cpp
//------------------------------------------------------------------------------
/*! \brief                  Calculate mean past box carbon
 *  \param[in] lookback     Window size to look back into the past (including current value)
 *  \returns                bool indicating whether box C is oscillating recently
 *  \exception              lookback must be non-negative
 */
\brief                  Calculate mean past box carbon
\param[in] lookback     Window size to look back into the past (including current value)
\returns                bool indicating whether box C is oscillating recently
\exception              lookback must be non-negative
\ brief Calculate mean past box carbon \ param [ in ] lookback Window size to look back into the past ( including current value ) \ returns bool indicating whether box C is oscillating recently \ exception lookback must be non - negative
double oceanbox::vectorHistoryMean( std::vector<double> v, int lookback ) const {
    H_ASSERT( lookback > 0, "lookback must be >0" );
    H_ASSERT( v.size() > 0, "vector size must be >0" );
    lookback = min<int>( int( v.size() ), lookback );
    double sum = 0.0;
    for ( int j=0; j<lookback; j++ )  {
        sum += v[ j ]; 
    }
    return sum / lookback;
}
double oceanbox :: vectorHistoryMean ( std :: vector < double > v , int lookback ) const { H_ASSERT ( lookback > 0 , " " ) ; H_ASSERT ( v . size ( ) > 0 , " " ) ; lookback = min < int > ( int ( v . size ( ) ) , lookback ) ; double sum = 0.0 ; for ( int j = 0 ; j < lookback ; j ++ ) { sum += v [ j ] ; } return sum / lookback ; }
\brief                  Calculate mean past box carbon
  \param[in] lookback     Window size to look back into the past (including current value)
  \returns                bool indicating whether box C is oscillating recently
  \exception              lookback must be non-negative
\ brief Calculate mean past box carbon \ param [ in ] lookback Window size to look back into the past ( including current value ) \ returns bool indicating whether box C is oscillating recently \ exception lookback must be non - negative
// sum up the past states