File: Specify-dtype-for-ragged-array.patch

package info (click to toggle)
casa-formats-io 0.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,200 kB
  • sloc: python: 1,926; ansic: 124; makefile: 15
file content (25 lines) | stat: -rw-r--r-- 1,127 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
From: Ole Streicher <olebole@debian.org>
Date: Fri, 20 Jan 2023 15:06:31 +0100
Subject: Specify dtype for ragged array

Newer versions of numpy require dtype=object for ragged arrays.
See NEP 34.

Closes: #1029244
---
 casa_formats_io/casa_low_level_io/data_managers/standard.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/casa_formats_io/casa_low_level_io/data_managers/standard.py b/casa_formats_io/casa_low_level_io/data_managers/standard.py
index e455d9f..bb58fb5 100644
--- a/casa_formats_io/casa_low_level_io/data_managers/standard.py
+++ b/casa_formats_io/casa_low_level_io/data_managers/standard.py
@@ -205,7 +205,7 @@ class StandardStMan(BaseCasaObject):
                             subshape.append(read_int32(fi))
                         size = int(np.product(subshape))
                         values.append(read_as_numpy_array(fi, coldesc.value_type, size, shape=subshape[::-1]))
-                    data.append(np.array(values))
+                    data.append(np.array(values, dtype=object))
         if data:
             if data[0].ndim > 1:
                 return np.vstack(data)