Module: WrfLibrary::TimeConverter

Defined in:
lib/wrf_library/time_converter.rb

Overview

This module provides logic and methods to identify and manage results for different timestamps

Class Method Summary collapse

Class Method Details

.get_offset_modelrun(start_hour) ⇒ Integer

method to determine the offset between the actual hour and the next midnight

Parameters:

  • start_hour (String)

    the starting hour in string representation

Returns:

  • (Integer)

    the offset to the next midnight

Raises:

  • (ArgumentError)

    if the hour is not valid



14
15
16
17
18
19
20
21
22
# File 'lib/wrf_library/time_converter.rb', line 14

def self.get_offset_modelrun(start_hour)
  hour = RubyUtils::ParameterConverter.convert_int_parameter(start_hour)
  if (hour == 0)
    return 0 
  elsif (hour < 0 || hour > 24)
    raise ArgumentError, "Error: #{hour} in not valid"
  end  
  24 - hour  
end