From ac1e3c9608241e84ca4662ca360fb46d9f9667dd Mon Sep 17 00:00:00 2001
From: Romain Broucquart <romain.broucquart@synchrotron-soleil.fr>
Date: Mon, 23 May 2022 12:07:43 +0200
Subject: [PATCH] Fix chunkerize to handle spectrum data

* Multiply the number of points per the number of elements
---
 core/ArchiveExtractor.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/core/ArchiveExtractor.py b/core/ArchiveExtractor.py
index 01f6ca2..b66027a 100755
--- a/core/ArchiveExtractor.py
+++ b/core/ArchiveExtractor.py
@@ -481,6 +481,9 @@ class ArchiveExtractor:
             List of datetime giving the limit of each chunks.
             For N chunks, there is N+1 elements in cdates, as the start and end boundaries are included.
         """
+        info=self.infoattr(attribute)
+        self.logger.debug("Attribute information \n%s"%info)
+
         # Get the number of points
         N=self.extractor.GetAttDataBetweenDatesCount([
                 attribute,
@@ -489,6 +492,11 @@ class ArchiveExtractor:
                 ])
         self.logger.debug("On the period, there is %d entries"%N)
 
+        dx=int(info["max_dim_x"])
+        if dx > 1:
+            self.logger.debug("Attribute is a vector with max dimension = %s"%dx)
+            N=N*dx
+
         # If data chunk is too much, we need to cut it
         if N > Nmax:
             dt = (dateStop-dateStart)/(N//Nmax)
-- 
GitLab