aodn / imos-toolbox

Graphical tool for QC'ing and NetCDF'ing oceanographic datasets
GNU General Public License v3.0
46 stars 31 forks source link

Schema validation for matlab variables #577

Closed ocehugo closed 5 years ago

ocehugo commented 5 years ago

It's pretty easy to know if a variable is different from another in Matlab. However, it's not so straight forward to see the reason.

This is a problem when dealing with new Parsers, for example. One seeks to check if the new parser produces the same structure after a modification. The canonical way is to just:

isequal(new,old)

However, this does not tell where and why the difference occurs. Also, it's useful not just to know where the content changes, but why. Hence, a useful tool is something like:

[isdiff,why] = compare_this(new,old)

Type, size, length, and content comparison is required to achieve that and inform correctly. For example, a given structure got an extra field not previously found (length/size wise comparison), the type at new.data.cell{3} can be char while in old.new.data{3} can be int16, etc.

Finally, the comparison needs also to walkthrough all nested levels, reporting exactly where/why the difference occurs (i.e. recursion).

The above requirements indicate that what we need is a schema validation tool.

Requirements: