This is an automated email from the ASF dual-hosted git repository.

rkk pushed a commit to branch SDAP-534
in repository https://gitbox.apache.org/repos/asf/sdap-ingester.git

commit ab6877df7530f83dd6828b8dff37a7ad3a826741
Author: rileykk <[email protected]>
AuthorDate: Thu Feb 20 08:04:55 2025 -0800

    CM: Support pathed data variables
    
    Will identify and include them in special list in `granule` section of RMQ 
message
---
 .../services/CollectionProcessor.py                  | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git 
a/collection_manager/collection_manager/services/CollectionProcessor.py 
b/collection_manager/collection_manager/services/CollectionProcessor.py
index 2413552..597df5c 100644
--- a/collection_manager/collection_manager/services/CollectionProcessor.py
+++ b/collection_manager/collection_manager/services/CollectionProcessor.py
@@ -151,6 +151,23 @@ class CollectionProcessor:
             'processors': 
CollectionProcessor._get_default_processors(collection)
         }
 
+        group_vars = []
+
+        for name, value in collection.dimension_names:
+            if name != 'variable':
+                continue
+            else:
+                value = json.loads(value)
+
+                if isinstance(value, str):
+                    value = [value]
+
+                for v in value:
+                    parts = v.split('/')
+
+                    if len(parts) > 1:
+                        group_vars.append(v)
+
         if collection.preprocess is not None:
             config_dict['preprocess'] = json.loads(collection.preprocess)
 
@@ -160,6 +177,9 @@ class CollectionProcessor:
         if collection.group is not None:
             config_dict['granule']['group'] = collection.group
 
+        if len(group_vars) > 0:
+            config_dict['granule']['grouped_vars'] = group_vars
+
         config_str = yaml.dump(config_dict)
         logger.debug(f"Templated dataset config:\n{config_str}")
         return config_str

Reply via email to