Validating Radar data files with versioning in CUE #1164
MikkelHJuul
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
@MikkelHJuul thanks very much for sharing this. Just to note, that in:
the use of the
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
ODIM H5 Validator
On my job I was tasked to create software that could validate the internal tree/file structure of hdf5 files following the ODIM H5 specification. The specification describe how metadata is structured inside the given file. So this is basically the perfect fit for CUE.
The project consist of a mapping routine written in python, that map the internal tree to json, the specification written in CUE and a wrapping bash-script.
The CUE implementation turned out to be far from trivial. I started describing the, at that time, newest version: v2.3 of the specification. and then came the other versions, it promptly became clear to me, that describing each version of the specification would become a pain to maintain when new versions arrived.
Versioning
So I ended up building some basic constructs:
which served as a way to cherry-pick the data based on the objects availability through time (version)
this way structs can be built in runtime using something like
now of course this wasn't simple enough for the needs. The most complicated part of the specification is a group called...
The Where group
consider a tree
where the definitions
#TopWhere
,#DatasetWhere
and#DataWhere
are composed of mostly the same attributes, that are allowed at different levels of the tree (top, dataset or data) and belong to different types (polar data, vertical data, ...). Ending out with a definition where e.g.#TopWhat: {...loc=top/group=vertical/version=_v..} | { ...loc=top/group=polar/version=v... }
So I had to expand the
#VersionObject
this way I aggregate and construct the definitions like so:
Limitation
unfortunately, and somewhat unsatifactory, I ran into a limitation in which cue cannot vet the
#TopWhere
as one of the groups is a direct subgroup of the other.forcing me to change:
to
All in all I am really glad to have chosen CUE. This would have been a non-starter in JSON schema, and very tedious in any other language. Keep up the good work!
Beta Was this translation helpful? Give feedback.
All reactions