Skip to content

Commit

Permalink
Fix path for 2d
Browse files Browse the repository at this point in the history
  • Loading branch information
awarde96 committed Oct 29, 2024
1 parent 5d5465f commit a29d489
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions covjsonkit/encoder/Path.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def from_polytope(self, result):

self.walk_tree(result, fields, coords, mars_metadata, range_dict)

if len(fields["l"]) == 0:
fields["l"] = [0]

logging.debug("The values returned from walking tree: %s", range_dict) # noqa: E501
logging.debug("The coordinates returned from walking tree: %s", coords) # noqa: E501
logging.debug("The fields: %s", fields)
Expand Down Expand Up @@ -155,6 +158,8 @@ def from_polytope(self, result):
for cor in coord[int(start) : int(end)]:
if len(fields["l"]) == 1:
coords[date]["composite"].append([s, cor[0], cor[1], fields["l"][0]])
elif len(fields["l"]) == 0:
coords[date]["composite"].append([s, cor[0], cor[1], level])
else:
coords[date]["composite"].append([s, cor[0], cor[1], fields["l"][i]])
start = end
Expand Down
5 changes: 4 additions & 1 deletion covjsonkit/encoder/VerticalProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,13 @@ def func(
tree.values = [float(val) for val in tree.values]
tree.result = [float(val) for val in tree.result]
# para_intervals = int(num_intervals/len(param))
try:
len(param)
except TypeError:
raise ValueError("No parameters were returned, date requested may be out of range")
len_paras = len(param)
len_levels = len(param)
len_nums = len_paras * len(levels)

for date in dates:

coords[date]["x"] = [lat]
Expand Down

0 comments on commit a29d489

Please sign in to comment.