Index: trunk/tools/validation_sim.py
===================================================================
--- trunk/tools/validation_sim.py	(revision 497)
+++ trunk/tools/validation_sim.py	(revision 498)
@@ -1035,5 +1035,5 @@
     return
 
-def getting_ValidationValues(okind, dimt, ds, trjpos, ovs, ovo, tvalues, ofill, Ng):
+def getting_ValidationValues(okind, dimt, ds, trjpos, ovs, ovo, tvalues, oFill, Ng):
     """ Function to get the values to validate accroding to the type of observation
       okind= observational kind
@@ -1044,10 +1044,11 @@
       ovs= object with the values of the observations
       tvalues= temporal values (sim. time step, obs. time step, sim t value, obs t value, t diff)
-      ofill= Fill Value for the observations
+      oFill= Fill Value for the observations
       Ng= number of grid points around the observation
     return:
       sovalues= simulated values at the observation point and time
       soSvalues= values Ngrid points around the simulated point
-      soTvalues= inital/ending period between two consecutive obsevations (for `single-station')
+      soTvalues= values around observed times (for `single-station')
+      soTtvalues= inital/ending period between two consecutive obsevations (for `single-station')
       trjs= trajectory on the simulation space
     """
@@ -1063,5 +1064,5 @@
             trjs = np.zeros((4,dimt), dtype=int)
         else:
-            trjS = None
+            trjs = None
     else:
         soSvalues = np.zeros((dimt, Ng*2+1, Ng*2+1), dtype = np.float)
@@ -1069,5 +1070,5 @@
             trjs = np.zeros((3,dimt), dtype=int)
         else:
-            trjS = None
+            trjs = None
 
     if okind == 'single-station':
@@ -1206,5 +1207,5 @@
 
 
-    return sovalues, soSvalues, soTvalues, trjs
+    return sovalues, soSvalues, soTvalues, soTtvalues, trjs
 
 
@@ -1445,4 +1446,5 @@
           [valdimobs['X'][it],valdimobss['Y'][it]])
 elif obskind == 'single-station':
+    trajpos = None
     stationpos = np.zeros((2), dtype=int)
     if valdimsim.has_key('X') and valdimsim.has_key('Y'):
@@ -1570,5 +1572,4 @@
   'observed times) coincident times between simulation and observations'
 print '  ',coindtvalues
-quit()
 
 if Ncoindt == 0:
@@ -1668,145 +1669,13 @@
     if searchInlist(ovobs.ncattrs(),'_FillValue'): 
         oFillValue = ovobs.getncattr('_FillValue')
-
-    simobsvalues, simobsSvalues, simobsTvalues, trjsim =                             \
+    else:
+        oFillValue = None
+
+# Observed values temporally around coincident times
+    simobsvalues, simobsSvalues, simobsTvalues, simobsTtvalues, trjsim =             \
         getting_ValidationValues(obskind, Ncoindt, dims, trajpos, ovsim, ovobs,      \
-        coindtvalues, ofillValue, Ngrid)
-    quit(-1)
-
-
-# Simulated values spatially around coincident times
-    if dims.has_key('Z'):
-        simobsSvalues = np.zeros((Ncoindt, Ngrid*2+1, Ngrid*2+1, Ngrid*2+1),         \
-          dtype = np.float)
-    else:
-        simobsSvalues = np.zeros((Ncoindt, Ngrid*2+1, Ngrid*2+1), dtype = np.float)
-
-# Observed values temporally around coincident times
-    simobsTvalues = {}
-    simobsTtvalues = np.zeros((Ncoindt,2), dtype=np.float)
-
-    if obskind == 'multi-points':
-        for it in range(Ncoindt):
-            slicev = dims['X'][0] + ':' + str(trajpos[2,it]) + '|' +                 \
-              dims['Y'][0]+ ':' + str(trajpos[1,it]) + '|' +                         \
-              dims['T'][0]+ ':' + str(coindtvalues[it][0])
-            slicevar, dimslice = slice_variable(ovsim, slicev)
-            simobsvalues.append([ slicevar, ovobs[coindtvalues[it][1]]])
-            slicev = dims['X'][0] + ':' + str(trajpos[2,it]-Ngrid) + '@' +           \
-              str(trajpos[2,it]+Ngrid) + '|' + dims['Y'][0] + ':' +                  \
-              str(trajpos[1,it]-Ngrid) + '@' + str(trajpos[1,it]+Ngrid) + '|' +      \
-              dims['T'][0]+':'+str(coindtvalues[it][0])
-            slicevar, dimslice = slice_variable(ovsim, slicev)
-            simobsSvalues[it,:,:] = slicevar
-
-    elif obskind == 'single-station':
-        for it in range(Ncoindt):
-            ito = int(coindtvalues[it,1])
-            if valdimsim.has_key('X') and valdimsim.has_key('Y'):
-                slicev = dims['X'][0] + ':' + str(stationpos[1]) + '|' +             \
-                  dims['Y'][0] + ':' + str(stationpos[0]) + '|' +                    \
-                  dims['T'][0] + ':' + str(int(coindtvalues[it][0]))
-            else:
-                slicev = dims['T'][0] + ':' + str(int(coindtvalues[it][0]))
-            slicevar, dimslice = slice_variable(ovsim, slicev)
-            if ovobs[int(ito)] == oFillValue or ovobs[int(ito)] == '--':
-                simobsvalues.append([ slicevar, fillValueF])
-#            elif ovobs[int(ito)] != ovobs[int(ito)]: 
-#                simobsvalues.append([ slicevar, fillValueF])
-            else:
-                simobsvalues.append([ slicevar, ovobs[int(ito)]])
-            if valdimsim.has_key('X') and valdimsim.has_key('Y'):
-                slicev = dims['X'][0] + ':' + str(stationpos[1]-Ngrid) + '@' +       \
-                  str(stationpos[1]+Ngrid+1) + '|' + dims['Y'][0] + ':' +            \
-                  str(stationpos[0]-Ngrid) + '@' + str(stationpos[0]+Ngrid+1) + '|' +\
-                  dims['T'][0] + ':' + str(int(coindtvalues[it,0]))
-            else:
-                slicev = dims['T'][0] + ':' + str(int(coindtvalues[it][0]))
-            slicevar, dimslice = slice_variable(ovsim, slicev)
-            simobsSvalues[it,:,:] = slicevar
-
-            if it == 0:
-                itoi = 0
-                itof = int(coindtvalues[it,1]) / 2
-            elif it == Ncoindt-1:
-                itoi = int( (ito + int(coindtvalues[it-1,1])) / 2)
-                itof = int(coindtvalues[it,1])
-            else:
-                itod = int( (ito - int(coindtvalues[it-1,1])) / 2 ) 
-                itoi = ito - itod
-                itod = int( (int(coindtvalues[it+1,1]) - ito) / 2 )
-                itof = ito + itod
-
-            slicev = dims['T'][1] + ':' + str(itoi) + '@' + str(itof + 1)
-
-            slicevar, dimslice = slice_variable(ovobs, slicev)
-            simobsTvalues[str(it)] = slicevar
-
-            simobsTtvalues[it,0] = valdimobs['T'][itoi]
-            simobsTtvalues[it,1] = valdimobs['T'][itof]
-
-    elif obskind == 'trajectory':
-        if dims.has_key('Z'):
-            for it in range(Ncoindt):
-                ito = int(coindtvalues[it,1])
-                if notfound[ito] == 0:
-                    trajpos[2,ito] = index_mat(valdimsim['Z'][coindtvalues[it,0],:,  \
-                      trajpos[1,ito],trajpos[0,ito]], valdimobs['Z'][ito])
-                    slicev = dims['X'][0]+':'+str(trajpos[0,ito]) + '|' +            \
-                      dims['Y'][0]+':'+str(trajpos[1,ito]) + '|' +                   \
-                      dims['Z'][0]+':'+str(trajpos[2,ito]) + '|' +                   \
-                      dims['T'][0]+':'+str(int(coindtvalues[it,0]))
-                    slicevar, dimslice = slice_variable(ovsim, slicev)
-                    simobsvalues.append([ slicevar, ovobs[int(ito)]])
-                    minx = np.max([trajpos[0,ito]-Ngrid,0])
-                    maxx = np.min([trajpos[0,ito]+Ngrid+1,ovsim.shape[3]])
-                    miny = np.max([trajpos[1,ito]-Ngrid,0])
-                    maxy = np.min([trajpos[1,ito]+Ngrid+1,ovsim.shape[2]])
-                    minz = np.max([trajpos[2,ito]-Ngrid,0])
-                    maxz = np.min([trajpos[2,ito]+Ngrid+1,ovsim.shape[1]])
-
-                    slicev = dims['X'][0] + ':' + str(minx) + '@' + str(maxx) + '|' +\
-                      dims['Y'][0] + ':' + str(miny) + '@' + str(maxy) + '|' +       \
-                      dims['Z'][0] + ':' + str(minz) + '@' + str(maxz) + '|' +       \
-                      dims['T'][0] + ':' + str(int(coindtvalues[it,0]))
-                    slicevar, dimslice = slice_variable(ovsim, slicev)
-
-                    sliceS = []
-                    sliceS.append(it)
-                    sliceS.append(slice(0,maxz-minz))
-                    sliceS.append(slice(0,maxy-miny))
-                    sliceS.append(slice(0,maxx-minx))
-
-                    simobsSvalues[tuple(sliceS)] = slicevar
-                    if ivar == 0:
-                        trjsim[0,it] = trajpos[0,ito]
-                        trjsim[1,it] = trajpos[1,ito]
-                        trjsim[2,it] = trajpos[2,ito]
-                        trjsim[3,it] = coindtvalues[it,0]
-                else:
-                    simobsvalues.append([fillValueF, fillValueF])
-                    simobsSvalues[it,:,:,:]= np.ones((Ngrid*2+1,Ngrid*2+1,Ngrid*2+1),\
-                      dtype = np.float)*fillValueF
-        else:
-            for it in range(Ncoindt):
-                if notfound[it] == 0:
-                    ito = coindtvalues[it,1]
-                    slicev = dims['X'][0]+':'+str(trajpos[2,ito]) + '|' +            \
-                      dims['Y'][0]+':'+str(trajpos[1,ito]) + '|' +                   \
-                      dims['T'][0]+':'+str(coindtvalues[ito,0])
-                    slicevar, dimslice = slice_variable(ovsim, slicev)
-                    simobsvalues.append([ slicevar, ovobs[coindtvalues[it,1]]])
-                    slicev = dims['X'][0] + ':' + str(trajpos[0,it]-Ngrid) + '@' +   \
-                      str(trajpos[0,it]+Ngrid) + '|' + dims['Y'][0] + ':' +          \
-                      str(trajpos[1,it]-Ngrid) + '@' + str(trajpos[1,it]+Ngrid) +    \
-                      '|' + dims['T'][0] + ':' + str(coindtvalues[it,0])
-                    slicevar, dimslice = slice_variable(ovsim, slicev)
-                    simobsSvalues[it,:,:] = slicevar
-                else:
-                    simobsvalues.append([fillValue, fillValue])
-                    simobsSvalues[it,:,:] = np.ones((Ngrid*2+1,Ngrid*2+1),           \
-                      dtype = np.float)*fillValueF
-                print simobsvalues[varsimobs][:][it]
-
+        coindtvalues, oFillValue, Ngrid)
+
+# Re-arranging values...
     arrayvals = np.array(simobsvalues)
     if len(valvars[ivar]) > 2:
