This version works.

I'm refactoring some things incrementally w.r.t transposing / downsampling data & header simultaneously.
Refactored the transpose/downsample code to do both data & header.

Renamed some things and updated comments too.

It works!