Skip to content
Snippets Groups Projects
Commit a4179362 authored by Martin Bauer's avatar Martin Bauer
Browse files

Bug fix: using than 3 spatial dimensions for field possible now

parent 32b97ae5
Branches
Tags
No related merge requests found
...@@ -573,6 +573,7 @@ def offset_component_to_direction_string(coordinate_id: int, value: int) -> str: ...@@ -573,6 +573,7 @@ def offset_component_to_direction_string(coordinate_id: int, value: int) -> str:
>>> offset_component_to_direction_string(1, 2) >>> offset_component_to_direction_string(1, 2)
'2N' '2N'
""" """
assert 0 <= coordinate_id < 3, "Works only for at most 3D arrays"
name_components = (('W', 'E'), # west, east name_components = (('W', 'E'), # west, east
('S', 'N'), # south, north ('S', 'N'), # south, north
('B', 'T')) # bottom, top ('B', 'T')) # bottom, top
...@@ -600,6 +601,8 @@ def offset_to_direction_string(offsets: Sequence[int]) -> str: ...@@ -600,6 +601,8 @@ def offset_to_direction_string(offsets: Sequence[int]) -> str:
>>> offset_to_direction_string(([-3, 0, -2])) >>> offset_to_direction_string(([-3, 0, -2]))
'2B3W' '2B3W'
""" """
if len(offsets) > 3:
return str(offsets)
names = ["", "", ""] names = ["", "", ""]
for i in range(len(offsets)): for i in range(len(offsets)):
names[i] = offset_component_to_direction_string(i, offsets[i]) names[i] = offset_component_to_direction_string(i, offsets[i])
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment