From a41793622c9dae78fd0d738d297edb5f33154822 Mon Sep 17 00:00:00 2001
From: Martin Bauer <martin.bauer@fau.de>
Date: Mon, 23 Apr 2018 10:23:05 +0200
Subject: [PATCH] Bug fix: using than 3 spatial dimensions for field possible
 now

---
 field.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/field.py b/field.py
index 6fec4010d..b9b6648cf 100644
--- a/field.py
+++ b/field.py
@@ -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])
-- 
GitLab