From 0708e6beff91939ac8f5477e3c499e0efb980f2b Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Wed, 30 Aug 2023 10:59:50 -0500
Subject: [PATCH] snapshot...

---
 modules/util/util.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/modules/util/util.py b/modules/util/util.py
index b850bab5..993b8edc 100644
--- a/modules/util/util.py
+++ b/modules/util/util.py
@@ -55,6 +55,11 @@ ds_range.update({'temp_3_9um_nom': 'actual_range'})
 ds_range.update({'cloud_fraction': 'actual_range'})
 
 
+class MyGenericException(Exception):
+    def __init__(self, message):
+        self.message = message
+
+
 def make_tf_callable_generator(the_generator):
     class MyCallable:
         def __init__(self, gen):
@@ -522,7 +527,7 @@ def make_times(dt_str_0, dt_str_1=None, format_code='%Y-%m-%d_%H:%M', num_steps=
 def normalize(data, param, mean_std_dict, copy=True):
 
     if mean_std_dict.get(param) is None:
-        return data
+        raise MyGenericException(param + ': not found in dictionary')
 
     if copy:
         data = data.copy()
@@ -547,7 +552,7 @@ def denormalize(data, param, mean_std_dict, copy=True):
         data = data.copy()
 
     if mean_std_dict.get(param) is None:
-        return data
+        raise MyGenericException(param + ': not found in dictionary')
 
     shape = data.shape
     data = data.flatten()
@@ -566,7 +571,7 @@ def scale(data, param, mean_std_dict, copy=True):
         data = data.copy()
 
     if mean_std_dict.get(param) is None:
-        return data
+        raise MyGenericException(param + ': not found in dictionary')
 
     shape = data.shape
     data = data.flatten()
@@ -589,7 +594,7 @@ def descale(data, param, mean_std_dict, copy=True):
         data = data.copy()
 
     if mean_std_dict.get(param) is None:
-        return data
+        raise MyGenericException(param + ': not found in dictionary')
 
     shape = data.shape
     data = data.flatten()
-- 
GitLab