Index: /trunk/tools/generic.py
===================================================================
--- /trunk/tools/generic.py	(revision 806)
+++ /trunk/tools/generic.py	(revision 807)
@@ -18,14 +18,30 @@
 cV = '@'
 # List of available operations
-operations=['grid_combinations', 'PolyArea', 'rmNOnum',                              \
+operations=['coincident_CFtimes', 'count_cond', 'grid_combinations', 'PolyArea',     \
+  'radial_points',                                                                   \
+  'rmNOnum', 'running_mean',                                                         \
   'significant_decomposition', 'squared_radial',                                     \
-  'unitsDate']
-
+  'unitsDate', 'wdismean']
+
+hundredvals = '0'
+for i in range(1,100): hundredvals = hundredvals + '@' + str(i)
+
+vs100 = '0@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@26@27'
+vs100 = vs100 + '@28@29@30@31@32@33@34@35@36@37@38@39@40@41@42@43@44@45@46@47@48@49'
+vs100 = vs100 + '@50@51@52@53@54@55@56@57@58@59@60@61@62@63@64@65@66@67@68@69@70@71'
+va100 = vs100 + '@72@73@74@75@76@77@78@79@80@81@82@83@84@85@86@87@88@89@90@91@92@93'
+va100 = vs100 + '@94@95@96@97@98@99'
+
+## e.g. # generic.py -o 'coincident_CFtimes' -S '0@1@2@3@4@5@6@7@8@9,seconds since 1949-12-01 00:00:00,hours since 1949-12-01 00:00:00'
+## e.g. # generic.py -o count_cond -S 0@1@2@3@4@5@6@7@8@9,4,le
 ## e.g. # generic.py -o grid_combinations -S 1,2
 ## e.g. # generic.py -o PolyArea -S -0.5@0.5@0.5@-0.5,0.5@0.5@-0.5@-0.5
+## e.g. # generic.py -o radial_points -S 0.785398163397,5
 ## e.g. # generic.py -o rmNOnum -S LMD123IPSL
 ## e.g. # generic.py -o significant_decomposition -S 3.576,-2
 ## e.g. # generic.py -o unitsDate -S '19490101000000,19760217082932,second'
+## e.g. # generic.py -o running_mean -S 0@1@2@3@4@5@6@7@8@9,10
 ## e.g. # generic.py -o squared_radial -S 3
+## e.g. # generic.py -o wdismean -S 0.005@0.005,0.@1.@2.@3.
 
 operationnames = "'" + gen.numVector_String(operations, "', '") + "'"
@@ -53,4 +69,37 @@
             print getattr(object, opern).__doc__
 
+elif oper == 'coincident_CFtimes':
+    Nvals = 3
+    vals = opts.values.split(cS)
+    if vals[0] == 'h':
+        print gen.coincident_CFtimes.__doc__
+        quit(-1)
+    else:
+        if len(vals) != Nvals:
+            print errormsg
+            print '  ' + main + ": operation '" + oper + "' requires", Nvals, 'and', \
+              len(vals), ' has passed!!'
+            print gen.coincident_CFtimes.__doc__
+            quit(-1)
+        vals0 = np.array(vals[0].split('@'), dtype=np.float)
+        print gen.coincident_CFtimes(vals0, vals[1], vals[2])
+
+elif oper == 'count_cond':
+    Nvals = 3
+    vals = opts.values.split(cS)
+    if vals[0] == 'h':
+        print gen.count_cond.__doc__
+        quit(-1)
+    else:
+        if len(vals) != Nvals:
+            print errormsg
+            print '  ' + main + ": operation '" + oper + "' requires", Nvals, 'and', \
+              len(vals), ' has passed!!'
+            print gen.count_cond.__doc__
+            quit(-1)
+        vals0 = np.array(vals[0].split('@'), dtype=np.float)
+        print gen.count_cond(np.array(vals[0].split('@'), dtype=np.float),           \
+          np.float(vals[1]), vals[2])
+
 elif oper == 'grid_combinations':
     Nvals = 2
@@ -87,4 +136,19 @@
         print gen.PolyArea(xvals, yvals)
 
+elif oper == 'radial_points':
+    Nvals = 2
+    vals = opts.values.split(cS)
+    if vals[0] == 'h':
+        print gen.radial_points.__doc__
+        quit(-1)
+    else:
+        if len(vals) != Nvals:
+            print errormsg
+            print '  ' + main + ": operation '" + oper + "' requires", Nvals, 'and', \
+              len(vals), ' has passed!!'
+            print gen.radial_points.__doc__
+            quit(-1)
+        print gen.radial_points(np.float(vals[0]), int(vals[1]))
+
 elif oper == 'rmNOnum':
     Nvals = 1
@@ -102,4 +166,19 @@
         print gen.rmNOnum(vals[0])
 
+elif oper == 'running_mean':
+    Nvals = 2
+    vals = opts.values.split(cS)
+    if vals[0] == 'h':
+        print gen.running_mean.__doc__
+        quit(-1)
+    else:
+        if len(vals) != Nvals:
+            print errormsg
+            print '  ' + main + ": operation '" + oper + "' requires", Nvals, 'and', \
+              len(vals), ' has passed!!'
+            print gen.running_mean.__doc__
+            quit(-1)
+        print gen.running_mean(np.array(vals[0].split('@'), dtype=np.float), int(vals[1]))
+
 elif oper == 'significant_decomposition':
     Nvals = 2
@@ -147,2 +226,20 @@
         print gen.unitsDate(vals[0], vals[1], vals[2])
 
+elif oper == 'wdismean':
+    Nvals = 2
+    vals = opts.values.split(cS)
+    if vals[0] == 'h':
+        print gen.wdismean.__doc__
+        quit(-1)
+    else:
+        if len(vals) != Nvals:
+            print errormsg
+            print '  ' + main + ": operation '" + oper + "' requires", Nvals, 'and', \
+              len(vals), ' has passed!!'
+            print gen.wdismean.__doc__
+            quit(-1)
+        vals0 = np.array(vals[0].split('@'), dtype=np.float)
+        vals1 = np.array(vals[1].split('@'), dtype=np.float).reshape(2,2)
+
+        print gen.wdismean(vals0, vals1)
+
