[Scipy-svn] r2585 - trunk/Lib/sandbox/timeseries

scipy-svn at scipy.org scipy-svn at scipy.org
Mon Jan 22 09:28:18 CST 2007


Author: mattknox_ca
Date: 2007-01-22 09:28:14 -0600 (Mon, 22 Jan 2007)
New Revision: 2585

Modified:
   trunk/Lib/sandbox/timeseries/tcore.py
Log:
changed fmtObserv so that the large representation is always return for a given observed string

Modified: trunk/Lib/sandbox/timeseries/tcore.py
===================================================================
--- trunk/Lib/sandbox/timeseries/tcore.py	2007-01-21 23:55:03 UTC (rev 2584)
+++ trunk/Lib/sandbox/timeseries/tcore.py	2007-01-22 15:28:14 UTC (rev 2585)
@@ -42,6 +42,14 @@
 #####---------------------------------------------------------------------------
 #---- --- Option conversion ---
 #####---------------------------------------------------------------------------
+fmtobs_dict = {'UNDEF': ['UNDEF','UNDEFINED'],
+               'BEGINNING': ['BEGIN','BEGINNING'],
+               'ENDING': ['END','ENDING'],
+               'AVERAGED': ['AVERAGE','AVERAGE','MEAN'],
+               'SUMMED': ['SUM','SUMMED'],
+               'MAXIMUM': ['MAX','MAXIMUM','HIGH'],
+               'MINIMUM': ['MIN','MINIMUM','LOW']}
+
 obs_dict = {"UNDEFINED":None,
             "UNDEF":None,
             "BEGIN": first_unmasked_val,
@@ -59,13 +67,15 @@
             "MIN": MA.minimum,
             }
 obsDict = obs_dict
+fmtobs_revdict = reverse_dict(fmtobs_dict)
+
 #
 def fmtObserv(obStr):
     "Converts a possible 'Observed' string into acceptable values."
     if obStr is None:
         return None
-    elif obStr.upper() in obs_dict.keys():
-        return obStr.upper()    
+    elif obStr.upper() in fmtobs_revdict:
+        return fmtobs_revdict[obStr.upper()]
     else:
         raise ValueError("Invalid value for observed attribute: %s " % str(obStr))
 



More information about the Scipy-svn mailing list