Example #1
0
  def test_get_time_table(self):
    expected = [
      ((datetime.datetime(2000, 1, 1, 12, 30), 0), datetime.datetime(2000, 1, 1, 12, 30)),
      ((datetime.datetime(2000, 1, 1, 12, 20), 2), datetime.datetime(2000, 1, 1, 12, 40)),
      ((datetime.datetime(2000, 1, 1, 12, 20), 3), datetime.datetime(2000, 1, 1, 12, 50)),
      ((datetime.datetime(2000, 1, 1, 12, 20), 4), datetime.datetime(2000, 1, 1, 13,  0)),
      ((datetime.datetime(2000, 1, 1, 12, 20), 5), datetime.datetime(2000, 1, 1, 13, 10)),
      ((datetime.datetime(2000, 1, 1, 12, 20), 6), datetime.datetime(2000, 1, 1, 13, 20)),
    ]
    self.assertEqual(
      expected,
      jmalib.get_time_table(
        datetime.datetime(2000, 1, 1, 12, 30),
        datetime.datetime(2000, 1, 1, 12, 20)))

    expected = [
      ((datetime.datetime(2000, 1, 1, 12, 45), 0), datetime.datetime(2000, 1, 1, 12, 45)),
      ((datetime.datetime(2000, 1, 1, 12, 20), 3), datetime.datetime(2000, 1, 1, 12, 50)),
      ((datetime.datetime(2000, 1, 1, 12, 20), 4), datetime.datetime(2000, 1, 1, 13,  0)),
      ((datetime.datetime(2000, 1, 1, 12, 20), 5), datetime.datetime(2000, 1, 1, 13, 10)),
      ((datetime.datetime(2000, 1, 1, 12, 20), 6), datetime.datetime(2000, 1, 1, 13, 20)),
    ]
    self.assertEqual(
      expected,
      jmalib.get_time_table(
        datetime.datetime(2000, 1, 1, 12, 45),
        datetime.datetime(2000, 1, 1, 12, 20)))
Example #2
0
def get_time_table(radar_time=None, nowcast_time=None):
    return jmalib.get_time_table(
        radar_time=radar_time or get_radar_time(), nowcast_time=nowcast_time or get_nowcast_time()
    )