VForWaTer / scripts

Notebook collection for different purposes
0 stars 0 forks source link

3D-wind dataframe #9

Closed AlexDo1 closed 3 years ago

AlexDo1 commented 3 years ago

3D-wind data (u, v, w) from eddy data can be stored in a generic 3D table with the column names value1, value2 and value3 and the timestamp as index. These generic column names must be mapped to the variable names u, v, w when a user extracts (reads) the data from metacatalog.

An idea to do this is to implement the key _colmapping in the details.

The get_details() function must be modified to distinguish between keys that start without an underscore ('normal' keywords) and keys that start with an underscore ('settings' keywords) and append the _colmapping information to the entry as a property (self.property).

As a last step, reader.py must be modified to use the information in _colmapping to map the column names.

With this solution, we could use a generic table with the column names value1, value2 and value3 and map these columnnames to u, v and w.

Necessary steps:

AlexDo1 commented 3 years ago

I´m not sure about everything I've written here.

We were talking about the get_details() function but I cannot find the function anywhere, is this the right function that has to be modified? Or is it the entry function get_data(), which has to be called when someone wants to extract/read data.

I also do not quite understand the self.property part. For example, if I run something like entry._colmapping, it should display the colmapping information? So the colmapping information should be stored as an attribute of the entry after running get_details()?

Aaaaaand this topic is probably better off in the metacatalog repository.

mmaelicke commented 3 years ago

I´m not sure about everything I've written here.

We were talking about the get_details() function but I cannot find the function anywhere, is this the right function that has to be modified? Or is it the entry function get_data(), which has to be called when someone wants to extract/read data.

The function is actually called details_dict:

https://github.com/VForWaTer/metacatalog/blob/b9fa4857008b94f4a2abb6328e553e32c6573ae0/metacatalog/models/entry.py#L376

I also do not quite understand the self.property part.

Yeah, 'property' was a bad synonyme as a property is a real thing in Python. These functions that behave like read-only attributes. The main problem we were referring to is, that the Entry class would have to pickup the column-mapping and pass it to the reader (and writer) functions. These functions accept **kwargs, thus passing them is easy. They just need a fixed name, the read look for, like settings or props.

Anyway, I think the better avenue is https://github.com/VForWaTer/metacatalog/issues/124 Check the example out and commet on this avenue. This would also make this issue obsolete.