Skip to content

Commit

Permalink
Bugfix for values not in vocab
Browse files Browse the repository at this point in the history
  • Loading branch information
IKCAP committed Jul 26, 2024
1 parent 2d501f9 commit 58241aa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pylipd/utils/legacy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def extract(self, d, whichtables="meas", mode="paleo", time="age"):
_pc = "chronData"
_root["mode"] = _pc
_root["time_id"] = time
_root["archiveType"] = d["archiveType"]
if "archiveType" in d:
_root["archiveType"] = d["archiveType"]
try:
# Build the root level data.
# This will serve as the template for which column data will be added onto later.
Expand Down
1 change: 0 additions & 1 deletion pylipd/utils/lipd_to_rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ def _add_interpretation_rank(self, obj, objhash):
if "rank" not in obj or type(obj["rank"]) != int:
rank = obj["@index"] - 1
obj["rank"] = rank
print(obj["@id"], obj["rank"])
return [obj, objhash, []]

def _wrap_uncertainty(self, obj, objhash) :
Expand Down
12 changes: 12 additions & 0 deletions pylipd/utils/rdf_to_lipd.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,8 @@ def _set_archive_type_label(self, ds, parent = None) :
id = ds["hasArchiveType"]["@id"]
if id in RSYNONYMS:
ds["archiveType"] = RSYNONYMS[id]
else:
ds["archiveType"] = ds["hasArchiveType"]["label"]
del ds["hasArchiveType"]
return ds

Expand All @@ -517,6 +519,8 @@ def _set_variable_name_from_standard_variable_label(self, var, parent = None) :
id = var["hasStandardVariable"]["@id"]
if id in RSYNONYMS:
var["variableName"] = RSYNONYMS[id]
else:
var["variableName"] = var["hasStandardVariable"]["label"]
del var["hasStandardVariable"]
return var

Expand All @@ -527,6 +531,8 @@ def _set_units_label(self, var, parent = None) :
id = var["hasUnits"]["@id"]
if id in RSYNONYMS:
var["units"] = RSYNONYMS[id]
else:
var["units"] = var["hasUnits"]["label"]
del var["hasUnits"]
return var

Expand All @@ -537,6 +543,8 @@ def _set_proxy_label(self, var, parent = None) :
id = var["hasProxy"]["@id"]
if id in RSYNONYMS:
var["proxy"] = RSYNONYMS[id]
else:
var["proxy"] = var["hasProxy"]["label"]
del var["hasProxy"]
return var

Expand All @@ -547,6 +555,8 @@ def _set_proxy_general_label(self, var, parent = None) :
id = var["hasProxyGeneral"]["@id"]
if id in RSYNONYMS:
var["proxyGeneral"] = RSYNONYMS[id]
else:
var["proxyGeneral"] = var["hasProxyGeneral"]["label"]
del var["hasProxyGeneral"]
return var

Expand All @@ -564,6 +574,8 @@ def _set_seasonality_labels(self, interp, parent = None) :
nid = convs[pid]
if id in RSYNONYMS:
interp[nid] = RSYNONYMS[id]
else:
interp[nid] = interp[pid]["label"]
del interp[pid]
return interp

Expand Down

0 comments on commit 58241aa

Please sign in to comment.