Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jonas Plewinski
pystencils
Commits
a4179362
Commit
a4179362
authored
Apr 23, 2018
by
Martin Bauer
Browse files
Bug fix: using than 3 spatial dimensions for field possible now
parent
32b97ae5
Changes
1
Hide whitespace changes
Inline
Side-by-side
field.py
View file @
a4179362
...
...
@@ -573,6 +573,7 @@ def offset_component_to_direction_string(coordinate_id: int, value: int) -> str:
>>> offset_component_to_direction_string(1, 2)
'2N'
"""
assert
0
<=
coordinate_id
<
3
,
"Works only for at most 3D arrays"
name_components
=
((
'W'
,
'E'
),
# west, east
(
'S'
,
'N'
),
# south, north
(
'B'
,
'T'
))
# bottom, top
...
...
@@ -600,6 +601,8 @@ def offset_to_direction_string(offsets: Sequence[int]) -> str:
>>> offset_to_direction_string(([-3, 0, -2]))
'2B3W'
"""
if
len
(
offsets
)
>
3
:
return
str
(
offsets
)
names
=
[
""
,
""
,
""
]
for
i
in
range
(
len
(
offsets
)):
names
[
i
]
=
offset_component_to_direction_string
(
i
,
offsets
[
i
])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment