equinor / fmu-dataio

FMU data standard and data export with rich metadata in the FMU context
https://fmu-dataio.readthedocs.io/en/latest/
Apache License 2.0
10 stars 13 forks source link

Enable writing of json files #354

Open daniel-sol opened 12 months ago

daniel-sol commented 12 months ago

There are several datatypes in the fmu domain that as a data structure best fits in as a dictionary. The first types that spring to mind:

perolavsvendsen commented 12 months ago

Is the data class "dictionary"? Or "keyvalues"? Or "json"? I'm thinking of consistency with existing classes, e.g. table, surface, cpgrid etc.

To clarify, we will end up with is something like this: myfile.yml .myfile.yml.yml

daniel-sol commented 12 months ago

I have suggested to have class as dictionary. See PR #355

perolavsvendsen commented 12 months ago

I am wobbling a bit but I think I am leaning more towards using json (or yaml) as class, not dict. I worry about confusion with the dict data type in Python. A Python dict can contain "anything", but in this case we are constrained by what can actually be represented as json.

But, that being said - to materialize a JSON from Python, you have a dict instance. And when parsing JSON with Python, you end up with a dict instance.

This is conceptually tricky, as it mixes class and format. This is much easier with e.g. table/csv. I think we are missing the analogue to table for this. JSON essentially contains two structures: name/value pairs, and (ordered) lists. But I think it will be confusing to start annotating those.

🤯

daniel-sol commented 11 months ago

Well, I beg to differ. I don't think json or yaml, or yml for that matter are the right terms. These are formats, not data structures. But I have changed the classname to dictionary to keep it distinct from pythons dict.