Index: trunk/tools/diag_tools.py
===================================================================
--- trunk/tools/diag_tools.py	(revision 2618)
+++ trunk/tools/diag_tools.py	(revision 2619)
@@ -1142,4 +1142,18 @@
           z=zpl[:].transpose(), hgt=hgt.transpose(), d1=dx, d2=dy, d3=dz, d4=dt)
         zmla = pzmla.transpose()
+
+    elif len(theta.shape) == 2:
+        zmla= np.zeros((theta.shape[0], theta.shape[1]), dtype=np.float)
+
+        dz = theta.shape[1]
+        dt = theta.shape[0]
+        zmladims.pop(1)
+        zmlavdims.pop(1)
+
+        pzmla= fdin.module_fordiagnostics.compute_zmla_generic2d(                    \
+          tpot=theta[:].transpose(), qratio=qratio[:].transpose(),                   \
+          z=zpl[:].transpose(), hgt=hgt, d1=dz, d2=dt)
+        zmla = pzmla.transpose()
+
     else:
         print errormsg
Index: trunk/tools/diagnostics.py
===================================================================
--- trunk/tools/diagnostics.py	(revision 2618)
+++ trunk/tools/diagnostics.py	(revision 2619)
@@ -2120,4 +2120,47 @@
         ncvar.insert_variable(ncobj, 'vaz', diagout2, diagoutd, diagoutvd, newnc)
 
+# zmla_gen generic boundary layer hieght computation from generic 2D-file theta, qv, zg, orog, 
+    elif diagn == 'zmlagen':
+        var0 = ncobj.variables[depvars[0]][:]
+        var1 = ncobj.variables[depvars[1]][:]
+        dimz = var0.shape[1]
+        var2 = ncobj.variables[depvars[2]][:]
+        var3 = ncobj.variables[depvars[3]][:]
+
+        diagout, diagoutd, diagoutvd = diag.Forcompute_zmla_gen(var0,var1,var2,var3, \
+          dnames,dvnames)
+
+        # Removing the nonChecking variable-dimensions from the initial list
+        varsadd = []
+        for nonvd in NONchkvardims:
+            if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd)
+            varsadd.append(nonvd)
+
+        ncvar.insert_variable(ncobj, 'zmla', diagout, diagoutd, diagoutvd, newnc)
+
+# zmla_genUWsnd generic boundary layer hieght computation from UWyoming sounding file theta, qv, zg 
+    elif diagn == 'zmlagenUWsnd':
+        var0 = ncobj.variables[depvars[0]][:]
+        var1 = ncobj.variables[depvars[1]][:]
+        dimz = var0.shape[1]
+        var2 = ncobj.variables[depvars[2]][:]
+        var3 = ncobj.getncattr('Station_elevation')
+
+        # Wrong order of dimensions !
+        var0 = var0.transpose()
+        var1 = var1.transpose()
+        var2 = var2.transpose()
+
+        diagout, diagoutd, diagoutvd = diag.Forcompute_zmla_gen(var0,var1,var2,var3, \
+          dnames,dvnames)
+
+        # Removing the nonChecking variable-dimensions from the initial list
+        varsadd = []
+        for nonvd in NONchkvardims:
+            if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd)
+            varsadd.append(nonvd)
+
+        ncvar.insert_variable(ncobj, 'zmla', diagout, diagoutd, diagoutvd, newnc)
+
     else:
         print errormsg
Index: trunk/tools/module_ForDiagnostics.f90
===================================================================
--- trunk/tools/module_ForDiagnostics.f90	(revision 2618)
+++ trunk/tools/module_ForDiagnostics.f90	(revision 2619)
@@ -691,4 +691,75 @@
 
   END SUBROUTINE compute_zmla_generic4D
+
+  SUBROUTINE compute_zmla_generic2D(tpot, qratio, z, hgt, zmla1D, d1, d2)
+! Subroutine to compute pbl-height following a generic method
+!    from Nielsen-Gammon et al., 2008 J. Appl. Meteor. Clim.
+!    applied also in Garcia-Diez et al., 2013, QJRMS
+!   where 
+!     "The technique identifies the ML height as a threshold increase of potential temperature from 
+!       its minimum value within the boundary layer."
+!   here applied similarly to Garcia-Diez et al. where 
+!      zmla = "...first level where potential temperature exceeds the minimum potential temperature
+!        reached in the mixed layer by more than 1.5 K"
+
+    IMPLICIT NONE
+
+    INTEGER, INTENT(in)                                  :: d1, d2
+    REAL(r_k), DIMENSION(d1,d2), INTENT(in)              :: tpot, qratio, z
+    REAL(r_k), INTENT(in)                                :: hgt
+    REAL(r_k), DIMENSION(d2), INTENT(out)                :: zmla1D
+ 
+! Local
+    INTEGER                                              :: it, iz, newd1, newd2, newd3, mind
+    REAL(r_k), DIMENSION(d1)                             :: var1, var2, var3
+    CHARACTER(len=3)                                     :: newd1S, newd2S, newd3S, itS
+
+!!!!!!! Variables
+! tpot: potential air temperature [K]
+! qratio: water vapour mixing ratio [kgkg-1]
+! z: height above sea level [m]
+! hgt: terrain height [m]
+! zmla1D: boundary layer height from surface [m]
+
+    fname = 'compute_zmla_generic2D'
+
+    DO it=1, d2
+      ! Removing missing value
+      CALL rm_values_vecRK(d1, qratio(:,it), fillval64, newd1, var1)
+      CALL rm_values_vecRK(d1, tpot(:,it), fillval64, newd2, var2)
+      CALL rm_values_vecRK(d1, z(:,it), fillval64, newd3, var3)
+
+      IF ( newd1 /= 0 .AND. newd2 /= 0 .AND. newd3 /= 0) THEN
+        IF ((newd1 /= newd2) .OR. (newd1 /= newd3)) THEN
+          WRITE(itS, '(I3)')it
+          WRITE(newd1S, '(I3)')newd1
+          WRITE(newd2S, '(I3)')newd2
+          WRITE(newd3S, '(I3)')newd3
+          msg = "At it= " // TRIM(itS) //" Not coindident amount of levels for all 3 variables " //   &
+            "qratio: " // TRIM(newd1S) //", tpot: " // TRIM(newd2S) //" and z: " // TRIM(newd3S)
+          PRINT *, TRIM(msg)
+          ! Filtering only for simultaneous valid values
+          newd1 = 0
+          DO iz=1, d1
+            IF ((qratio(iz,it) /= fillval64) .AND. (tpot(iz,it) /= fillval64) .AND.                   &
+              (z(iz,it) /= fillval64)) THEN
+              newd1 = newd1 + 1
+              var1(newd1)= qratio(iz,it)
+              var2(newd1)= tpot(iz,it)
+              var3(newd1)= z(iz,it)
+            END IF
+          END DO
+          newd2 = newd1
+          newd3 = newd1
+        END IF
+        CALL var_zmla_generic(newd1, var1(1:newd1), var2(1:newd2), var3(1:newd3), hgt, zmla1D(it))
+      ELSE
+        zmla1D(it) = fillval64
+      END IF
+    END DO
+
+    RETURN
+
+  END SUBROUTINE compute_zmla_generic2D
 
   SUBROUTINE compute_zwind4D(ua, va, z, uas, vas, sina, cosa, zextrap, uaz, vaz, d1, d2, d3, d4)
