From e2ca62c456567fc62af44aac90cdc4d2530e1629 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Fri, 20 Aug 2021 16:24:42 +0200
Subject: [PATCH] L2SS-347: Deal with reading scalar values correctly, that is,
 do not convert them into arrays.

---
 devices/clients/opcua_client.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/devices/clients/opcua_client.py b/devices/clients/opcua_client.py
index dc85a6f4f..0167ad95e 100644
--- a/devices/clients/opcua_client.py
+++ b/devices/clients/opcua_client.py
@@ -197,16 +197,16 @@ class ProtocolAttribute:
         """
         Read_R function
         """
-        value = numpy.array(self.node.get_value())
+        value = self.node.get_value()
 
         if self.dim_y + self.dim_x == 1:
             # scalar
             return value
         elif self.dim_y != 0:
-            value = numpy.array(numpy.split(value, indices_or_sections=self.dim_y))
-        elif self.dim_y + self.dim_x == 1:
-            value = [numpy.array(value)]
+            # 2D array
+            value = numpy.array(numpy.split(numpy.array(value), indices_or_sections=self.dim_y))
         else:
+            # 1D array
             value = numpy.array(value)
 
         return value
-- 
GitLab