Use an interface for output_write*d

- generic function output_write now handles arrays of
  all 3 dimensions.