Index: /trunk/tools/create_OBSnetcdf.py
===================================================================
--- /trunk/tools/create_OBSnetcdf.py	(revision 586)
+++ /trunk/tools/create_OBSnetcdf.py	(revision 587)
@@ -122,6 +122,11 @@
       varTYPE='|' list of variable types ('D', 'F', 'I', 'I64', 'S')
       varOPER='|' list of operations to do to the variables to meet their units ([oper],[val])
-        [oper]=-,sumc,subc,mulc,divc (nothing, add, rest, multiply and divide)
-
+        [oper]:
+          -, nothing
+          sumc, add [val]
+          subc, rest [val]
+          mulc, multiply by [val]
+          divc, divide by [val]
+          rmchar,[val],[pos], remove [val] characters from [pos]='B', beginning, 'E', end
       NAMElon=name of the variable with the longitude (x position)
       NAMElat=name of the variable with the latitude (y position)
@@ -202,5 +207,5 @@
     fname = 'value_fmt'
 
-    aopers = ['sumc','subc','mulc','divc']
+    aopers = ['sumc','subc','mulc','divc', 'rmchar']
 
     fmts = ['D', 'F', 'I', 'I64', 'S']
@@ -211,8 +216,8 @@
             newval = None
         else:
-            print 'op:',op
+            print 'op: **' + op + '**'
             if op != '-':
                 opern = op.split(',')[0]
-                operv = np.float(op.split(',')[1])
+                operv = op.split(',')[1]
 
                 if not searchInlist(aopers,opern):
@@ -223,5 +228,5 @@
             else:
                 opern = 'sumc'
-                operv = 0.
+                operv = '0.'
 
             if not searchInlist(fmts, fmt):
@@ -236,4 +241,16 @@
                     elif opern == 'mulc': newval = np.float32(val) * opv
                     elif opern == 'divc': newval = np.float32(val) / opv
+                    elif opern == 'rmchar': 
+                        opv = int(operv)
+                        Lval = len(val)
+                        if op.split(',')[2] == 'B':
+                            newval = np.float32(val[opv:Lval+1])
+                        elif op.split(',')[2] == 'E':
+                            newval = np.float32(val[Lval-opv:Lval])
+                        else:
+                            print errormsg
+                            print '  ' + fname + ": operation '" + opern + "' not " +\
+                              " work with '" + op.split(',')[2] + "' !!"
+                            quit(-1)
                 elif fmt == 'F':
                     opv = np.float(operv)
@@ -242,4 +259,17 @@
                     elif opern == 'mulc': newval = np.float(val) * opv
                     elif opern == 'divc': newval = np.float(val) / opv
+                    elif opern == 'rmchar': 
+                        opv = int(operv)
+                        Lval = len(val)
+                        if op.split(',')[2] == 'B':
+                            newval = np.float(val[opv:Lval+1])
+                        elif op.split(',')[2] == 'E':
+                            newval = np.float(val[0:Lval-opv])
+                        else:
+                            print errormsg
+                            print '  ' + fname + ": operation '" + opern + "' not " +\
+                              " work with '" + op.split(',')[2] + "' !!"
+                            quit(-1)
+
                 elif fmt == 'I':
                     opv = int(operv)
@@ -248,4 +278,16 @@
                     elif opern == 'mulc': newval = int(val) * opv
                     elif opern == 'divc': newval = int(val) / opv
+                    elif opern == 'rmchar': 
+                        opv = int(operv)
+                        Lval = len(val)
+                        if op.split(',')[2] == 'B':
+                            newval = int(val[opv:Lval+1])
+                        elif op.split(',')[2] == 'E':
+                            newval = int(val[0:Lval-opv])
+                        else:
+                            print errormsg
+                            print '  ' + fname + ": operation '" + opern + "' not " +\
+                              " work with '" + op.split(',')[2] + "' !!"
+                            quit(-1)
                 elif fmt == 'I64':
                     opv = np.int64(operv)
@@ -254,6 +296,32 @@
                     elif opern == 'mulc': newval = np.int64(val) * opv
                     elif opern == 'divc': newval = np.int64(val) / opv
+                    elif opern == 'rmchar': 
+                        opv = int(operv)
+                        Lval = len(val)
+                        if op.split(',')[2] == 'B':
+                            newval = np.int64(val[opv:Lval+1])
+                        elif op.split(',')[2] == 'E':
+                            newval = np.int64(val[0:Lval-opv])
+                        else:
+                            print errormsg
+                            print '  ' + fname + ": operation '" + opern + "' not " +\
+                              " work with '" + op.split(',')[2] + "' !!"
+                            quit(-1)
                 elif fmt == 'S':
-                    newval = val
+                    if opern == 'rmchar': 
+                        opv = int(operv)
+                        Lval = len(val)
+                        if op.split(',')[2] == 'B':
+                            newval = val[opv:Lval+1]
+                        elif op.split(',')[2] == 'E':
+                            newval = val[0:Lval-opv]
+                        else:
+                            print errormsg
+                            print '  ' + fname + ": operation '" + opern + "' not " +\
+                              " work with '" + op.split(',')[2] + "' !!"
+                            quit(-1)
+                    else:
+                        newval = val
+
     else:
         newval = None
@@ -886,5 +954,5 @@
         print '      excess of formats for:', formats[Nshow:len(formats)+1]
 
-    quit(-1)
+#    quit(-1)
 
 # Reading values
