Index: palm/trunk/SCRIPTS/NCL/.ncl_preferences
===================================================================
--- palm/trunk/SCRIPTS/NCL/.ncl_preferences	(revision 173)
+++ palm/trunk/SCRIPTS/NCL/.ncl_preferences	(revision 174)
@@ -73,3 +73,5 @@
 ___ze________________[1;2;...]__________________________________default = zdim____________[CS]
 zdim
+___prof3d____________[0] or [1]_________________________________default = 0_______________[PR]
+0
 ___end of file ".ncl_preferences"_____________________________________________________________
Index: palm/trunk/SCRIPTS/NCL/cross_sections.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/cross_sections.ncl	(revision 173)
+++ palm/trunk/SCRIPTS/NCL/cross_sections.ncl	(revision 174)
@@ -11,10 +11,10 @@
    ; ***************************************************
 
-   if (isfilepresent("~/.ncl_preferences")) then
-      parameter = asciiread("~/.ncl_preferences",75,"string")
+   if (isfilepresent(".ncl_preferences")) then
+      parameter = asciiread(".ncl_preferences",77,"string")
       delete(parameter@_FillValue)
    else
       print(" ")
-      print("Please copy '.ncl_preferences' into your $home dircetory")
+      print("'.ncl_preferences' is not existent")
       print(" ")
       exit
Index: palm/trunk/SCRIPTS/NCL/profiles.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/profiles.ncl	(revision 173)
+++ palm/trunk/SCRIPTS/NCL/profiles.ncl	(revision 174)
@@ -9,10 +9,10 @@
    ; ***************************************************
 
-   if (isfilepresent("~/.ncl_preferences")) then
-      parameter = asciiread("~/.ncl_preferences",75,"string")
+   if (isfilepresent(".ncl_preferences")) then
+      parameter = asciiread(".ncl_preferences",77,"string")
       delete(parameter@_FillValue)
    else
       print(" ")
-      print("Please copy '.ncl_preferences' into your $home dircetory")
+      print("'.ncl_preferences' is not existent")
       print(" ")
       exit
@@ -117,4 +117,17 @@
       end if
    end if
+
+   if (.not. isvar("prof3d"))then
+      prof3d = 0
+      if (stringtointeger(parameter(75)) .NE. 0) then
+         prof3d = stringtointeger(parameter(75))
+         if (stringtointeger(parameter(75)) .NE. 1) then
+            print(" ")
+            print("Please set 'prof3d' to 0 or 1")
+            print(" ")
+            exit
+         end if   
+      end if
+   end if
   
    ; ***************************************************
@@ -123,5 +136,5 @@
 
    f=addfile( file_in,"r")
-   
+
    vNam = getfilevarnames(f) 
    print(" ")
@@ -129,4 +142,5 @@
    print(" ")
    dim = dimsizes(vNam)
+  
    if (dim .EQ. 0) then
       print(" ")
@@ -135,4 +149,6 @@
    end if
 
+   if (prof3d .EQ. 0) then
+
    do varn = dim-1,0,1
       if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
@@ -140,90 +156,91 @@
          continue
       end if
-      if (vNam(varn) .EQ. "u")
-         z_u = f->zu
+      if (vNam(varn) .EQ. "u" .OR. isStrSubset(vNam(varn), "u_"))
+         z_u = f->$vNam(varn+1)$
          break
       else
-         if (vNam(varn) .EQ. "v")then
-            z_u = f->zv
+         if (vNam(varn) .EQ. "v" .OR. isStrSubset(vNam(varn), "v_"))then
+  
+            z_u = f->$vNam(varn+1)$
             break
          else
-            if(vNam(varn) .EQ. "pt")then
-               z_u = f->zpt
+            if(vNam(varn) .EQ. "pt" .OR. isStrSubset(vNam(varn), "pt_"))then
+               z_u = f->$vNam(varn+1)$
                break
             else
-               if(vNam(varn) .EQ. "vpt")then
-                  z_u = f->zvpt 
+               if(vNam(varn) .EQ. "vpt" .OR. isStrSubset(vNam(varn), "vpt_"))then
+                  z_u = f->$vNam(varn+1)$
                   break
                else
-                  if(vNam(varn) .EQ. "lpt")then
-                     z_u = f->zlpt 
+                  if(vNam(varn) .EQ. "lpt" .OR. isStrSubset(vNam(varn), "lpt_"))then
+                     z_u = f->$vNam(varn+1)$ 
                      break
                   else   
-                     if(vNam(varn) .EQ. "q")then
-                        z_u = f->zq 
+                     if(vNam(varn) .EQ. "q" .OR. isStrSubset(vNam(varn), "q_") )then
+                        z_u = f->$vNam(varn+1)$ 
                         break
                      else
-                        if(vNam(varn) .EQ. "qv")then
-                           z_u = f->zqv 
+                        if(vNam(varn) .EQ. "qv" .OR. isStrSubset(vNam(varn), "qv_"))then
+                           z_u = f->$vNam(varn+1)$ 
                            break
                         else
-                           if(vNam(varn) .EQ. "ql")then
-                              z_u = f->zql 
+                           if(vNam(varn) .EQ. "ql" .OR. isStrSubset(vNam(varn), "ql_"))then
+                              z_u = f->$vNam(varn+1)$ 
                               break
                            else
-                              if(vNam(varn) .EQ. "rho")then
-                                 z_u = f->zrho 
+                              if(vNam(varn) .EQ. "rho" .OR. isStrSubset(vNam(varn), "rho_"))then
+                                 z_u = f->$vNam(varn+1)$ 
                                  break
                               else
-                                 if(vNam(varn) .EQ. "s")then
-                                    z_u = f->zs 
+                                 if(vNam(varn) .EQ. "s" .OR. isStrSubset(vNam(varn), "s_") )then
+                                    z_u = f->$vNam(varn+1)$ 
                                     break
                                  else
-                                    if(vNam(varn) .EQ. "sa")then
-                                       z_u = f->zsa 
+                                    if(vNam(varn) .EQ. "sa" .OR. isStrSubset(vNam(varn), "sa_"))then
+                                       z_u = f->$vNam(varn+1)$ 
                                        break
                                     else
-                                       if(vNam(varn) .EQ. "e")then
-                                          z_u = f->ze 
+                                       if(vNam(varn) .EQ. "e" .OR. isStrSubset(vNam(varn), "e_"))then
+                                          z_u = f->$vNam(varn+1)$ 
                                           break
                                        else
-                                          if(vNam(varn) .EQ. "es")then
-                                             z_u = f->zes 
+                                          if(vNam(varn) .EQ. "es" .OR. isStrSubset(vNam(varn), "es_"))then
+                                             z_u = f->$vNam(varn+1)$ 
                                              break
                                           else
-                                             if(vNam(varn) .EQ. "km")then
-                                                z_u = f->zkm 
+                                             if(vNam(varn) .EQ. "km" .OR. isStrSubset(vNam(varn), "km_"))then
+                                                z_u = f->$vNam(varn+1)$ 
                                                 break
                                              else
-                                                if(vNam(varn) .EQ. "kh")then
-                                                   z_u = f->zkh 
+                                                if(vNam(varn) .EQ. "kh" .OR. isStrSubset(vNam(varn), "kh_"))then
+                                                   z_u = f->$vNam(varn+1)$ 
                                                    break
                                                 else
-                                                   if(vNam(varn) .EQ. "l")then
-                                                      z_u = f->zl 
+                                                   if(vNam(varn) .EQ. "l" .OR. isStrSubset(vNam(varn), "l_"))then
+                                                      z_u = f->$vNam(varn+1)$ 
                                                       break
                                                    else
-                                                      if(vNam(varn) .EQ. "us2")then
-                                                         z_u = f->zus2 
+                                                      if(vNam(varn) .EQ. "us2" .OR. isStrSubset(vNam(varn), "us2_"))then
+                                                         z_u = f->$vNam(varn+1)$ 
                                                          break
                                                       else
-                                                         if(vNam(varn) .EQ. "vs2")then
-                                                            z_u = f->zvs2 
+                                                         if(vNam(varn) .EQ. "vs2" .OR. isStrSubset(vNam(varn), "vs2_") )then
+                                                            z_u = f->$vNam(varn+1)$ 
                                                             break
                                                          else
-                                                            if(vNam(varn) .EQ. "pts2")then
-                                                               z_u = f->zpts2 
+                                                            if(vNam(varn) .EQ. "pts2" .OR. isStrSubset(vNam(varn), "pts2_"))then
+                                                               z_u = f->$vNam(varn+1)$ 
                                                                break
                                                             else
-                                                               if(vNam(varn) .EQ. "wsususodz")then
-                                                                  z_u = f->zwsususodz 
+                                                               if(vNam(varn) .EQ. "wsususodz" .OR. isStrSubset(vNam(varn), "wsususodz_"))then
+                                                                  z_u = f->$vNam(varn+1)$ 
                                                                   break
                                                                else
-                                                                  if(vNam(varn) .EQ. "wspsodz")then
-                                                                     z_u = f->zwspsodz 
+                                                                  if(vNam(varn) .EQ. "wspsodz" .OR. isStrSubset(vNam(varn), "wspsodz_"))then
+                                                                     z_u = f->$vNam(varn+1)$ 
                                                                      break
                                                                   else
-                                                                     if(vNam(varn) .EQ. "wpeodz")then
-                                                                        z_u = f->zwpeodz
+                                                                     if(vNam(varn) .EQ. "wpeodz" .OR. isStrSubset(vNam(varn), "wpeodz_"))then
+                                                                        z_u = f->$vNam(varn+1)$
                                                                         break                                                                        
                                                                      end if
@@ -257,134 +274,134 @@
          continue
       end if 
-      if (vNam(varn) .EQ. "w")
-         z_w = f->zw
+      if (vNam(varn) .EQ. "w" .OR. isStrSubset(vNam(varn), "w_"))
+         z_w = f->$vNam(varn+1)$
          break
       else
-         if (vNam(varn) .EQ. "wpup")then
-            z_w = f->zwpup
+         if (vNam(varn) .EQ. "wpup" .OR. isStrSubset(vNam(varn), "wpup_"))then
+            z_w = f->$vNam(varn+1)$
             break
          else
-            if(vNam(varn) .EQ. "wsus")then
-               z_w = f->zwsus
+            if(vNam(varn) .EQ. "wsus" .OR. isStrSubset(vNam(varn), "wsus_"))then
+               z_w = f->$vNam(varn+1)$
                break
             else
-               if(vNam(varn) .EQ. "wu")then
-                  z_w = f->zwu 
+               if(vNam(varn) .EQ. "wu" .OR. isStrSubset(vNam(varn), "wu_"))then
+                  z_w = f->$vNam(varn+1)$ 
                   break
                else
-                  if(vNam(varn) .EQ. "wpvp")then
-                     z_w = f->zwpvp 
+                  if(vNam(varn) .EQ. "wpvp" .OR. isStrSubset(vNam(varn), "wpvp_"))then
+                     z_w = f->$vNam(varn+1)$ 
                      break
                   else   
-                     if(vNam(varn) .EQ. "wsvs")then
-                        z_w = f->zwsvs 
+                     if(vNam(varn) .EQ. "wsvs" .OR. isStrSubset(vNam(varn), "wsvs_"))then
+                        z_w = f->$vNam(varn+1)$ 
                         break
                      else
-                        if(vNam(varn) .EQ. "wv")then
-                           z_w = f->zwv 
+                        if(vNam(varn) .EQ. "wv" .OR. isStrSubset(vNam(varn), "wv_"))then
+                           z_w = f->$vNam(varn+1)$ 
                            break
                         else
-                           if(vNam(varn) .EQ. "wptpp")then
-                              z_w = f->zwptpp 
+                           if(vNam(varn) .EQ. "wptpp" .OR. isStrSubset(vNam(varn), "wptpp_"))then
+                              z_w = f->$vNam(varn+1)$ 
                               break
                            else
-                              if(vNam(varn) .EQ. "wspts")then
-                                 z_w = f->zwspts 
+                              if(vNam(varn) .EQ. "wspts" .OR. isStrSubset(vNam(varn), "wspts_"))then
+                                 z_w = f->$vNam(varn+1)$ 
                                  break
                               else
-                                 if(vNam(varn) .EQ. "wpt")then
-                                    z_w = f->zwpt
+                                 if(vNam(varn) .EQ. "wpt" .OR. isStrSubset(vNam(varn), "wpz_"))then
+                                    z_w = f->$vNam(varn+1)$
                                     break
                                  else
-                                    if(vNam(varn) .EQ. "wsptsBC")then
-                                       z_w = f->zwsptsBC 
+                                    if(vNam(varn) .EQ. "wsptsBC" .OR. isStrSubset(vNam(varn), "wsptsBC_"))then
+                                       z_w = f->$vNam(varn+1)$ 
                                        break
                                     else
-                                       if(vNam(varn) .EQ. "wptBC")then
-                                          z_w = f->zwptBC 
+                                       if(vNam(varn) .EQ. "wptBC" .OR. isStrSubset(vNam(varn), "wptBC_"))then
+                                          z_w = f->$vNam(varn+1)$ 
                                           break
                                        else
-                                          if(vNam(varn) .EQ. "wpvptp")then
-                                             z_w = f->zwpvptp 
+                                          if(vNam(varn) .EQ. "wpvptp" .OR. isStrSubset(vNam(varn), "wpvptp_"))then
+                                             z_w = f->$vNam(varn+1)$ 
                                              break
                                           else
-                                             if(vNam(varn) .EQ. "wsvpts")then
-                                                z_w = f->zwsvpts
+                                             if(vNam(varn) .EQ. "wsvpts" .OR. isStrSubset(vNam(varn), "wsvpts_"))then
+                                                z_w = f->$vNam(varn+1)$
                                                 break
                                              else
-                                                if(vNam(varn) .EQ. "wvpt")then
-                                                   z_w = f->zwvpt 
+                                                if(vNam(varn) .EQ. "wvpt" .OR. isStrSubset(vNam(varn), "wvpt_"))then
+                                                   z_w = f->$vNam(varn+1)$ 
                                                    break
                                                 else
-                                                   if(vNam(varn) .EQ. "wpqp")then
-                                                      z_w = f->zwpqp 
+                                                   if(vNam(varn) .EQ. "wpqp" .OR. isStrSubset(vNam(varn), "wpqp_"))then
+                                                      z_w = f->$vNam(varn+1)$ 
                                                       break
                                                    else
-                                                      if(vNam(varn) .EQ. "wsqs")then
-                                                         z_w = f->zwsqs 
+                                                      if(vNam(varn) .EQ. "wsqs" .OR. isStrSubset(vNam(varn), "wsqs_"))then
+                                                         z_w = f->$vNam(varn+1)$ 
                                                          break
                                                       else
-                                                         if(vNam(varn) .EQ. "wq")then
-                                                            z_w = f->zwq 
+                                                         if(vNam(varn) .EQ. "wq" .OR. isStrSubset(vNam(varn), "wq_"))then
+                                                            z_w = f->$vNam(varn+1)$ 
                                                             break
                                                          else
-                                                            if(vNam(varn) .EQ. "wpqvp")then
-                                                               z_w = f->zwpqvp 
+                                                            if(vNam(varn) .EQ. "wpqvp" .OR. isStrSubset(vNam(varn), "wpqvp_"))then
+                                                               z_w = f->$vNam(varn+1)$ 
                                                                break
                                                             else
-                                                               if(vNam(varn) .EQ. "wsqvs")then
-                                                                  z_w = f->zwsqvs 
+                                                               if(vNam(varn) .EQ. "wsqvs" .OR. isStrSubset(vNam(varn), "wsqvs_"))then
+                                                                  z_w = f->$vNam(varn+1)$ 
                                                                   break
                                                                else
-                                                                  if(vNam(varn) .EQ. "wqv")then
-                                                                     z_w = f->zwqv 
+                                                                  if(vNam(varn) .EQ. "wqv" .OR. isStrSubset(vNam(varn), "wqv_"))then
+                                                                     z_w = f->$vNam(varn+1)$ 
                                                                      break
                                                                   else
-                                                                     if(vNam(varn) .EQ. "wpsp")then
-                                                                        z_w = f->zwpsp
+                                                                     if(vNam(varn) .EQ. "wpsp" .OR. isStrSubset(vNam(varn), "wpsp_"))then
+                                                                        z_w = f->$vNam(varn+1)$
                                                                         break 
                                                                      else
-                                                                        if(vNam(varn) .EQ. "wsss")then
-                                                                           z_w = f->zwsss
+                                                                        if(vNam(varn) .EQ. "wsss" .OR. isStrSubset(vNam(varn), "wsss_"))then
+                                                                           z_w = f->$vNam(varn+1)$
                                                                            break 
                                                                         else
-                                                                           if(vNam(varn) .EQ. "ws")then
-                                                                              z_w = f->zws
+                                                                           if(vNam(varn) .EQ. "ws" .OR. isStrSubset(vNam(varn), "ws_"))then
+                                                                              z_w = f->$vNam(varn+1)$
                                                                               break 
                                                                            else
-                                                                              if(vNam(varn) .EQ. "wpsap")then
-                                                                                 z_w = f->zwpsap
+                                                                              if(vNam(varn) .EQ. "wpsap" .OR. isStrSubset(vNam(varn), "wpsap_"))then
+                                                                                 z_w = f->$vNam(varn+1)$
                                                                                  break 
                                                                               else
-                                                                                 if(vNam(varn) .EQ. "wssas")then
-                                                                                    z_w = f->zwssas
+                                                                                 if(vNam(varn) .EQ. "wssas" .OR. isStrSubset(vNam(varn), "wssas_") )then
+                                                                                    z_w = f->$vNam(varn+1)$
                                                                                     break 
                                                                                  else
-                                                                                    if(vNam(varn) .EQ. "wsa")then
-                                                                                       z_w = f->zwsa
+                                                                                    if(vNam(varn) .EQ. "wsa" .OR. isStrSubset(vNam(varn), "wsa_"))then
+                                                                                       z_w = f->$vNam(varn+1)$
                                                                                        break 
                                                                                     else
-                                                                                       if(vNam(varn) .EQ. "wses")then
-                                                                                          z_w = f->zwses
+                                                                                       if(vNam(varn) .EQ. "wses" .OR. isStrSubset(vNam(varn), "wses_"))then
+                                                                                          z_w = f->$vNam(varn+1)$
                                                                                           break 
                                                                                        else
-                                                                                          if(vNam(varn) .EQ. "ws2")then
-                                                                                             z_w = f->zws2
+                                                                                          if(vNam(varn) .EQ. "ws2" .OR. isStrSubset(vNam(varn), "ws2_"))then
+                                                                                             z_w = f->$vNam(varn+1)$
                                                                                              break 
                                                                                           else
-                                                                                             if(vNam(varn) .EQ. "ws3")then
-                                                                                                z_w = f->zws3
+                                                                                             if(vNam(varn) .EQ. "ws3" .OR. isStrSubset(vNam(varn), "ws3_"))then
+                                                                                                z_w = f->$vNam(varn+1)$
                                                                                                 break 
                                                                                              else
-                                                                                                if(vNam(varn) .EQ. "Sw")then
-                                                                                                   z_w = f->zSw
+                                                                                                if(vNam(varn) .EQ. "Sw" .OR. isStrSubset(vNam(varn), "Sw_"))then
+                                                                                                   z_w = f->$vNam(varn+1)$
                                                                                                    break 
                                                                                                 else
-                                                                                                   if(vNam(varn) .EQ. "ws2pts")then
-                                                                                                      z_w = f->zws2pts
+                                                                                                   if(vNam(varn) .EQ. "ws2pts".OR. isStrSubset(vNam(varn), "ws2pts_") )then
+                                                                                                      z_w = f->$vNam(varn+1)$
                                                                                                       break 
                                                                                                    else
-                                                                                                      if(vNam(varn) .EQ. "wspts2")then
-                                                                                                         z_w = f->zwspts2
+                                                                                                      if(vNam(varn) .EQ. "wspts2" .OR. isStrSubset(vNam(varn), "wspts2_"))then
+                                                                                                         z_w = f->$vNam(varn+1)$
                                                                                                          break                                            
                                                                                                       end if
@@ -463,8 +480,25 @@
       end if
    end if
+
+   else
+
+      do varn = dim-1,0,1
+         if (vNam(varn) .EQ. "zu_3d")
+            z_u = f->zu_3d  
+            dimz  = dimsizes(z_u)         
+         else 
+            if (vNam(varn) .EQ. "zw_3d")
+               z_w = f->zw_3d
+               dimz  = dimsizes(z_w)
+            end if
+         end if
+      end do
+
+   end if
+   
    t_all = f->time
    nt    = dimsizes(t_all)
    delta_t=t_all(nt-1)/nt
- 
+
    ; ****************************************************	
    ; start of time step and different types of mistakes that could be done
@@ -472,5 +506,5 @@
 
    if ( .not. isvar("start_time_step") ) then   	
-      start_time_step=t_all(1)/3600
+      start_time_step=t_all(0)/3600
       if (parameter(13) .NE. "t(0)") then
          if (stringtodouble(parameter(13)) .GT. t_all(nt-1)/3600)
@@ -482,10 +516,7 @@
             exit
          end if
-         if (stringtofloat(parameter(13)) .LE. t_all(0)/3600)
+         if (stringtofloat(parameter(13)) .LT. t_all(0)/3600)
             print(" ")
-            print("'start_time_step' = "+ parameter(13) +"h is equal or lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
-            print(" ")
-            print("Please start profiles at least with second time step = "+t_all(1)+"s = "+t_all(1)/3600+"h") 
-            print(" ")
+            print("'start_time_step' = "+ parameter(13) +"h is lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")           
             exit
          end if
@@ -501,18 +532,16 @@
          exit
       end if
-      if (start_time_step .LE. t_all(0)/3600)
+      if (start_time_step .LT. t_all(0)/3600)
          print(" ")
-         print("'start_time_step' = "+ start_time_step +"h is equal or lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
-         print(" ")
-         print("Please start profiles at least with second time step = "+t_all(1)+"s = "+t_all(1)/3600+"h")
-         print(" ")
+         print("'start_time_step' = "+ start_time_step +"h is lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
+        
          exit
       end if
    end if
    start_time_step = start_time_step*3600
-   if (start_time_step .GT. t_all(0) .AND. start_time_step .LT. t_all(1)+delta_t/2)then
-      st=1
-   end if
-   do i=2,nt-1     
+   ;if (start_time_step .GE. t_all(0) .AND. start_time_step .LT. t_all(1)+delta_t/2)then
+   ;   st=0
+   ;end if
+   do i=0,nt-1     
       if (start_time_step .GE. t_all(i)-delta_t/2 .AND. start_time_step .LT. t_all(i)+delta_t/2)then
          st=i
@@ -520,5 +549,5 @@
       end if
    end do
-  
+   
    ; ****************************************************
    ; end of time step and different types of mistakes that could be done
@@ -538,5 +567,5 @@
          if (stringtodouble(parameter(15)) .LT. start_time_step/3600)
             print(" ")
-            print("'end_time_step' = "+ parameter(15) +"h is lower than 'start_time_step' = "+parameter(13)+"h")
+            print("'end_time_step' = "+ parameter(15) +"h is lower than 'start_time_step' = "+start_time_step/3600+"h")
             print(" ")
             print("Please select another 'start_time_step' or 'end_time_step'")
@@ -565,8 +594,8 @@
    end if
    end_time_step = end_time_step*3600
-   if (end_time_step .GT. t_all(0) .AND. end_time_step .LT. t_all(1)+delta_t/2)then
-      et=1
-   end if
-   do i=2,nt-1     
+   ;if (end_time_step .GE. t_all(0) .AND. end_time_step .LT. t_all(1)+delta_t/2)then
+   ;   et=1
+   ;end if
+   do i=0,nt-1     
       if (end_time_step .GE. t_all(i)-delta_t/2 .AND. end_time_step .LT. t_all(i)+delta_t/2)then
          et=i
@@ -769,4 +798,5 @@
    t      = 0.0
    unit   = new(dim,string)
+   z_v    = new((/dim,dimz/),double)
 
    if (over .EQ. 1) then 
@@ -920,26 +950,45 @@
    n_o=0
    count_var=0
+
    do varn = 0,dim-1 
-        
-      temp = f->$vNam(varn)$
+
+      check = True
       
-      if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
-         check = False
+      if (prof3d .EQ. 0) then
+         if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
+            check = False
+         end if
       else
-         if (.not. isvar("var")) then
-            check = True
-            if (parameter(21) .NE. "variables") then
-               var=parameter(21)
-               check = isStrSubset( var,","+vNam(varn)+"," )
-            end if
-         else          
+         if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "zusi") .OR. isStrSubset( vNam(varn), "zwwi") .OR. isStrSubset( vNam(varn), "x") .OR. isStrSubset( vNam(varn), "xu") .OR. isStrSubset( vNam(varn), "y") .OR. isStrSubset( vNam(varn), "yv") .OR. isStrSubset( vNam(varn), "zu_3d") .OR. isStrSubset( vNam(varn), "zw_3d")) then
+            check = False
+         end if
+      end if
+
+      if (.not. isvar("var")) then
+         if (parameter(21) .NE. "variables") then
+            var=parameter(21)
             check = isStrSubset( var,","+vNam(varn)+"," )
          end if
+      else          
+         check = isStrSubset( var,","+vNam(varn)+"," )
       end if
 
       if (combine .EQ. 1) then         
          com=isStrSubset(c_var,","+vNam(varn)+"," )      
-         if (com)                       
-            data(varn,:,:) = temp(start_time_step:end_time_step,0:dimz-1)
+         if (com)      
+            if (prof3d .EQ. 0) then
+               temp = f->$vNam(varn)$
+               data(varn,:,:) = temp(start_time_step:end_time_step,0:dimz-1)
+            else
+               do i=0,dimz-1
+                  do j=start_time_step,end_time_step
+                     temp= f->$vNam(varn)$(j,i,:,:)
+                     data(varn,j-start_time_step,i) = dim_avg_Wrap(dim_avg_Wrap(temp(:,:)))
+                  end do
+               end do
+               print(" ")
+               print("Variable for combine '"+vNam(varn)+"' is read")
+               print(" ")
+            end if                 
             unit(varn) = temp@units
             if (n_o .GT. number_comb-1) then
@@ -956,11 +1005,41 @@
 
       if(check) then
+
          count_var=count_var+1
-     
-         z = f->$vNam(varn+1)$
-  
-         unit(varn) = temp@units
-         data(varn,:,:) = temp(start_time_step:end_time_step,0:dimz-1) 
- 
+
+         if (prof3d .EQ. 0) then
+            temp = f->$vNam(varn)$
+         else
+            do i=0,dimz-1
+               do j=start_time_step,end_time_step
+                  temp = f->$vNam(varn)$(j,i,:,:)
+                  data(varn,j-start_time_step,i) = dim_avg_Wrap(dim_avg_Wrap(temp(:,:)))
+               end do
+            end do
+            print(" ")
+            print("Variable '"+vNam(varn)+"' is read")
+            print(" ")
+            unit(varn) = temp@units
+            a=getvaratts(temp)
+            b=dimsizes(a)
+         end if
+    
+         if (prof3d .EQ. 0) then
+            z = f->$vNam(varn+1)$ 
+            unit(varn) = temp@units
+            data(varn,:,:) = temp(start_time_step:end_time_step,0:dimz-1) 
+         else 
+            do i=0,b-1            
+               if (isStrSubset( a(i),"zu_3d" ))
+                  z_v(varn,:) = z_u
+                  z = z_v(varn,:)
+               else
+                  if (isStrSubset( a(i),"zw_3d" ))
+                     z_v(varn,:) = z_w
+                     z = z_v(varn,:)
+                  end if                   
+               end if
+            end do            
+         end if
          if (over .EQ. 0) then  
             res@gsnLeftString      = vNam(varn)
@@ -2356,8 +2435,10 @@
          if (over .EQ. 0) then
             n=n+1  
-         end if      
-         varn=varn+1
-      end if      
-      delete(temp) 
+         end if  
+         if (prof3d .EQ. 0)then    
+            varn=varn+1
+         end if
+         delete(temp) 
+      end if          
    end do
 
@@ -2424,23 +2505,38 @@
    
       do varn = 0,dim-1    
+         
+         check = True
       
-         if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
-            check = False
+         if (prof3d .EQ. 0) then
+            if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
+               check = False
+            end if
          else
-            if (.not. isvar("var")) then
-               check = True
-               if (parameter(21) .NE. "variables") then
-                  var=parameter(21)
-                  check = isStrSubset( var,","+vNam(varn)+"," )
-               end if
-            else          
+            if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "zusi") .OR. isStrSubset( vNam(varn), "zwwi") .OR. isStrSubset( vNam(varn), "x") .OR. isStrSubset( vNam(varn), "xu") .OR. isStrSubset( vNam(varn), "y") .OR. isStrSubset( vNam(varn), "yv") .OR. isStrSubset( vNam(varn), "zu_3d") .OR. isStrSubset( vNam(varn), "zw_3d")) then
+               check = False
+            end if
+         end if
+
+         if (.not. isvar("var")) then
+            if (parameter(21) .NE. "variables") then
+               var=parameter(21)
                check = isStrSubset( var,","+vNam(varn)+"," )
             end if
-         end if  
+         else          
+            check = isStrSubset( var,","+vNam(varn)+"," )
+         end if      
 
          if (check)
-           
-            z = f->$vNam(varn+1)$
-           
+
+            if (prof3d .EQ. 1) then
+
+            end if
+          
+            if (prof3d .EQ. 0) then
+               z = f->$vNam(varn+1)$ 
+            else
+               z = z_v(varn,:)
+            end if
+
             res@gsnLeftString      = vNam(varn)
             res@gsnRightString     = unit(varn)
@@ -2515,5 +2611,7 @@
                   u=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue
                end if        
@@ -2565,5 +2663,7 @@
                   pt=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue       
                end if
@@ -2614,5 +2714,7 @@
                   q=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue   
                end if
@@ -2664,5 +2766,7 @@
                   e=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue   
                end if
@@ -2713,5 +2817,7 @@
                   km=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue   
                end if
@@ -2763,5 +2869,7 @@
                   wpup=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue    
                end if
@@ -2812,5 +2920,7 @@
                   wpup=0
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue   
                end if
@@ -2861,5 +2971,7 @@
                   wpptp=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue    
                end if
@@ -2910,5 +3022,7 @@
                   wsptsBC=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue   
                end if  
@@ -2959,5 +3073,7 @@
                   wpvptp=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue   
                end if
@@ -3008,5 +3124,7 @@
                   wpqp=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if 
                   continue   
                end if
@@ -3057,5 +3175,7 @@
                   wpqvp=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue   
                end if
@@ -3106,5 +3226,7 @@
                   wpsp=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue   
                end if
@@ -3155,5 +3277,7 @@
                   wpsap=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue   
                end if
@@ -3205,5 +3329,7 @@
                   us2=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue   
                end if
@@ -3255,10 +3381,14 @@
                   wsususodz=1
                else
-                  varn=varn+1
+                  if (prof3d .EQ. 0)then
+                     varn=varn+1
+                  end if
                   continue   
                end if
             end if     
-            n=n+1    
-            varn=varn+1
+            n=n+1 
+            if (prof3d .EQ. 0)then
+               varn=varn+1
+            end if   
          end if
       end do 
@@ -3266,30 +3396,41 @@
 
    if (combine .EQ. 1) then
+      co=0     
+      n_o=0
+      do varn = 0,dim-1
+ 
+         check = True
+      
+         if (prof3d .EQ. 0) then
+            if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
+               check = False
+            end if
+         else
+            if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "zusi") .OR. isStrSubset( vNam(varn), "zwwi") .OR. isStrSubset( vNam(varn), "x") .OR. isStrSubset( vNam(varn), "xu") .OR. isStrSubset( vNam(varn), "y") .OR. isStrSubset( vNam(varn), "yv") .OR. isStrSubset( vNam(varn), "zu_3d") .OR. isStrSubset( vNam(varn), "zw_3d")) then
+               check = False
+            end if
+         end if
+
+         if (.not. isvar("var")) then
+            if (parameter(21) .NE. "variables") then
+               var=parameter(21)
+               check = isStrSubset( var,","+vNam(varn)+"," )
+            end if
+         else          
+            check = isStrSubset( var,","+vNam(varn)+"," )
+         end if      
+
+         if (check)
+
+            if (prof3d .EQ. 0) then
+               z = f->$vNam(varn+1)$ 
+            else
+               z = z_v(varn,:)  
+            end if 
      
-      check=True      
-      n_o=0
-      do varn = 0,dim-1 
-  
-         if ( isStrSubset( vNam(varn), "NORM") .or. isStrSubset( vNam(varn), "time") )
-            check = False
-         else
-            if (.not. isvar("var")) then
-               check = True
-               if (parameter(21) .NE. "variables") then
-                  var=parameter(21)
-                  check = isStrSubset( var,","+vNam(varn)+"," )
-               end if
-            else          
-               check = isStrSubset( var,","+vNam(varn)+"," )
-            end if
-         end if
-     
-         if(check) then
-
-            z = f->$vNam(varn+1)$ 
             com=isStrSubset( c_var,","+vNam(varn)+"," )
-     
+        
             if (com) 
-                             
+               co = co+1           
                if (n_o .EQ. 1) then
                   res@xyDashPattern  = 1 
@@ -3326,15 +3467,25 @@
                plot_o(n_o)=gsn_csm_xy(wks,data(varn,:,:),z,res) 
                n_o=n_o+1
-            end if          
-            varn=varn+1   
+            end if 
+            if (prof3d .EQ. 0)then
+               varn=varn+1
+            end if           
          end if
       end do
    
       if(number_comb .EQ. 2)then
-         overlay(plot_o(0),plot_o(1))
+         if (co .EQ. 2)then 
+            overlay(plot_o(0),plot_o(1))
+         else
+            print("'c_var' is not conform with existing variables on the input file")
+         end if 
       end if
       if(number_comb .EQ. 3)then
-         overlay(plot_o(0),plot_o(1))
-         overlay(plot_o(0),plot_o(2))
+         if (co .EQ. 3)then 
+            overlay(plot_o(0),plot_o(1))
+            overlay(plot_o(0),plot_o(2))
+         else
+            print("'c_var' is not conform with existing variables on the input file")
+         end if 
       end if
 
Index: palm/trunk/SCRIPTS/NCL/timeseries.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/timeseries.ncl	(revision 173)
+++ palm/trunk/SCRIPTS/NCL/timeseries.ncl	(revision 174)
@@ -10,10 +10,10 @@
    ; ***************************************************
    
-   if (isfilepresent("~/.ncl_preferences")) then
-      parameter = asciiread("~/.ncl_preferences",75,"string")
+   if (isfilepresent(".ncl_preferences")) then
+      parameter = asciiread(".ncl_preferences",77,"string")
       delete(parameter@_FillValue)
    else
       print(" ")
-      print("Please copy '.ncl_preferences' into your $home dircetory")
+      print("'.ncl_preferences' is not existent")
       print(" ")
       exit
