Index: trunk/tools/validation_sim.py
===================================================================
--- trunk/tools/validation_sim.py	(revision 528)
+++ trunk/tools/validation_sim.py	(revision 529)
@@ -1145,8 +1145,8 @@
 
 
-def getting_ValidationValues(okind, dimt, ds, trjpos, ovs, ovo, tvalues, oFill, Ng, kvals):
+def getting_ValidationValues(okind, dt, ds, trjpos, ovs, ovo, tvalues, oFill, Ng, kvals):
     """ Function to get the values to validate accroding to the type of observation
       okind= observational kind
-      dimt= initial number of values to retrieve
+      dt= initial number of values to retrieve
       ds= dictionary with the names of the dimensions (sim, obs)
       trjpos= positions of the multi-stations (t, Y, X) or trajectory ([Z], Y, X)
@@ -1171,12 +1171,12 @@
 
     if kvals == 'instantaneous':
-        dimtf = dimt
+        dtf = dt
     elif kvals == 'tbackwardSmean':
         print '  ' + fname + ':',kvals,'!!'
         uniqt = np.unique(tvalues[:,3])
-        dimtf = len(uniqt)
-        print '    initially we got',dimt,'values which will become',dimtf
+        dtf = len(uniqt)
+        print '    initially we got',dt,'values which will become',dtf
         postf = {}
-        for it in range(dimtf):
+        for it in range(dtf):
             if it == 0:
                 postf[uniqt[it]] = [0,0]
@@ -1192,6 +1192,6 @@
         print '  ' + fname + ':',kvals,'!!'
         uniqt = np.unique(tvalues[:,2])
-        dimtf = len(uniqt)
-        print '     initially we got',dimt,'values which will become',dimtf
+        dtf = len(uniqt)
+        print '     initially we got',dt,'values which will become',dtf
         print '     ==== NOT READY === '
         quit(-1)
@@ -1203,23 +1203,23 @@
 # Simulated values spatially around
     if ds.has_key('Z'):
-        soSvalues = np.zeros((dimt, Ng*2+1, Ng*2+1, Ng*2+1), dtype = np.float)
+        soSvalues = np.zeros((dt, Ng*2+1, Ng*2+1, Ng*2+1), dtype = np.float)
         if okind == 'trajectory':
-            trjs = np.zeros((4,dimt), dtype=int)
+            trjs = np.zeros((4,dt), dtype=int)
         else:
             trjs = None
     else:
-        soSvalues = np.zeros((dimt, Ng*2+1, Ng*2+1), dtype = np.float)
+        soSvalues = np.zeros((dt, Ng*2+1, Ng*2+1), dtype = np.float)
         if okind == 'trajectory':
-            trjs = np.zeros((3,dimt), dtype=int)
+            trjs = np.zeros((3,dt), dtype=int)
         else:
             trjs = None
 
     if okind == 'single-station':
-        soTtvalues = np.zeros((dimt,2), dtype=np.float)
+        soTtvalues = np.zeros((dt,2), dtype=np.float)
     else:
         None
 
     if okind == 'multi-points':
-        for it in range(dimt):
+        for it in range(dt):
             slicev = ds['X'][0] + ':' + str(trjpos[2,it]) + '|' +  ds['Y'][0] +      \
               ':' + str(trjpos[1,it]) + '|' + ds['T'][0]+ ':' + str(tvalues[it][0])
@@ -1234,5 +1234,5 @@
 
     elif okind == 'single-station':
-        for it in range(dimt):
+        for it in range(dt):
             ito = int(tvalues[it,1])
             if valdimsim.has_key('X') and valdimsim.has_key('Y'):
@@ -1262,5 +1262,5 @@
                 itoi = 0
                 itof = int(tvalues[it,1]) / 2
-            elif it == dimt-1:
+            elif it == dt-1:
                 itoi = int( (ito + int(tvalues[it-1,1])) / 2)
                 itof = int(tvalues[it,1])
@@ -1276,5 +1276,5 @@
     elif okind == 'trajectory':
         if ds.has_key('Z'):
-            for it in range(dimt):
+            for it in range(dt):
                 ito = int(tvalues[it,1])
                 if notfound[ito] == 0:
@@ -1318,5 +1318,5 @@
 # 2D trajectory
         else:
-            for it in range(dimt):
+            for it in range(dt):
                 if notfound[it] == 0:
                     ito = tvalues[it,1]
@@ -1350,22 +1350,22 @@
         fsovalues = []
         if ds.has_key('Z'):
-            fsoSvalues = np.zeros((dimtf, Ng*2+1, Ng*2+1, Ng*2+1), dtype = np.float)
+            fsoSvalues = np.zeros((dtf, Ng*2+1, Ng*2+1, Ng*2+1), dtype = np.float)
             if okind == 'trajectory':
-                ftrjs = np.zeros((4,dimtf), dtype=int)
+                ftrjs = np.zeros((4,dtf), dtype=int)
             else:
                 ftrjs = None
         else:
-            fsoSvalues = np.zeros((dimtf, Ng*2+1, Ng*2+1), dtype = np.float)
+            fsoSvalues = np.zeros((dtf, Ng*2+1, Ng*2+1), dtype = np.float)
             if okind == 'trajectory':
-                ftrjs = np.zeros((3,dimtf), dtype=int)
+                ftrjs = np.zeros((3,dtf), dtype=int)
             else:
                 ftrjs = None
 
         if okind == 'single-station':
-            fsoTtvalues = np.zeros((dimtf,2), dtype=np.float)
+            fsoTtvalues = np.ones((dtf,2), dtype=np.float)*fillValueF
         else:
             None
 
-        for it in range(1,dimtf):
+        for it in range(1,dtf):
             tv = uniqt[it]
             intv = postf[tv]
@@ -1405,6 +1405,6 @@
         print '  ' + fname + ':',kvals,'!!'
         uniqt = np.unique(tvalues[:,2])
-        dimtf = len(uniqt)
-        print '     initially we got',dimt,'values which will become',dimtf
+        dtf = len(uniqt)
+        print '     initially we got',dt,'values which will become',dtf
 
     return 
@@ -1940,5 +1940,8 @@
 
     for kst in range(Nstsim):
+        simobsvalues = [] 
+       
         timedn = prestdescsim[kst] + 'time'
+        timeobsdn = prestdescsim[kst] + 'obstime'
         print '    ' + prestdescsim[kst] + ' ...'
 
@@ -1990,7 +1993,8 @@
             if ivar == 0:
                 vname = prestdescsim[kst] + 'time'
-                newvar = onewnc.createVariable(vname,'f8', (timedn))
+                newvar = onewnc.createVariable(vname,'f8', (timedn),                 \
+                  fill_value = fillValueF)
                 basicvardef(newvar, vname, 'simulation time between observations',   \
-                  obstunits )
+                  obstunits)
                 set_attribute(newvar, 'calendar', 'standard')
                 set_attribute(newvar, 'bounds', 'time_bnds')
@@ -2106,5 +2110,4 @@
 # Statistics around sim values
         aroundstats = np.zeros((5,dimt), dtype=np.float)
-        print 'Lluis dimt:',dimt,simobsSvalues.shape
         for it in range(dimt):
             aroundstats[0,it] = np.min(simobsSvalues[it,])
@@ -2123,7 +2126,12 @@
 
 # obs Values to netCDF
-        newvar = onewnc.createVariable(valvars[ivar][1] + '_' + stdescsim[kst] +     \
+        if stdescsim[kst] != 'E':
+            newvar = onewnc.createVariable(valvars[ivar][1] + '_' + stdescsim[kst] + \
+          'obs', 'f', (timeobsdn), fill_value=fillValueF)
+        else:
+            newvar = onewnc.createVariable(valvars[ivar][1] + '_' + stdescsim[kst] + \
           'obs', 'f', (timedn), fill_value=fillValueF)
-        descvar = prestdescsim[kst] + ' time simulated: ' + valvars[ivar][1]
+       
+        descvar = prestdescsim[kst] + ' time observed: ' + valvars[ivar][1]
         basicvardef(newvar, valvars[ivar][1], descvar, ovobs.getncattr('units'))
         newvar[:] = arrayvals[:,1]
@@ -2150,5 +2158,5 @@
 
 
-# around sim Statistics between
+# around sim Statistics
         if not searchInlist(onewnc.variables,prestdescsim[kst] + valvars[ivar][0] +  \
           'staround'):
