Skip to content

Commit

Permalink
Automatically add interpretation rank if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
IKCAP committed Jul 26, 2024
1 parent c64b041 commit 2d501f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions pylipd/globals/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@
'.Interpretation',
'{@index}'
],
'@fromJson': ['_add_interpretation_rank'],
'@toJson_pre': [
'_set_units_label',
'_set_seasonality_labels',
Expand Down
7 changes: 7 additions & 0 deletions pylipd/utils/lipd_to_rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,13 @@ def _wrap_integration_time(self, obj, objhash) :

return [obj, objhash, []]

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) :
objid = obj["@id"]
# Deal with uncertainty
Expand Down

0 comments on commit 2d501f9

Please sign in to comment.