Fixes for the CDI reader
Fixes problems in the CDI reader.
One segfault for parallel reads with big data. A couple fixes for messy files (e.g. with multiple grids).
In the process also a bit of restructuring towards a cleaner separation of responsibilities.