def helper_time_percent_complete(inf, percent_complete=0.25):
  """Helper function to calculate when the infection is percent_complete.

  Args:
    inf: an xr.DataArray representing new_infections with
      dimensions of (location, sample, time).
    percent_complete: a float representing the percent of the epidemic that we
      want to see completed.
  Returns:
    true_time: an xr.DataArray containing the ground truth time of
      the percent complete. Has dims (location, sample).
  """
  # Calculate the total epidemic size
  total_size = inf.sum('time')
  target_size = percent_complete * total_size
  cumulative_infections = inf.cumsum('time')
  target_time = cumulative_infections.where(
      cumulative_infections <= target_size).argmax('time')
  return target_time