docs: def StreamIDNextDownIDToConnectivity(stream_id_array,
                                       next_down_id_array,
                                       out_csv_file):
      """
      Creates RAPID connect file from stream_id array and next down id array
      """
      list_all = []
      max_count_upstream = 0
  
      for hydroid in np.sort(stream_id_array):
          # find the HydroID of the upstreams
          list_upstreamID = stream_id_array[next_down_id_array == hydroid]
          # count the total number of the upstreams
          count_upstream = len(list_upstreamID)
          if count_upstream > max_count_upstream:
              max_count_upstream = count_upstream
          nextDownID = next_down_id_array[stream_id_array == hydroid][0]
          # append the list of Stream HydroID, NextDownID, Count of Upstream ID,
          # and  HydroID of each Upstream into a larger list
          list_all.append(
              np.concatenate(
                  [np.array([hydroid, nextDownID, count_upstream]),
                   list_upstreamID]
              ).astype(int))
  
      with open_csv(out_csv_file, 'w') as csvfile:
          connectwriter = csv_writer(csvfile)
          for row_list in list_all:
              out = np.concatenate([
                  row_list,
                  np.array([0 for _ in xrange(max_count_upstream - row_list[2])])
              ])
              connectwriter.writerow(out.astype(int))