modflow6 icon indicating copy to clipboard operation
modflow6 copied to clipboard

Feat/var meta

Open jmccreight opened this issue 4 years ago • 1 comments

This is really a shoe horn to get a human-readable format (e.g. a flattened csv in the source) into a new memory manager field for attributes (using keys/hashes to ensure some sanity, at least for me).

Currently the the attribute keys are a constant and are not stored in the memory manager (only the values are). I've only started with 3 attributes: "variable name", "long name", and "units". This can easily be changed but gets back to the idea that this is currently the same for all Attrs instances.

In theory the Attribute object is usable for all variables and subclassable for special cases. Here I've only implemented for scalar variables in Numerical Solution.

The bmi interface has been extended to allow access to the variable metadata: get_attrs_item_count, get_attrs_keys (not-variable specific, as mentioned above), and get_var_attrs. It can do something like this:

image

Forthcoming draft PR on modflow API for that.

jmccreight avatar Feb 02 '22 20:02 jmccreight

I did remove trailing whitespace, you may want to review with the equivalent of -w.

I did a small set of tests locally before pushing. So, I'll take a look at what I broke.

Also, no tests were added! 🤦 This is easiest to test through the api.

jmccreight avatar Feb 02 '22 20:02 jmccreight

Closing this PR as we are headed a different direction with the input data model.

christianlangevin avatar Feb 15 '23 13:02 christianlangevin