nickmckay / LiPD-utilities

Input/output and manipulation utilities for LiPD files in Matlab, R and Python
http://nickmckay.github.io/LiPD-utilities/
GNU General Public License v2.0
29 stars 9 forks source link

Python: lipd.readLipd() fails to read files with ensembles in the measurementTables #78

Open nickmckay opened 3 years ago

nickmckay commented 3 years ago

It is often convenient for files to include age and/or data ensembles in the measurementTables, however reading these fails in the python utilities. An example of file with both age and d18O ensembles is in the measurementTable is here.

chrismheiser commented 3 years ago

@nickmckay This is doable, but I'm assessing how widespread this is going to affect other functions. For example, this is something that I've wanted to fix in the lipd.net playground for a while, but it is pretty messy doing the One-to-many metadata columns to CSV columns in the code. Something to keep in mind.

It's more approachable in Python, and fixable, but it affects more than just readLipd(), because writeLipd() will need to be adjusted, along with some other functions like calculating inferred data. I'll need to list out everything that needs updating.

nickmckay commented 3 years ago

@chrismheiser sorry, took me awhile to respond. It's important that ensemble columns can be properly represented in python in any table (at least ensemble and measurement). I don't remember this being particularly difficult in R, just that read/write properly uses the column field for csv/writing. In R, the values are represented as a matrix, and it's agnostic about the number of columns in that matrix, so writing just checks for the number of columns, then writes the appropriate numbers into the column metadata.

On the playground, I think that visualizing ensemble columns is less important, so long as it reads and writes them properly, and that they're clearly identified as ensemble columns in the metadata (maybe a different color?). I think python is the higher priority for now.

chrismheiser commented 3 years ago

The python portion of this task is completed. Pushed package 0.2.8.6. Supports full ensemble tables and inline ensemble tables. It may need further testing for other functions, but as far as readLipd and writeLipd, it's working as expected.