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
28 stars 9 forks source link

{Python} extractTs (age column selection) #67

Open nickmckay opened 4 years ago

nickmckay commented 4 years ago

Hi Nick,

I'm having a problem with the python lipd utilities: for one proxy record, extractTs uses the wrong ages.

The proxy is "Alley.GISP2.2000". Before doing extractTs, there are three time columns: "year", "age", and "kyryr BP2". I think "age" is the one we should be using, but the extractTs function uses "kyryr BP2" instead, which seems to be a different age model in units of kyr. I haven't gone through the python LiPD utilities extensively, but I suspect that the problem is in lines 265-267 of timeseries.py, copied below:

        # special case for year bp, or any variation of it. Translate key to "age""
        if "bp" in k.lower():
            s = "age"

So, in a case where a key has the string "bp", the code appears to use those values as the ages. This will obviously cause a problem when it uses "kyryr BP2" instead of "age", but I'm wondering if it may cause other problems too, where it grabs the wrong ages. "bp" is a very small string, which might result in unwatched matches. Plus, I think the code should check to see whether there is a key called "age" first, which it does not appear to do. I only noticed it in this case because the units were in kyr instead of years, so there may be other cases where the wrong ages are chosen.

Like I said, though, I haven't looked at this code extensively, so perhaps I'm missing something. Is there someone who could look at/update this code?

Michael Erb

Assistant Research Professor School of Earth and Sustainability

Northern Arizona University

michaelerb commented 3 years ago

Any update on this issue?