refactor handling of grouping dimension in image to series conversion